From cb8eaad17c2cf2c1704f1ad6e2fd974ca230c9cf Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Wed, 13 Jul 2022 01:37:06 -0600 Subject: [PATCH] fix vibl --- .../chibios/boards/STM32_F103_vibl/board/board.c | 7 ------- platforms/chibios/bootloaders/vibl.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/platforms/chibios/boards/STM32_F103_vibl/board/board.c b/platforms/chibios/boards/STM32_F103_vibl/board/board.c index be4108c586..6bf920b8bc 100644 --- a/platforms/chibios/boards/STM32_F103_vibl/board/board.c +++ b/platforms/chibios/boards/STM32_F103_vibl/board/board.c @@ -20,7 +20,6 @@ #include "vial.h" #endif -#define RTC_BOOTLOADER_FLAG 0x7662 /* Flag whether to jump into bootloader, "vb" */ #define RTC_INSECURE_FLAG 0x4953 /* Flag to indicate qmk that we want to boot into insecure mode, "IS" */ /** @@ -62,9 +61,3 @@ void boardInit(void) { #endif BKP->DR10 = 0; } - -void bootloader_jump(void) { - //Set backup register DR10 to enter bootloader on reset - BKP->DR10 = RTC_BOOTLOADER_FLAG; - NVIC_SystemReset(); -} diff --git a/platforms/chibios/bootloaders/vibl.c b/platforms/chibios/bootloaders/vibl.c index bba9fc4637..f55bd90447 100644 --- a/platforms/chibios/bootloaders/vibl.c +++ b/platforms/chibios/bootloaders/vibl.c @@ -16,6 +16,16 @@ #include "bootloader.h" -__attribute__((weak)) void bootloader_jump(void) {} +#include -__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {} +#define RTC_BOOTLOADER_FLAG 0x7662 /* Flag whether to jump into bootloader, "vb" */ + +__attribute__((weak)) void bootloader_jump(void) { + BKP->DR10 = RTC_BOOTLOADER_FLAG; + NVIC_SystemReset(); +} + +__attribute__((weak)) void mcu_reset(void) { + BKP->DR10 = 0; + NVIC_SystemReset(); +}