1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 07:50:57 +00:00

fix(legacy): make RDI work on T1

This commit is contained in:
Ondrej Mikle 2021-06-14 16:28:07 +02:00 committed by Ondřej Vejpustek
parent 2491f871aa
commit daa94ac941
2 changed files with 9 additions and 2 deletions

View File

@ -53,8 +53,6 @@
extern void shutdown_privileged(void);
int main(void) {
random_delays_init();
#ifdef RDI
rdi_start();
#endif

View File

@ -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