esp32: Fixes crash during core dump.
Removes piece of debugging code introduced by 8d43859b
.
This commit is contained in:
parent
050ae50e83
commit
4e0c3a0415
3 changed files with 60 additions and 29 deletions
|
@ -269,9 +269,7 @@ extern void vPortCleanUpTCB ( void *pxTCB );
|
|||
#define configXT_BOARD 1 /* Board mode */
|
||||
#define configXT_SIMULATOR 0
|
||||
|
||||
#if CONFIG_ESP32_ENABLE_COREDUMP
|
||||
#define configENABLE_TASK_SNAPSHOT 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_SYSVIEW_ENABLE
|
||||
#ifndef __ASSEMBLER__
|
||||
|
|
|
@ -4991,9 +4991,11 @@ TickType_t uxReturn;
|
|||
#endif /* configUSE_TASK_NOTIFICATIONS */
|
||||
|
||||
#if ( configENABLE_TASK_SNAPSHOT == 1 )
|
||||
|
||||
static void prvTaskGetSnapshot( TaskSnapshot_t *pxTaskSnapshotArray, UBaseType_t *uxTask, TCB_t *pxTCB )
|
||||
{
|
||||
if (pxTCB == NULL) {
|
||||
return;
|
||||
}
|
||||
pxTaskSnapshotArray[ *uxTask ].pxTCB = pxTCB;
|
||||
pxTaskSnapshotArray[ *uxTask ].pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
|
||||
#if( portSTACK_GROWTH < 0 )
|
||||
|
@ -5017,11 +5019,10 @@ TickType_t uxReturn;
|
|||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
||||
do
|
||||
{
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
||||
|
||||
if( *uxTask >= uxArraySize )
|
||||
break;
|
||||
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
||||
prvTaskGetSnapshot( pxTaskSnapshotArray, uxTask, pxNextTCB );
|
||||
} while( pxNextTCB != pxFirstTCB );
|
||||
}
|
||||
|
@ -5035,8 +5036,6 @@ TickType_t uxReturn;
|
|||
{
|
||||
UBaseType_t uxTask = 0, i = 0;
|
||||
|
||||
PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB[ portNUM_PROCESSORS ] = { NULL };
|
||||
|
||||
|
||||
*pxTcbSz = sizeof(TCB_t);
|
||||
/* Fill in an TaskStatus_t structure with information on each
|
||||
|
@ -5055,7 +5054,6 @@ PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB[ portNUM_PROCESSORS ] = { NULL };
|
|||
for (i = 0; i < portNUM_PROCESSORS; i++) {
|
||||
if( uxTask >= uxArraySize )
|
||||
break;
|
||||
prvTaskGetSnapshot( pxTaskSnapshotArray, &uxTask, pxCurrentTCB[ i ] );
|
||||
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, &( xPendingReadyList[ i ] ) );
|
||||
}
|
||||
|
||||
|
|
35
components/freertos/test/test_tasks_snapshot.c
Normal file
35
components/freertos/test/test_tasks_snapshot.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
Test FreeRTOS support for core dump.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "soc/cpu.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "unity.h"
|
||||
|
||||
#define TEST_MAX_TASKS_NUM 32
|
||||
|
||||
/* simple test to check that in normal conditions uxTaskGetSnapshotAll does not generate exception */
|
||||
TEST_CASE("Tasks snapshot", "[freertos]")
|
||||
{
|
||||
TaskSnapshot_t tasks[TEST_MAX_TASKS_NUM];
|
||||
UBaseType_t tcb_sz;
|
||||
int other_core_id = xPortGetCoreID() == 0 ? 1 : 0;
|
||||
|
||||
// uxTaskGetSnapshotAll is supposed to be called when all tasks on both CPUs are
|
||||
// inactive and can not alter FreeRTOS internal tasks lists, e.g. from panic handler
|
||||
unsigned state = portENTER_CRITICAL_NESTED();
|
||||
#if CONFIG_FREERTOS_UNICORE == 0
|
||||
esp_cpu_stall(other_core_id);
|
||||
#endif
|
||||
UBaseType_t task_num = uxTaskGetSnapshotAll(tasks, TEST_MAX_TASKS_NUM, &tcb_sz);
|
||||
#if CONFIG_FREERTOS_UNICORE == 0
|
||||
esp_cpu_unstall(other_core_id);
|
||||
#endif
|
||||
portEXIT_CRITICAL_NESTED(state);
|
||||
|
||||
printf("Dumped %d tasks. TCB size %d\n", task_num, tcb_sz);
|
||||
TEST_ASSERT_NOT_EQUAL(0, task_num);
|
||||
TEST_ASSERT_NOT_EQUAL(0, tcb_sz);
|
||||
}
|
Loading…
Reference in a new issue