From 2a24f99d113fe54920e8533ad5fb6cd1da1335c1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 16 Apr 2021 07:50:21 +0200 Subject: bsps/arm: Set MSP in ARMv7-M start code Set the Main Stack Pointer (MSP) to the ISR stack area end just in case we run using the Process Stack Pointer (PSP). This helps if applications are started by a boot loader. --- bsps/arm/shared/start/start.S | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bsps/arm') diff --git a/bsps/arm/shared/start/start.S b/bsps/arm/shared/start/start.S index 50bf1d4841..bd623178ed 100644 --- a/bsps/arm/shared/start/start.S +++ b/bsps/arm/shared/start/start.S @@ -553,6 +553,14 @@ _start: #endif ldr sp, =_ISR_Stack_area_end + + /* + * Set the Main Stack Pointer (MSP) to the ISR stack area end just in + * case we run using the Process Stack Pointer (PSP). + */ + mov r0, sp + msr msp, r0 + ldr lr, =bsp_start_hook_0_done + 1 b bsp_start_hook_0 -- cgit v1.2.3