43 lines
851 B
Makefile
43 lines
851 B
Makefile
|
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
|
||
|
|
||
|
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=./src/main.s.hex
|
||
|
|
||
|
all:
|
||
|
${ASM} -I ${INCLUDE} ${SRC} -o ${OUT} -m ${MAPFILE}
|
||
|
|
||
|
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
|
||
|
|
||
|
flash_usbasp: PROGRAMMER_TYPE = usbasp
|
||
|
flash_usbasp: PROGRAMMER_ARGS = # USBasp works with no further arguments
|
||
|
flash_usbasp: flash
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|