summaryrefslogtreecommitdiff
path: root/include.mk
diff options
context:
space:
mode:
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)/$@, )