diff --git a/core/embed/firmware/main.c b/core/embed/firmware/main.c index f6f032bfa..0e6d58e44 100644 --- a/core/embed/firmware/main.c +++ b/core/embed/firmware/main.c @@ -53,8 +53,6 @@ extern void shutdown_privileged(void); int main(void) { - random_delays_init(); - #ifdef RDI rdi_start(); #endif diff --git a/core/embed/firmware/startup.S b/core/embed/firmware/startup.S index a64bbf650..a0f3fb0d8 100644 --- a/core/embed/firmware/startup.S +++ b/core/embed/firmware/startup.S @@ -11,6 +11,7 @@ reset_handler: // (cf mpu_config_firmware in legacy bootloader) #if TREZOR_MODEL == 1 + cpsid if ldr r0, =0xE000ED08 // r0 = VTOR address ldr r1, =0x08010400 // r1 = FLASH_APP_START str r1, [r0] // assign @@ -43,11 +44,19 @@ reset_handler: ldr r1, = __stack_chk_guard str r0, [r1] +#ifdef RDI + bl random_delays_init +#endif + // re-enable exceptions // according to "ARM Cortex-M Programming Guide to Memory Barrier Instructions" Application Note 321, section 4.7: // "If it is not necessary to ensure that a pended interrupt is recognized immediately before // subsequent operations, it is not necessary to insert a memory barrier instruction." +#if TREZOR_MODEL == T cpsie f +#elif TREZOR_MODEL == 1 + cpsie if +#endif // enter the application code bl main