This commit is contained in:
Ilya Zhuravlev 2022-07-13 01:37:06 -06:00
parent 4c5373c834
commit cb8eaad17c
2 changed files with 12 additions and 9 deletions

View File

@ -20,7 +20,6 @@
#include "vial.h" #include "vial.h"
#endif #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" */ #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 #endif
BKP->DR10 = 0; BKP->DR10 = 0;
} }
void bootloader_jump(void) {
//Set backup register DR10 to enter bootloader on reset
BKP->DR10 = RTC_BOOTLOADER_FLAG;
NVIC_SystemReset();
}

View File

@ -16,6 +16,16 @@
#include "bootloader.h" #include "bootloader.h"
__attribute__((weak)) void bootloader_jump(void) {} #include <ch.h>
__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();
}