mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 00:08:10 +00:00
chore(legacy): unify {go,return}_to_bootloader => stay_in_bootloader
This commit is contained in:
parent
040d09397c
commit
1a71dcd0c5
@ -112,9 +112,9 @@ static void bootloader_loop(void) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
// grab go to bootloader flag as soon as possible
|
||||
// grab "stay in bootloader" flag as soon as possible
|
||||
register uint32_t r11 __asm__("r11");
|
||||
volatile uint32_t go_to_bootloader_flag = r11;
|
||||
volatile uint32_t stay_in_bootloader_flag = r11;
|
||||
|
||||
#ifndef APPVER
|
||||
setup();
|
||||
@ -128,7 +128,7 @@ int main(void) {
|
||||
|
||||
mpu_config_bootloader();
|
||||
|
||||
if (go_to_bootloader_flag == RETURN_TO_BOOTLOADER_FLAG) {
|
||||
if (stay_in_bootloader_flag == STAY_IN_BOOTLOADER_FLAG) {
|
||||
goto bootloader_loop_start;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ INCLUDE cortex-m-generic.ld
|
||||
|
||||
_ram_start = ORIGIN(ram);
|
||||
_ram_end = ORIGIN(ram) + LENGTH(ram);
|
||||
_go_to_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stay_in_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stack = _ram_end - 8;
|
||||
__stack_chk_guard = _ram_end - 8;
|
||||
system_millis = _ram_end - 4;
|
||||
|
@ -18,7 +18,7 @@ INCLUDE cortex-m-generic.ld
|
||||
|
||||
_ram_start = ORIGIN(ram);
|
||||
_ram_end = ORIGIN(ram) + LENGTH(ram);
|
||||
_go_to_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stay_in_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stack = _ram_end - 8;
|
||||
__stack_chk_guard = _ram_end - 8;
|
||||
system_millis = _ram_end - 4;
|
||||
|
@ -24,7 +24,7 @@ _codelen = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.ARM.exidx);
|
||||
|
||||
_ram_start = ORIGIN(ram);
|
||||
_ram_end = ORIGIN(ram) + LENGTH(ram);
|
||||
_go_to_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stay_in_bootloader_flag_addr = ABSOLUTE(0x20010000);
|
||||
_stack = _ram_end - 8;
|
||||
__stack_chk_guard = _ram_end - 8;
|
||||
system_millis = _ram_end - 4;
|
||||
|
@ -32,7 +32,7 @@ reset_handler:
|
||||
isb
|
||||
#endif
|
||||
|
||||
ldr r0, =_go_to_bootloader_flag_addr // r0 - address of storage for "go to bootloader" flag
|
||||
ldr r0, =_stay_in_bootloader_flag_addr // r0 - address of storage for "stay in bootloader" flag
|
||||
ldr r11, [r0] // r11 - keep in register and hope it gets to main
|
||||
|
||||
ldr r0, =_ram_start // r0 - point to beginning of SRAM
|
||||
|
@ -66,7 +66,7 @@ static uint32_t svhandler_flash_lock(void) {
|
||||
}
|
||||
|
||||
static void __attribute__((noreturn)) svhandler_reboot_to_bootloader(void) {
|
||||
*RETURN_TO_BOOTLOADER_FLAG_ADDR = RETURN_TO_BOOTLOADER_FLAG;
|
||||
*STAY_IN_BOOTLOADER_FLAG_ADDR = STAY_IN_BOOTLOADER_FLAG;
|
||||
scb_reset_system();
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
#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
|
||||
#define STAY_IN_BOOTLOADER_FLAG_ADDR ((uint32_t *)0x20010000)
|
||||
#define STAY_IN_BOOTLOADER_FLAG 0x11
|
||||
|
||||
/* Unlocks flash. This function needs to be called before programming
|
||||
* or erasing. Multiple calls of flash_program and flash_erase can
|
||||
|
Loading…
Reference in New Issue
Block a user