aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/chibios.mk
diff options
context:
space:
mode:
authorGravatar Drashna Jaelre <drashna@live.com>2019-08-20 15:39:24 -0700
committerGravatar Yan-Fa Li <yanfali@gmail.com>2019-08-20 15:39:24 -0700
commit4003d077cef42d7a3405250ea6417db3a3549e9e (patch)
tree012079bc5fac326baafaba6514843e7ef0a05e5e /tmk_core/chibios.mk
parent91ee6a1dbb6f43ac708b0dc301f5cbcef6dcfdf5 (diff)
downloadqmk_firmware-4003d077cef42d7a3405250ea6417db3a3549e9e.tar.gz
Add a universal flash command for cli (#6224)
* Add universal flash command * Add bootloader info to I:C boards * Add support for ATSAM * Add messages for flash target * Message cleanup * Add USB ASP Flashing target * Make usbasp target more universal * Add phoney target for usbasp * Clarify error message when bootloader isn't matched
Diffstat (limited to 'tmk_core/chibios.mk')
-rw-r--r--tmk_core/chibios.mk26
1 files changed, 23 insertions, 3 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 4aebb4776..eee520467 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -234,9 +234,12 @@ qmk: $(BUILD_DIR)/$(TARGET).bin
zip $(TARGET).qmk -urj $(BUILD_DIR)/$(TARGET).json
printf "@ $(TARGET).json\n@=info.json\n" | zipnote -w $(TARGET).qmk
-dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
+define EXEC_DFU_UTIL
$(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))
@@ -253,7 +256,7 @@ dfu-util-wait: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
done; \
echo "Flashing $(TARGET).bin" ;\
sleep 1 ;\
- $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
+ $(call EXEC_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
@@ -268,7 +271,24 @@ ifndef TEENSY_LOADER_CLI
endif
endif
-teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter
+define EXEC_TEENSY
$(TEENSY_LOADER_CLI) -mmcu=$(MCU_LDSCRIPT) -w -v $(BUILD_DIR)/$(TARGET).hex
+endef
+
+teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter
+ $(call EXEC_TEENSY)
bin: $(BUILD_DIR)/$(TARGET).bin sizeafter
+ $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
+
+
+flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
+ifeq ($(strip $(BOOTLOADER)),dfu)
+ $(call EXEC_DFU_UTIL)
+else ifeq ($(strip $(MCU_FAMILY)),KINETIS)
+ $(call EXEC_TEENSY)
+else ifeq ($(strip $(MCU_FAMILY)),STM32)
+ $(call EXEC_DFU_UTIL)
+else
+ $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)"
+endif