summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-04-25 13:40:56 +1000
committerGitHub <noreply@github.com>2021-04-25 13:40:56 +1000
commit891d18d3565090abd5f218a8787acc3e25349b73 (patch)
treea18a24e01c9fa0325d4574e7ff4975021cdaeb84 /tmk_core
parent2a61a500de6fb286cedf644f56d70d05a0b96f0d (diff)
Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600)
* Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/chibios.mk2
-rw-r--r--tmk_core/common/chibios/bootloader.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index 40595a1e3b..cdf9ba6495 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -190,6 +190,8 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld
else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld
+else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/ld/$(MCU_LDSCRIPT).ld)","")
+ LDSCRIPT = $(TOP_DIR)/platforms/chibios/$(BOARD)/ld/$(MCU_LDSCRIPT).ld
else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/common/ld/$(MCU_LDSCRIPT).ld)","")
LDSCRIPT = $(TOP_DIR)/platforms/chibios/common/ld/$(MCU_LDSCRIPT).ld
else ifneq ("$(wildcard $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld)","")
diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c
index 4a175a6283..f91ac7d9eb 100644
--- a/tmk_core/common/chibios/bootloader.c
+++ b/tmk_core/common/chibios/bootloader.c
@@ -13,7 +13,22 @@
# define STM32_BOOTLOADER_DUAL_BANK FALSE
#endif
-#if STM32_BOOTLOADER_DUAL_BANK
+#ifdef BOOTLOADER_TINYUF2
+
+# define DBL_TAP_MAGIC 0xf01669ef // From tinyuf2's board_api.h
+
+// defined by linker script
+extern uint32_t _board_dfu_dbl_tap[];
+# define DBL_TAP_REG _board_dfu_dbl_tap[0]
+
+void bootloader_jump(void) {
+ DBL_TAP_REG = DBL_TAP_MAGIC;
+ NVIC_SystemReset();
+}
+
+void enter_bootloader_mode_if_requested(void) { /* not needed, no two-stage reset */ }
+
+#elif STM32_BOOTLOADER_DUAL_BANK
// Need pin definitions
# include "config_common.h"