summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-08-23 00:08:45 +0100
committerFlorian Didron <fdidron@users.noreply.github.com>2019-09-05 16:15:42 +0900
commitd4a6178b89da11b0ce9626f6ea5c004162653359 (patch)
tree2cd1aed0426bdceaf99a92b4665ebdd7f1e113bb /tmk_core
parentf82d2aedb5f1ce0409f9d54b49c25663debdd12f (diff)
Align flashing behaviour of dfu-util (#6578)
* Align flashing retry logic of dfu-util * Align bootloader wait messages Co-Authored-By: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/chibios.mk22
1 files changed, 6 insertions, 16 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index eee520467d..4b5b6d00b5 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -235,28 +235,18 @@ qmk: $(BUILD_DIR)/$(TARGET).bin
printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk
define EXEC_DFU_UTIL
+ until $(DFU_UTIL) -l | grep -q "Found DFU"; do\
+ echo "Error: Bootloader not found. Trying again in 5s." ;\
+ sleep 5 ;\
+ done
$(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
endef
dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
$(call EXEC_DFU_UTIL)
-ifneq ($(strip $(TIME_DELAY)),)
- TIME_DELAY = $(strip $(TIME_DELAY))
-else
- TIME_DELAY = 10
-endif
-dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
- echo "Preparing to flash firmware. Please enter bootloader now..." ;\
- COUNTDOWN=$(TIME_DELAY) ;\
- while [[ $$COUNTDOWN -ge 1 ]] ; do \
- echo "Flashing in $$COUNTDOWN ..."; \
- sleep 1 ;\
- ((COUNTDOWN = COUNTDOWN - 1)) ; \
- done; \
- echo "Flashing $(TARGET).bin" ;\
- sleep 1 ;\
- $(call EXEC_DFU_UTIL)
+# Legacy alias
+dfu-util-wait: dfu-util
st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter
$(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst