From 0eb27e9b47b83182d9e5f1d06968432361c76539 Mon Sep 17 00:00:00 2001 From: zvecr Date: Mon, 4 Oct 2021 17:37:58 +0100 Subject: [PATCH 1/3] Enable CLI flashing via mdloader --- docs/feature_userspace.md | 2 +- platforms/arm_atsam/flash.mk | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/feature_userspace.md b/docs/feature_userspace.md index 115ab7175306..8c617fe33a06 100644 --- a/docs/feature_userspace.md +++ b/docs/feature_userspace.md @@ -252,4 +252,4 @@ Also, holding Shift will add the flash target (`:flash`) to the command. Holdin And for the boards that lack a shift key, or that you want to always attempt the flashing part, you can add `FLASH_BOOTLOADER = yes` to the `rules.mk` of that keymap. -?> This should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely. And this doesn't support BootloadHID or mdloader. +?> This should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely. diff --git a/platforms/arm_atsam/flash.mk b/platforms/arm_atsam/flash.mk index f31d4b4d95ae..2076a7106452 100644 --- a/platforms/arm_atsam/flash.mk +++ b/platforms/arm_atsam/flash.mk @@ -3,9 +3,20 @@ # Architecture or project specific options # +MDLOADER_CLI ?= mdloader + +define EXEC_MDLOADER + $(MDLOADER_CLI) --first --download $(BUILD_DIR)/$(TARGET).bin --restart --forceeep=y +endef + +mdloader: bin + $(call EXEC_MDLOADER) + flash: bin ifneq ($(strip $(PROGRAM_CMD)),) $(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD) +else ifeq ($(strip $(ARM_ATSAM)),SAMD51J18A) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_MDLOADER) else $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)" endif From a29964bc00b154b79571fa8aed7355c0c7105c23 Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 6 Oct 2021 22:41:54 +0100 Subject: [PATCH 2/3] remove flag --- platforms/arm_atsam/flash.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/arm_atsam/flash.mk b/platforms/arm_atsam/flash.mk index 2076a7106452..8152610ceb4d 100644 --- a/platforms/arm_atsam/flash.mk +++ b/platforms/arm_atsam/flash.mk @@ -6,7 +6,7 @@ MDLOADER_CLI ?= mdloader define EXEC_MDLOADER - $(MDLOADER_CLI) --first --download $(BUILD_DIR)/$(TARGET).bin --restart --forceeep=y + $(MDLOADER_CLI) --first --download $(BUILD_DIR)/$(TARGET).bin --restart endef mdloader: bin From f72e3bf5b1f1297040734e2556be93f3f76e0308 Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 6 Oct 2021 22:54:46 +0100 Subject: [PATCH 3/3] Update qmk flash help --- lib/python/qmk/cli/flash.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py index c2d9e09c693c..28e48a410159 100644 --- a/lib/python/qmk/cli/flash.py +++ b/lib/python/qmk/cli/flash.py @@ -18,17 +18,21 @@ def print_bootloader_help(): """Prints the available bootloaders listed in docs.qmk.fm. """ cli.log.info('Here are the available bootloaders:') + cli.echo('\tavrdude') + cli.echo('\tbootloadhid') cli.echo('\tdfu') + cli.echo('\tdfu-util') + cli.echo('\tmdloader') + cli.echo('\tst-flash') + cli.echo('\tst-link-cli') + cli.log.info('Enhanced variants for split keyboards:') + cli.echo('\tavrdude-split-left') + cli.echo('\tavrdude-split-right') cli.echo('\tdfu-ee') cli.echo('\tdfu-split-left') cli.echo('\tdfu-split-right') - cli.echo('\tavrdude') - cli.echo('\tBootloadHID') - cli.echo('\tdfu-util') 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')