aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-08-23 00:08:45 +0100
committerDrashna Jaelre <drashna@live.com>2019-08-22 16:08:45 -0700
commitae44ec9820cdf5348e802c9bae3af34557617685 (patch)
tree1c0e98156fa2df209290f295ff000264a1852df1 /tmk_core
parent1c805b3d008a98a5a15112b0655ba14b42dbae67 (diff)
downloadqmk_firmware-ae44ec9820cdf5348e802c9bae3af34557617685.tar.gz
qmk_firmware-ae44ec9820cdf5348e802c9bae3af34557617685.zip
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 eee520467..4b5b6d00b 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -235,28 +235,18 @@ qmk: $(BUILD_DIR)/$(TARGET).bin
235 printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk 235 printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk
236 236
237define EXEC_DFU_UTIL 237define EXEC_DFU_UTIL
238 until $(DFU_UTIL) -l | grep -q "Found DFU"; do\
239 echo "Error: Bootloader not found. Trying again in 5s." ;\
240 sleep 5 ;\
241 done
238 $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin 242 $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
239endef 243endef
240 244
241dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter 245dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
242 $(call EXEC_DFU_UTIL) 246 $(call EXEC_DFU_UTIL)
243 247
244ifneq ($(strip $(TIME_DELAY)),) 248# Legacy alias
245 TIME_DELAY = $(strip $(TIME_DELAY)) 249dfu-util-wait: dfu-util
246else
247 TIME_DELAY = 10
248endif
249dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
250 echo "Preparing to flash firmware. Please enter bootloader now..." ;\
251 COUNTDOWN=$(TIME_DELAY) ;\
252 while [[ $$COUNTDOWN -ge 1 ]] ; do \
253 echo "Flashing in $$COUNTDOWN ..."; \
254 sleep 1 ;\
255 ((COUNTDOWN = COUNTDOWN - 1)) ; \
256 done; \
257 echo "Flashing $(TARGET).bin" ;\
258 sleep 1 ;\
259 $(call EXEC_DFU_UTIL)
260 250
261st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter 251st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter
262 $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst 252 $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst