uf2boot.c (527B)
1 // Copyright 2023 QMK 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 #include <stdint.h> 5 #include <hal.h> 6 #include "bootloader.h" 7 8 // From mmoskal/uf2-stm32f103's backup.c 9 #define MAGIC_BOOT 0x544F4F42UL 10 11 // defined by linker script 12 extern uint32_t _board_magic_reg[]; 13 #define MAGIC_REG _board_magic_reg[0] 14 15 void bootloader_jump(void) { 16 MAGIC_REG = MAGIC_BOOT; 17 NVIC_SystemReset(); 18 } 19 20 void mcu_reset(void) { 21 NVIC_SystemReset(); 22 } 23 24 /* not needed, no two-stage reset */ 25 void enter_bootloader_mode_if_requested(void) {}