diff --git a/core/embed/projects/boardloader/main.c b/core/embed/projects/boardloader/main.c index 106bdb1cc09..6098b298b74 100644 --- a/core/embed/projects/boardloader/main.c +++ b/core/embed/projects/boardloader/main.c @@ -332,7 +332,7 @@ int main(void) { system_deinit(); // g_boot_command is preserved on STM32U5 - jump_to(IMAGE_CODE_ALIGN(BOOTLOADER_START + IMAGE_HEADER_SIZE)); + jump_to_next_stage(IMAGE_CODE_ALIGN(BOOTLOADER_START + IMAGE_HEADER_SIZE)); return 0; } diff --git a/core/embed/projects/bootloader/emulator.c b/core/embed/projects/bootloader/emulator.c index b2bd30a452f..8f46770f5a1 100644 --- a/core/embed/projects/bootloader/emulator.c +++ b/core/embed/projects/bootloader/emulator.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -111,7 +112,7 @@ static int sdl_event_filter(void *userdata, SDL_Event *event) { return 1; } -__attribute__((noreturn)) int main(int argc, char **argv) { +int main(int argc, char **argv) { SDL_SetEventFilter(sdl_event_filter, NULL); display_init(DISPLAY_RESET_CONTENT); @@ -189,10 +190,12 @@ __attribute__((noreturn)) int main(int argc, char **argv) { bootloader_main(); hal_delay(3000); - jump_to(0); + jump_to_next_stage(0); + + return 0; } -void jump_to(uint32_t address) { +void jump_to_next_stage(uint32_t address) { bool storage_is_erased = storage_empty(&STORAGE_AREAS[0]) && storage_empty(&STORAGE_AREAS[1]); diff --git a/core/embed/projects/bootloader/emulator.h b/core/embed/projects/bootloader/emulator.h index aa90a93f823..721490e912a 100644 --- a/core/embed/projects/bootloader/emulator.h +++ b/core/embed/projects/bootloader/emulator.h @@ -7,6 +7,4 @@ extern uint8_t *FIRMWARE_START; -__attribute__((noreturn)) void jump_to(uint32_t address); - #endif diff --git a/core/embed/projects/bootloader/main.c b/core/embed/projects/bootloader/main.c index 2e4c495a7ee..0b40e198e62 100644 --- a/core/embed/projects/bootloader/main.c +++ b/core/embed/projects/bootloader/main.c @@ -381,7 +381,8 @@ void real_jump_to_firmware(void) { system_deinit(); - jump_to(IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE)); + jump_to_next_stage( + IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE)); } #ifdef USE_RESET_TO_BOOT diff --git a/core/embed/projects/bootloader_ci/main.c b/core/embed/projects/bootloader_ci/main.c index cc790e4ff32..634ee0864a3 100644 --- a/core/embed/projects/bootloader_ci/main.c +++ b/core/embed/projects/bootloader_ci/main.c @@ -276,7 +276,8 @@ int main(void) { system_deinit(); - jump_to(IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE)); + jump_to_next_stage( + IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE)); return 0; } diff --git a/core/embed/sys/startup/inc/sys/bootutils.h b/core/embed/sys/startup/inc/sys/bootutils.h index 25cde30bae3..53409dfc879 100644 --- a/core/embed/sys/startup/inc/sys/bootutils.h +++ b/core/embed/sys/startup/inc/sys/bootutils.h @@ -46,11 +46,11 @@ void __attribute__((noreturn)) reboot_and_upgrade(const uint8_t hash[32]); void __attribute__((noreturn)) secure_shutdown(void); // Jumps to the next booting stage (e.g. bootloader to firmware). -// `address` points to the flash at the vector table of the next stage. +// `vectbl_address` points to the flash at the vector table of the next stage. // // Before jumping, the function disables all interrupts and clears the // memory and registers that could contain sensitive information. -void jump_to(uint32_t address); +void jump_to_next_stage(uint32_t vectbl_address); // Ensure compatible hardware settings before jumping to // the different booting stage. This function is used to