diff options
author | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2023-04-26 16:32:15 +0800 |
commit | e4f4ceaf3f2e3d25fb282273a81f9b58790fc427 (patch) | |
tree | c0a257eab0ffe5238fdf2c04882e8ee1fe8fc46e /platforms/chibios/bootloaders | |
parent | 103badc87cb50db1ff3851c84331e86ba78fb681 (diff) |
merge upstream 713427c
Diffstat (limited to 'platforms/chibios/bootloaders')
-rw-r--r-- | platforms/chibios/bootloaders/stm32_dfu.c | 2 | ||||
-rw-r--r-- | platforms/chibios/bootloaders/uf2boot.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/platforms/chibios/bootloaders/stm32_dfu.c b/platforms/chibios/bootloaders/stm32_dfu.c index 7b4ab86033..f845bf21e9 100644 --- a/platforms/chibios/bootloaders/stm32_dfu.c +++ b/platforms/chibios/bootloaders/stm32_dfu.c @@ -27,7 +27,7 @@ extern uint32_t __ram0_end__; #endif #if STM32_BOOTLOADER_DUAL_BANK -# include "config_common.h" +# include "gpio.h" # ifndef STM32_BOOTLOADER_DUAL_BANK_GPIO # error "No STM32_BOOTLOADER_DUAL_BANK_GPIO defined, don't know which pin to toggle" 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) {} |