mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
feat(legacy): reboot to bootloader supervisor call constants
This commit is contained in:
parent
65aa3b49d9
commit
1699d33cfa
legacy
@ -64,7 +64,7 @@ static uint32_t svhandler_flash_lock(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((noreturn)) svhandler_reboot_to_bootloader(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();
|
scb_reset_system();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
#define SVC_TIMER_MS 4
|
#define SVC_TIMER_MS 4
|
||||||
#define SVC_REBOOT_TO_BOOTLOADER 5
|
#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
|
/* Unlocks flash. This function needs to be called before programming
|
||||||
* or erasing. Multiple calls of flash_program and flash_erase can
|
* or erasing. Multiple calls of flash_program and flash_erase can
|
||||||
* follow and should be completed with flash_lock().
|
* follow and should be completed with flash_lock().
|
||||||
@ -73,7 +76,7 @@ inline uint32_t svc_timer_ms(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reboot to bootloader.
|
/* 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.
|
* flag and won't run firmware, but enter bootloader mode.
|
||||||
*/
|
*/
|
||||||
inline void svc_reboot_to_bootloader(void) {
|
inline void svc_reboot_to_bootloader(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user