mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
feat(legacy): reboot to bootloader supervisor call constants
This commit is contained in:
parent
65aa3b49d9
commit
1699d33cfa
@ -64,7 +64,7 @@ static uint32_t svhandler_flash_lock(void) {
|
||||
}
|
||||
|
||||
static void __attribute__((noreturn)) svhandler_reboot_to_bootloader(void) {
|
||||
__asm__ __volatile__("ldr r12, =0x55aa55aa");
|
||||
*RETURN_TO_BOOTLOADER_FLAG_ADDR = RETURN_TO_BOOTLOADER_FLAG;
|
||||
scb_reset_system();
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,9 @@
|
||||
#define SVC_TIMER_MS 4
|
||||
#define SVC_REBOOT_TO_BOOTLOADER 5
|
||||
|
||||
#define RETURN_TO_BOOTLOADER_FLAG_ADDR ((uint32_t *)0x20010000)
|
||||
#define RETURN_TO_BOOTLOADER_FLAG 0x11
|
||||
|
||||
/* Unlocks flash. This function needs to be called before programming
|
||||
* or erasing. Multiple calls of flash_program and flash_erase can
|
||||
* follow and should be completed with flash_lock().
|
||||
@ -73,7 +76,7 @@ inline uint32_t svc_timer_ms(void) {
|
||||
}
|
||||
|
||||
/* Reboot to bootloader.
|
||||
* Sets a flag in register and reboots. When bootloader runs, it will recognize
|
||||
* Sets a flag in memory and reboots. When bootloader runs, it will recognize
|
||||
* flag and won't run firmware, but enter bootloader mode.
|
||||
*/
|
||||
inline void svc_reboot_to_bootloader(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user