|
29 | 29 | #include <stdio.h>
|
30 | 30 | #endif
|
31 | 31 |
|
32 |
| -//Helper macro to get the current SP |
33 |
| -#define GET_CURRENT_SP(sp) \ |
34 |
| - { \ |
35 |
| - /*If in Handler mode we are always using MSP*/ \ |
36 |
| - if ( __get_IPSR() != 0U ) { \ |
37 |
| - sp = __get_MSP(); \ |
38 |
| - } else { \ |
39 |
| - /*Look into CONTROL.SPSEL value*/ \ |
40 |
| - if ((__get_CONTROL() & 2U) == 0U) { \ |
41 |
| - sp = __get_MSP();/*Read MSP*/ \ |
42 |
| - } else { \ |
43 |
| - sp = __get_PSP();/*Read PSP*/ \ |
44 |
| - } \ |
45 |
| - } \ |
46 |
| - } |
47 |
| - |
48 | 32 | #ifndef NDEBUG
|
49 | 33 | #define ERROR_REPORT(ctx, error_msg) print_error_report(ctx, error_msg)
|
50 | 34 | #else
|
@@ -132,10 +116,7 @@ static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsign
|
132 | 116 | current_error_ctx.thread_entry_address = (uint32_t)current_thread->thread_addr;
|
133 | 117 | current_error_ctx.thread_stack_size = current_thread->stack_size;
|
134 | 118 | current_error_ctx.thread_stack_mem = (uint32_t)current_thread->stack_mem;
|
135 |
| -#ifdef TARGET_CORTEX_M |
136 |
| - GET_CURRENT_SP(current_error_ctx.thread_current_sp); |
137 |
| -#endif //TARGET_CORTEX_M |
138 |
| - |
| 119 | + current_error_ctx.thread_current_sp = (uint32_t)¤t_error_ctx; // Address local variable to get a stack pointer |
139 | 120 | #endif //MBED_CONF_RTOS_PRESENT
|
140 | 121 |
|
141 | 122 | #if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED
|
@@ -368,14 +349,8 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
|
368 | 349 | #endif
|
369 | 350 |
|
370 | 351 | mbed_error_printf("\nError Value: 0x%X", ctx->error_value);
|
371 |
| -#ifdef TARGET_CORTEX_M |
372 | 352 | mbed_error_printf("\nCurrent Thread: Id: 0x%X Entry: 0x%X StackSize: 0x%X StackMem: 0x%X SP: 0x%X ",
|
373 | 353 | ctx->thread_id, ctx->thread_entry_address, ctx->thread_stack_size, ctx->thread_stack_mem, ctx->thread_current_sp);
|
374 |
| -#else |
375 |
| - //For Cortex-A targets we dont have support to capture the current SP |
376 |
| - mbed_error_printf("\nCurrent Thread: Id: 0x%X Entry: 0x%X StackSize: 0x%X StackMem: 0x%X ", |
377 |
| - ctx->thread_id, ctx->thread_entry_address, ctx->thread_stack_size, ctx->thread_stack_mem); |
378 |
| -#endif //TARGET_CORTEX_M |
379 | 354 |
|
380 | 355 | #if MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO && defined(MBED_CONF_RTOS_PRESENT)
|
381 | 356 | mbed_error_printf("\nNext:");
|
|
0 commit comments