diff options
author | Drashna Jaelre <drashna@live.com> | 2018-10-26 21:21:43 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-10-27 00:21:43 -0400 |
commit | f16b5cc92b1fb3f5c551d009b11f291ee650b432 (patch) | |
tree | 367c53c0c702ff482814dfd6657d009a488c3fa9 | |
parent | 5632552558fc5e032e89c62d578dff7d3c3cb800 (diff) | |
download | qmk_firmware-f16b5cc92b1fb3f5c551d009b11f291ee650b432.tar.gz qmk_firmware-f16b5cc92b1fb3f5c551d009b11f291ee650b432.zip |
Add delayed flashing option for DFU Util (#4225)
* Add delayed flashing option for DFU Util
* Use a loop to make code cleaner
* Make delay configurable but default to 10
* Better formatting of check
-rw-r--r-- | tmk_core/chibios.mk | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 014c8d502..0f665450a 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk | |||
@@ -233,6 +233,24 @@ qmk: $(BUILD_DIR)/$(TARGET).bin | |||
233 | dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter | 233 | dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter |
234 | $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin | 234 | $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin |
235 | 235 | ||
236 | |||
237 | ifneq ($(strip $(TIME_DELAY)),) | ||
238 | TIME_DELAY = $(strip $(TIME_DELAY)) | ||
239 | else | ||
240 | TIME_DELAY = 10 | ||
241 | endif | ||
242 | dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter | ||
243 | echo "Preparing to flash firmware. Please enter bootloader now..." ;\ | ||
244 | COUNTDOWN=$(TIME_DELAY) ;\ | ||
245 | while [[ $$COUNTDOWN -ge 1 ]] ; do \ | ||
246 | echo "Flashing in $$COUNTDOWN ..."; \ | ||
247 | sleep 1 ;\ | ||
248 | ((COUNTDOWN = COUNTDOWN - 1)) ; \ | ||
249 | done; \ | ||
250 | echo "Flashing $(TARGET).bin" ;\ | ||
251 | sleep 1 ;\ | ||
252 | $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin | ||
253 | |||
236 | st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter | 254 | st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter |
237 | $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst | 255 | $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst |
238 | 256 | ||