updated the makefile to create the build directory as needed.

This commit is contained in:
Jake Goodwin 2023-04-02 18:21:37 -07:00
parent 50502e4d1c
commit af08ced653
1 changed files with 13 additions and 10 deletions

View File

@ -1,9 +1,10 @@
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/main.s
OUT=./build/prog
MAPFILE=./build/prog.map
SRC=./src
PROG=main
OUT=./build
MAPFILE=prog.map
F_CPU=1000000UL
MCU=atmega328p
@ -17,20 +18,22 @@ OBJDUMP = avr-objdump
AVRSIZE = avr-size
AVRDUDE = avrdude
PROG=./src/main.s.hex
#PROG=${OUT}/main.asm.hex
all:
${ASM} -I ${INCLUDE} ${SRC} -o ${OUT} -m ${MAPFILE}
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}
flash: ${PROG}
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
clean:
if test -e ${SRC}.hex; then
echo "cleaing hex files!";
rm ${SRC}.hex;
done;
fi
echo "cleaing hex files!";
rm ${OUT}/*
flash_usbasp: PROGRAMMER_TYPE = usbasp
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments