Merge pull request #14624 from 0xc0170/fix-14432

error: use __INITIAL_SP from cmsis instead of RTX one
pull/14655/head
Martin Kojtal 2021-05-11 10:51:32 +02:00 committed by GitHub
commit 3bd40d3161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,7 @@
#include "platform/internal/mbed_error_hist.h" #include "platform/internal/mbed_error_hist.h"
#include "drivers/MbedCRC.h" #include "drivers/MbedCRC.h"
#include "mbed_rtx.h" #include "mbed_rtx.h"
#include "cmsis_compiler.h"
#ifdef MBED_CONF_RTOS_PRESENT #ifdef MBED_CONF_RTOS_PRESENT
#include "rtx_os.h" #include "rtx_os.h"
#endif #endif
@ -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; static bool is_reboot_error_valid = false;
#endif #endif
extern uint32_t __INITIAL_SP;
//Helper function to halt the system //Helper function to halt the system
static MBED_NORETURN void mbed_halt_system(void) static MBED_NORETURN void mbed_halt_system(void)
{ {
@ -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 mode. Then SP_reg is more correct.
psp_sp = mfc->SP_reg; 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"); print_stack_dump_core(msp_sp, msp_size, msp_sp, "MSP");
stack_sp = psp_sp; stack_sp = psp_sp;