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_BOARD 1 /* Board mode */
|
||||||
#define configXT_SIMULATOR 0
|
#define configXT_SIMULATOR 0
|
||||||
|
|
||||||
#if CONFIG_ESP32_ENABLE_COREDUMP
|
|
||||||
#define configENABLE_TASK_SNAPSHOT 1
|
#define configENABLE_TASK_SNAPSHOT 1
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CONFIG_SYSVIEW_ENABLE
|
#if CONFIG_SYSVIEW_ENABLE
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
|
|
|
@ -4991,22 +4991,24 @@ TickType_t uxReturn;
|
||||||
#endif /* configUSE_TASK_NOTIFICATIONS */
|
#endif /* configUSE_TASK_NOTIFICATIONS */
|
||||||
|
|
||||||
#if ( configENABLE_TASK_SNAPSHOT == 1 )
|
#if ( configENABLE_TASK_SNAPSHOT == 1 )
|
||||||
|
static void prvTaskGetSnapshot( TaskSnapshot_t *pxTaskSnapshotArray, UBaseType_t *uxTask, TCB_t *pxTCB )
|
||||||
static void prvTaskGetSnapshot( TaskSnapshot_t *pxTaskSnapshotArray, UBaseType_t *uxTask, TCB_t *pxTCB )
|
{
|
||||||
{
|
if (pxTCB == NULL) {
|
||||||
pxTaskSnapshotArray[ *uxTask ].pxTCB = pxTCB;
|
return;
|
||||||
pxTaskSnapshotArray[ *uxTask ].pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
|
}
|
||||||
#if( portSTACK_GROWTH < 0 )
|
pxTaskSnapshotArray[ *uxTask ].pxTCB = pxTCB;
|
||||||
{
|
pxTaskSnapshotArray[ *uxTask ].pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
|
||||||
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxEndOfStack;
|
#if( portSTACK_GROWTH < 0 )
|
||||||
}
|
{
|
||||||
#else
|
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxEndOfStack;
|
||||||
{
|
}
|
||||||
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxStack;
|
#else
|
||||||
}
|
{
|
||||||
#endif
|
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxStack;
|
||||||
(*uxTask)++;
|
}
|
||||||
}
|
#endif
|
||||||
|
(*uxTask)++;
|
||||||
|
}
|
||||||
|
|
||||||
static void prvTaskGetSnapshotsFromList( TaskSnapshot_t *pxTaskSnapshotArray, UBaseType_t *uxTask, const UBaseType_t uxArraySize, List_t *pxList )
|
static void prvTaskGetSnapshotsFromList( TaskSnapshot_t *pxTaskSnapshotArray, UBaseType_t *uxTask, const UBaseType_t uxArraySize, List_t *pxList )
|
||||||
{
|
{
|
||||||
|
@ -5017,12 +5019,11 @@ TickType_t uxReturn;
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
|
||||||
|
|
||||||
if( *uxTask >= uxArraySize )
|
if( *uxTask >= uxArraySize )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
prvTaskGetSnapshot( pxTaskSnapshotArray, uxTask, pxNextTCB );
|
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
||||||
|
prvTaskGetSnapshot( pxTaskSnapshotArray, uxTask, pxNextTCB );
|
||||||
} while( pxNextTCB != pxFirstTCB );
|
} while( pxNextTCB != pxFirstTCB );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5035,8 +5036,6 @@ TickType_t uxReturn;
|
||||||
{
|
{
|
||||||
UBaseType_t uxTask = 0, i = 0;
|
UBaseType_t uxTask = 0, i = 0;
|
||||||
|
|
||||||
PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB[ portNUM_PROCESSORS ] = { NULL };
|
|
||||||
|
|
||||||
|
|
||||||
*pxTcbSz = sizeof(TCB_t);
|
*pxTcbSz = sizeof(TCB_t);
|
||||||
/* Fill in an TaskStatus_t structure with information on each
|
/* Fill in an TaskStatus_t structure with information on each
|
||||||
|
@ -5052,12 +5051,11 @@ PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB[ portNUM_PROCESSORS ] = { NULL };
|
||||||
task in the Blocked state. */
|
task in the Blocked state. */
|
||||||
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, ( List_t * ) pxDelayedTaskList );
|
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, ( List_t * ) pxDelayedTaskList );
|
||||||
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, ( List_t * ) pxOverflowDelayedTaskList );
|
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, ( List_t * ) pxOverflowDelayedTaskList );
|
||||||
for (i = 0; i < portNUM_PROCESSORS; i++) {
|
for (i = 0; i < portNUM_PROCESSORS; i++) {
|
||||||
if( uxTask >= uxArraySize )
|
if( uxTask >= uxArraySize )
|
||||||
break;
|
break;
|
||||||
prvTaskGetSnapshot( pxTaskSnapshotArray, &uxTask, pxCurrentTCB[ i ] );
|
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, &( xPendingReadyList[ i ] ) );
|
||||||
prvTaskGetSnapshotsFromList( pxTaskSnapshotArray, &uxTask, uxArraySize, &( xPendingReadyList[ i ] ) );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if( INCLUDE_vTaskDelete == 1 )
|
#if( INCLUDE_vTaskDelete == 1 )
|
||||||
{
|
{
|
||||||
|
|
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