From f6176432d22509ba2fe7588d09637f3ded1944ce Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Wed, 5 May 2021 13:15:10 +0100 Subject: [PATCH 1/2] error: use __INITIAL_SP from cmsis instead of RTX one We used to require INITIAL_SP as rtx target headers define it. This should not be required, as cmsis already defines symbol __INITIAL_SP for all toolchains. Fixes #14432 --- platform/source/mbed_error.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/source/mbed_error.c b/platform/source/mbed_error.c index 17ec1cf2be..71b1e17c4e 100644 --- a/platform/source/mbed_error.c +++ b/platform/source/mbed_error.c @@ -29,6 +29,7 @@ #include "platform/internal/mbed_error_hist.h" #include "drivers/MbedCRC.h" #include "mbed_rtx.h" +#include "cmsis_compiler.h" #ifdef MBED_CONF_RTOS_PRESENT #include "rtx_os.h" #endif @@ -518,7 +519,7 @@ static void print_stack_dump(uint32_t stack_start, uint32_t stack_size, uint32_t // PSP mode. Then SP_reg is more correct. psp_sp = mfc->SP_reg; } - uint32_t msp_size = MAX(0, (int)INITIAL_SP - (int)msp_sp); + uint32_t msp_size = MAX(0, (int)__INITIAL_SP - (int)msp_sp); print_stack_dump_core(msp_sp, msp_size, msp_sp, "MSP"); stack_sp = psp_sp; From 3003a171b2d491647534cb326bff1a6e20ace75c Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Mon, 10 May 2021 16:04:02 +0100 Subject: [PATCH 2/2] fixup! error: use __INITIAL_SP from cmsis instead of RTX one --- platform/source/mbed_error.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/source/mbed_error.c b/platform/source/mbed_error.c index 71b1e17c4e..24508d31df 100644 --- a/platform/source/mbed_error.c +++ b/platform/source/mbed_error.c @@ -67,6 +67,8 @@ static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsign static bool is_reboot_error_valid = false; #endif +extern uint32_t __INITIAL_SP; + //Helper function to halt the system static MBED_NORETURN void mbed_halt_system(void) {