summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vlasov <sigprof@gmail.com>2020-08-12 18:53:53 +0300
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commitd00ac5dfb6388957d51f2666d8bd223bd3529151 (patch)
tree6bdb94a82495c115be91dd2019edcc179a5401da
parentea43bc8972d254e75062ac20472b156fd3d92ddc (diff)
Add `st-flash` flash target (#9964)
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
-rw-r--r--docs/flashing.md1
-rw-r--r--lib/python/qmk/cli/flash.py1
-rw-r--r--tmk_core/chibios.mk5
3 files changed, 7 insertions, 0 deletions
diff --git a/docs/flashing.md b/docs/flashing.md
index 1f71c253c3..5c245c5675 100644
--- a/docs/flashing.md
+++ b/docs/flashing.md
@@ -239,3 +239,4 @@ There are a number of DFU commands that you can use to flash firmware to a STM32
* `:dfu-util-split-left` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Left Side" EEPROM setting for split keyboards.
* `:dfu-util-split-right` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Right Side" EEPROM setting for split keyboards.
* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util.
+* `:st-flash` - This allows you to flash the firmware via the `st-flash` utility from [STLink Tools](https://github.com/stlink-org/stlink), rather than dfu-util.
diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py
index f8497071ef..cefb9ca31a 100644
--- a/lib/python/qmk/cli/flash.py
+++ b/lib/python/qmk/cli/flash.py
@@ -27,6 +27,7 @@ def print_bootloader_help():
cli.echo('\tdfu-util-split-left')
cli.echo('\tdfu-util-split-right')
cli.echo('\tst-link-cli')
+ cli.echo('\tst-flash')
cli.echo('For more info, visit https://docs.qmk.fm/#/flashing')
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 4e8abc9be6..a218488a19 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -318,12 +318,14 @@ ifneq ("$(SERIAL)","")
endif
ST_LINK_ARGS ?=
+ST_FLASH_ARGS ?=
# List any extra directories to look for libraries here.
EXTRALIBDIRS = $(RULESPATH)/ld
DFU_UTIL ?= dfu-util
ST_LINK_CLI ?= st-link_cli
+ST_FLASH ?= st-flash
define EXEC_DFU_UTIL
until $(DFU_UTIL) -l | grep -q "Found DFU"; do\
@@ -357,6 +359,9 @@ dfu-util-split-right: 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
+st-flash: $(BUILD_DIR)/$(TARGET).hex sizeafter
+ $(ST_FLASH) $(ST_FLASH_ARGS) --reset --format ihex write $(BUILD_DIR)/$(TARGET).hex
+
# Autodetect teensy loader
ifndef TEENSY_LOADER_CLI