From 6f9b8670eeead24d5014f383c5f06073ffebe562 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 19 May 2012 15:48:05 +0000 Subject: more generic programmer git-svn-id: https://svn.spreadspace.org/avr/trunk@12 aa12f405-d877-488e-9caf-2d797e2a1cc7 --- include.mk | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/include.mk b/include.mk index 4a9627b..cece4e9 100644 --- a/include.mk +++ b/include.mk @@ -23,24 +23,34 @@ ifeq ($(BOARD_TYPE),teensy1) MCU := at90usb162 F_CPU := 16000000 +PROG := teensy endif ifeq ($(BOARD_TYPE),teensy2) MCU := atmega32u4 F_CPU := 16000000 +PROG := teensy endif ifeq ($(BOARD_TYPE),teensypp1) MCU := at90usb646 F_CPU := 16000000 +PROG := teensy endif ifeq ($(BOARD_TYPE),teensypp2) MCU := at90usb1286 F_CPU := 16000000 +PROG := teensy +endif +ifeq ($(BOARD_TYPE),hhd70dongle) +MCU := atmega32u4 +F_CPU := 16000000 +PROG := DFU endif -FORMAT := ihex CC = avr-gcc OBJCOPY = avr-objcopy + DFU = dfu-programmer +teensy = teensy_loader_cli ## Options common to compile, link and assembly rules COMMON = -mmcu=$(MCU) @@ -88,7 +98,7 @@ $(ELFFILE): $(OBJ) $(CC) $(OBJ) -o $@ $(LDFLAGS) $(HEXFILE): $(ELFFILE) - $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ + $(OBJCOPY) -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@ clean: rm -f *.o @@ -97,14 +107,47 @@ clean: rm -f $(ELFFILE) rm -f $(HEXFILE) -erase: + +### DFU-Programmer +define DFU/erase $(DFU) $(MCU) erase || true +endef + +define DFU/program + $(DFU) $(MCU) flash $1 +endef + +define DFU/reset + $(DFU) $(MCU) reset +endef + +define DFU/run + $(DFU) $(MCU) start +endef + +### teensy-Programmer +define teensy/erase +endef + +define teensy/program + $(teensy) -mmcu=$(MCU) -w -v $1 +endef + +define teensy/reset +endef + +define teensy/run +endef + +### Program Targets +erase: + $(call $(PROG)/$@, ) program: $(HEXFILE) erase - $(DFU) $(MCU) flash $< + $(call $(PROG)/$@, $(HEXFILE)) reset: - $(DFU) $(MCU) reset + $(call $(PROG)/$@, ) run: - $(DFU) $(MCU) start + $(call $(PROG)/$@, ) -- cgit v1.2.3