summaryrefslogtreecommitdiff
path: root/platforms/chibios/bootloaders
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-01-15 15:04:32 +0000
committerGitHub <noreply@github.com>2023-01-15 15:04:32 +0000
commit0730740add19d3afe3d96ead50ba7d29e5dcb109 (patch)
tree2831363e9c2bd7d683bc60ce7ba5b32c5ee2302e /platforms/chibios/bootloaders
parenta92071494a95175b44a1a3912110c9432f63f3ed (diff)
Add mmoskal/uf2-stm32f103 bootloader support (#19594)
Diffstat (limited to 'platforms/chibios/bootloaders')
-rw-r--r--platforms/chibios/bootloaders/uf2boot.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/platforms/chibios/bootloaders/uf2boot.c b/platforms/chibios/bootloaders/uf2boot.c
new file mode 100644
index 0000000000..f5b1a64334
--- /dev/null
+++ b/platforms/chibios/bootloaders/uf2boot.c
@@ -0,0 +1,23 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "bootloader.h"
+
+// From mmoskal/uf2-stm32f103's backup.c
+#define MAGIC_BOOT 0x544F4F42UL
+
+// defined by linker script
+extern uint32_t _board_magic_reg[];
+#define MAGIC_REG _board_magic_reg[0]
+
+void bootloader_jump(void) {
+ MAGIC_REG = MAGIC_BOOT;
+ NVIC_SystemReset();
+}
+
+void mcu_reset(void) {
+ NVIC_SystemReset();
+}
+
+/* not needed, no two-stage reset */
+void enter_bootloader_mode_if_requested(void) {}