summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-07-05 19:28:17 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-07-05 19:28:17 +0300
commitf9a6e34c28f6de0f6ec505144acc287b90326436 (patch)
treeb7d4bc00bba07e3b0e7c298e57462b80236da7c9 /tmk_core
parentb4cd0cfd15bf844ef5c8840592da55ceac342c9a (diff)
Add dfu-util command for programming
Also add .bin generation, which is needed for dfu-util.
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/avr.mk1
-rw-r--r--tmk_core/chibios.mk6
-rw-r--r--tmk_core/rules.mk6
3 files changed, 12 insertions, 1 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 72be5e6da1..3bf2b34f88 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -10,6 +10,7 @@ AR = avr-ar rcs
NM = avr-nm
HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
+BIN =
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 0abb933a8d..cb67ac6f25 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -113,6 +113,7 @@ AR = arm-none-eabi-ar
NM = arm-none-eabi-nm
HEX = $(OBJCOPY) -O $(FORMAT)
EEP =
+BIN = $(OBJCOPY) -O binary
THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB
@@ -151,4 +152,7 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH)/boards/$(BOARD)/bootloader_defs.h)","")
endif
# List any extra directories to look for libraries here.
-EXTRALIBDIRS = $(RULESPATH)/ld \ No newline at end of file
+EXTRALIBDIRS = $(RULESPATH)/ld
+
+dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter
+ dfu-util -D $(BUILD_DIR)/$(TARGET).bin \ No newline at end of file
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 7d3d8f9a6b..352e9314b6 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -234,6 +234,7 @@ MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
+MSG_BIN = Creating binary load file for Flash:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
@@ -369,6 +370,11 @@ gccversion :
$(eval CMD=$(NM) -n $< > $@ )
@$(BUILD_CMD)
+%.bin: %.elf
+ @$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
+ $(eval CMD=$(BIN) $< $@ || exit 0)
+ @$(BUILD_CMD)
+
# Create library from object files.
.SECONDARY : $(BUILD_DIR)/$(TARGET).a
.PRECIOUS : $(OBJ)