summaryrefslogtreecommitdiff
path: root/include.mk
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-05-19 15:48:05 +0000
committerChristian Pointner <equinox@spreadspace.org>2012-05-19 15:48:05 +0000
commit6f9b8670eeead24d5014f383c5f06073ffebe562 (patch)
tree2544ad193cc718bb044855e478b3fd6d74f488d4 /include.mk
parentfixed README (diff)
more generic programmer
git-svn-id: https://svn.spreadspace.org/avr/trunk@12 aa12f405-d877-488e-9caf-2d797e2a1cc7
Diffstat (limited to 'include.mk')
-rw-r--r--include.mk55
1 files 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)/$@, )