Skip to content

Commit

Permalink
fixup! chore(core): use cortex-m33 stack protection
Browse files Browse the repository at this point in the history
  • Loading branch information
cepetr committed Nov 15, 2023
1 parent 26e3e41 commit 3f94ef5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/embed/bootloader_ci/memory_stm32u5a.ld
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MEMORY {
}

main_stack_base = ORIGIN(SRAM2) + SIZEOF(.stack); /* 8-byte aligned full descending stack */
_sstack = ORIGIN(SRAM2) + 0x100;
_sstack = ORIGIN(SRAM2);
_estack = main_stack_base;

/* used by the startup code to populate variables used by the C code */
Expand Down Expand Up @@ -81,7 +81,7 @@ SECTIONS {
} >SRAM1

.stack : ALIGN(8) {
. = 16K + 0x100; /* Exactly 16K allocated for stack. Overflow causes MemManage fault (when using MPU). */
. = 16K; /* Overflow causes UsageFault */
} >SRAM2

.sensitive : ALIGN(512) {
Expand Down
5 changes: 5 additions & 0 deletions core/embed/bootloader_ci/startup_stm32u5.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
.global reset_handler
.type reset_handler, STT_FUNC
reset_handler:
// set the stack protection
ldr r0, =_sstack
add r0, r0, #16 // padding
msr MSPLIM, r0

// setup environment for subsequent stage of code
ldr r2, =0 // r2 - the word-sized value to be written

Expand Down

0 comments on commit 3f94ef5

Please sign in to comment.