summaryrefslogtreecommitdiff
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-08-24 16:35:11 +0100
committerFlorian Didron <fdidron@users.noreply.github.com>2019-08-28 14:54:06 +0900
commitcfbb03645e553a3c5b3cd06dd3a03c244e5e8ee0 (patch)
treecaf8e9e4fef4701ca4675d9ce9fee96285122f29 /tmk_core/avr.mk
parent592f65d28014d23c88d7632160e7f79029ebce3b (diff)
Add 'bootloadHID' flash target (#5587)
* Add 'bootloadHID' flash target * Prep for flash target * Add :flash support * Align bootloader wait messages Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update template to suggest use of :flash
Diffstat (limited to 'tmk_core/avr.mk')
-rw-r--r--tmk_core/avr.mk15
1 files changed, 15 insertions, 0 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index e5443418b9..bdda14a070 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -246,6 +246,19 @@ endef
usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
$(call EXEC_USBASP)
+BOOTLOADHID_PROGRAMMER ?= bootloadHID
+
+define EXEC_BOOTLOADHID
+ # bootloadHid executable has no cross platform detect methods
+ # so keep running bootloadHid if the output contains "The specified device was not found"
+ until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\
+ echo "Error: Bootloader not found. Trying again in 5s." ;\
+ sleep 5 ;\
+ done
+endef
+
+bootloadHID: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
+ $(call EXEC_BOOTLOADHID)
# Convert hex to bin.
bin: $(BUILD_DIR)/$(TARGET).hex
@@ -331,6 +344,8 @@ else ifeq (dfu,$(findstring dfu,$(BOOTLOADER)))
$(call EXEC_DFU)
else ifeq ($(strip $(BOOTLOADER)), USBasp)
$(call EXEC_USBASP)
+else ifeq ($(strip $(BOOTLOADER)), bootloadHID)
+ $(call EXEC_BOOTLOADHID)
else
$(PRINT_OK); $(SILENT) || printf "&(MSG_FLASH_BOOTLOADER)"
endif