AVR_ASM/makefile

46 lines
960 B
Makefile
Raw Permalink Normal View History

2023-04-03 00:51:26 +00:00
ASM=avra
#INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/m328pdef.inc
INCLUDE=/opt/microchip/mplabx/v6.05/packs/Microchip/ATmega_DFP/3.0.158/avrasm/inc/
SRC=./src
PROG=main
OUT=./build
MAPFILE=prog.map
2023-04-03 00:51:26 +00:00
F_CPU=1000000UL
MCU=atmega328p
BAUD = 9600UL
PROGRAMMER_TYPE = usbasp-clone
PROGRAMMER_ARGS = -b 9600 -B 4 -v
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
AVRSIZE = avr-size
AVRDUDE = avrdude
#PROG=${OUT}/main.asm.hex
2023-04-03 00:51:26 +00:00
all:
if [ -d ${OUT} ]; then return 0; else mkdir ${OUT}; fi
${ASM} -I ${INCLUDE} ${SRC}/${PROG}.asm -I ${OUT}/${PROG}.hex -m ${OUT}/${MAPFILE}
mv ${SRC}/*.hex ${OUT}
mv ${SRC}/*.obj ${OUT}
mv ${SRC}/*.cof ${OUT}
2023-04-03 00:51:26 +00:00
flash: ${PROG}
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
clean:
echo "cleaing hex files!";
rm ${OUT}/*
2023-04-03 00:51:26 +00:00
flash_usbasp: PROGRAMMER_TYPE = usbasp
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments
flash_usbasp: flash