Skip to content

Commit dc2f9e7

Browse files
cepetrCopilot
andcommitted
fix(core): handle stack overflow on stm32f4 properly
[no changelog] Co-authored-by: Copilot <copilot@github.com>
1 parent e37d8e7 commit dc2f9e7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/embed/sys/task/stm32/systask.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,9 @@ __attribute__((naked, no_stack_protector)) void MemManage_Handler(void) {
790790
"MOV R1, LR \n" // R1 = EXC_RETURN code
791791
#if !(defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__))
792792
"TST LR, #0x4 \n" // Return stack (1=>PSP, 0=>MSP)
793-
"BEQ 1f \n" // Skip stack ptr checking for PSP
793+
"BNE 1f \n" // Skip stack ptr checking for PSP
794794
"LDR R2, =%[sstack] \n"
795-
"CMP R0, R2 \n" // Check if PSP is below the stack
795+
"CMP R0, R2 \n" // Check if MSP is below the stack
796796
"ITT LO \n" // base
797797
"LDRLO R2, =%[estack] \n"
798798
"MSRLO MSP, R2 \n" // Reset MSP

0 commit comments

Comments
 (0)