mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-07-17 19:13:52 +08:00
Merge branch 'bugfix/fix_stack_overflow_error' into 'master'
Fix FreeRTOS stack overflow checking missing See merge request sdk/ESP8266_RTOS_SDK!281
This commit is contained in:
@ -93,6 +93,7 @@ void IRAM_ATTR panicHandler(void *frame)
|
|||||||
// for panic the function that disable cache
|
// for panic the function that disable cache
|
||||||
Cache_Read_Enable_New();
|
Cache_Read_Enable_New();
|
||||||
|
|
||||||
|
task_info_t *task;
|
||||||
int *regs = (int *)frame;
|
int *regs = (int *)frame;
|
||||||
int x, y;
|
int x, y;
|
||||||
const char *sdesc[] = {
|
const char *sdesc[] = {
|
||||||
@ -108,35 +109,33 @@ void IRAM_ATTR panicHandler(void *frame)
|
|||||||
/* NMI can interrupt exception. */
|
/* NMI can interrupt exception. */
|
||||||
ETS_INTR_LOCK();
|
ETS_INTR_LOCK();
|
||||||
|
|
||||||
|
ets_printf("\r\n\r\n");
|
||||||
|
|
||||||
if (_Pri_3_NMICount == -1) {
|
if (_Pri_3_NMICount == -1) {
|
||||||
ets_printf("\nWatch dog triggle:\n\n");
|
ets_printf("Soft watch dog triggle:\r\n\r\n");
|
||||||
show_critical_info();
|
show_critical_info();
|
||||||
} else if (xPortInIsrContext()) {
|
} else if (xPortInIsrContext())
|
||||||
ets_printf("\nISR:\n\n");
|
ets_printf("Core 0 was running in ISR context:\r\n\r\n");
|
||||||
|
|
||||||
|
if ((task = (task_info_t *)xTaskGetCurrentTaskHandle())) {
|
||||||
|
StackType_t *pdata = task->pxStack;
|
||||||
|
StackType_t *end = task->pxEndOfStack + 4;
|
||||||
|
|
||||||
|
ets_printf("Task stack [%s] stack from [%p] to [%p], total [%d] size\r\n\r\n",
|
||||||
|
task->pcTaskName, pdata, end, end - pdata + 4);
|
||||||
|
|
||||||
|
panic_stack(pdata, end);
|
||||||
|
|
||||||
|
ets_printf("\r\n\r\n");
|
||||||
} else {
|
} else {
|
||||||
task_info_t *task = xTaskGetCurrentTaskHandle();
|
ets_printf("No task\r\n\r\n");
|
||||||
|
|
||||||
if (task) {
|
|
||||||
|
|
||||||
StackType_t *pdata = task->pxStack;
|
|
||||||
StackType_t *end = task->pxEndOfStack + 4;
|
|
||||||
|
|
||||||
ets_printf("\nTask stack [%s] stack from [%p] to [%p], total [%d] size\n\n",
|
|
||||||
task->pcTaskName, pdata, end, end - pdata + 4);
|
|
||||||
|
|
||||||
panic_stack(pdata, end);
|
|
||||||
|
|
||||||
ets_printf("\n");
|
|
||||||
} else {
|
|
||||||
ets_printf("\nNo task\n\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x = 0; x < 20; x += 4) {
|
for (x = 0; x < 20; x += 4) {
|
||||||
for (y = 0; y < 4; y++) {
|
for (y = 0; y < 4; y++) {
|
||||||
ets_printf("%8s: 0x%08x ", sdesc[x + y], regs[x + y + 1]);
|
ets_printf("%8s: 0x%08x ", sdesc[x + y], regs[x + y + 1]);
|
||||||
}
|
}
|
||||||
ets_printf("\n");
|
ets_printf("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -340,19 +340,14 @@ int IRAM_ATTR xPortInIsrContext(void)
|
|||||||
return _xt_isr_status != 0;
|
return _xt_isr_status != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
|
void __attribute__((weak)) vApplicationStackOverflowHook(xTaskHandle xTask, const char *pcTaskName)
|
||||||
{
|
{
|
||||||
printf("task [%s] stask overflow\n", pcTaskName);
|
int *p = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
void IRAM_ATTR __taskEXIT_CRITICAL(void)
|
ets_printf("***ERROR*** A stack overflow in task %s has been detected.\r\n", pcTaskName);
|
||||||
{
|
|
||||||
portEXIT_CRITICAL();
|
/* cause a exception to jump into panic function */
|
||||||
}
|
*p = 0;
|
||||||
|
|
||||||
void IRAM_ATTR __taskENTER_CRITICAL(void)
|
|
||||||
{
|
|
||||||
portENTER_CRITICAL();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signed portBASE_TYPE xTaskGenericCreate(TaskFunction_t pxTaskCode,
|
signed portBASE_TYPE xTaskGenericCreate(TaskFunction_t pxTaskCode,
|
||||||
|
Reference in New Issue
Block a user