fix(legacy): make RDI work on T1

pull/1681/head
Ondrej Mikle 3 years ago committed by Ondřej Vejpustek
parent 2491f871aa
commit daa94ac941

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

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

Loading…
Cancel
Save