66 .type reset_handler, STT_FUNC
77reset_handler:
88
9- // The following loading of VTOR address only works if T1 bootloader was built with PRODUCTION=0
10- // or the firmware was properly signed. All other variants end up in hard fault due to MPU
11- // (cf mpu_config_firmware in legacy bootloader)
12-
13- #if defined TREZOR_MODEL_1
149 cpsid if
1510 ldr r0, =0xE000ED08 // r0 = VTOR address
16- ldr r1, =0x08010400 // r1 = FLASH_APP_START
11+ ldr r1, =_vector_offset // r1 = FLASH_APP_START
1712 str r1, [r0] // assign
1813
1914 ldr r0, =_estack // r0 = stack pointer
2015 msr msp, r0 // set stack pointer
2116 dsb
2217 isb
23- #endif
2418
2519 // setup environment for subsequent stage of code
2620 ldr r0, =axiram_start // r0 - point to beginning of axiram
@@ -44,16 +38,6 @@ reset_handler:
4438 ldr r1, = __stack_chk_guard
4539 str r0, [r1]
4640
47- // re-enable exceptions
48- // according to "ARM Cortex-M Programming Guide to Memory Barrier Instructions" Application Note 321, section 4.7:
49- // "If it is not necessary to ensure that a pended interrupt is recognized immediately before
50- // subsequent operations, it is not necessary to insert a memory barrier instruction."
51- #if defined TREZOR_MODEL_T || defined TREZOR_MODEL_R
52- cpsie f
53- #elif defined TREZOR_MODEL_1
54- cpsie if
55- #endif
56-
5741 // enter the application code
5842 bl main
5943
0 commit comments