From 84bcdfe2f6ada6a6baf3a49c4274f761fcb8732d Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sun, 6 May 2012 11:04:54 +0200 Subject: digital/avr/make: add rule to program board in Makefile --- digital/avr/make/Makefile.avr | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'digital') diff --git a/digital/avr/make/Makefile.avr b/digital/avr/make/Makefile.avr index 1fe5ff31..73ec6a2a 100644 --- a/digital/avr/make/Makefile.avr +++ b/digital/avr/make/Makefile.avr @@ -19,6 +19,11 @@ endif AVR_COMPILE.S := $(AVR_CC) $(AVR_ASFLAGS) $(AVR_CPPFLAGS) -c AVR_LINK.o := $(AVR_CC) $(AVR_CFLAGS) $(AVR_LDFLAGS) +AVRDUDE := avrdude +AVRDUDE_PROGRAMMER ?= stk500v2 +AVRDUDE_PORT ?= /dev/ttyUSB1 +AVR_PROGRAM ?= $(AVRDUDE) -c $(AVRDUDE_PROGRAMMER) -P $(AVRDUDE_PORT) -p $(AVR_MCU) -U flash:w:$< + # Main rules. avr: elf lst hex size @@ -26,7 +31,7 @@ avr: elf lst hex size simu: simuelf .PHONY: avr simu clean.avr clean.simu elf simuelf lst \ - text hex srec bin eeprom ehex esrec ebin + text hex srec bin eeprom ehex esrec ebin program # General rules. @@ -125,6 +130,18 @@ esrec: $(AVR_PROGS:%=%_eeprom.srec) %_eeprom.bin: %.avr.elf $(AVR_OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@ +# Rules for programming AVR. + +ifeq ($(words $(AVR_PROGS)),1) +program: $(AVR_PROGS:%=%.program) +else +program: + @echo Several programs, choose which one to program with "make name.program". +endif + +%.program: %.hex + $(AVR_PROGRAM) + # Cleaning. clean.avr: -- cgit v1.2.3