Skip to content

error: use __INITIAL_SP from cmsis instead of RTX one #14624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion platform/source/mbed_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,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)
{
Expand Down Expand Up @@ -518,7 +521,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;
Expand Down