Merge branch 'feature/freertos_static_allocation_task_memory_callbacks' into 'master'

freertos: Add memory hooks for static IDLE and Timer tasks

Closes IDF-2243 and IDFGH-5804

See merge request espressif/esp-idf!15545
This commit is contained in:
Darian
2021-10-23 07:20:30 +00:00
3 changed files with 73 additions and 23 deletions

View File

@@ -2260,30 +2260,30 @@ void vTaskStartScheduler( void )
{
BaseType_t xReturn;
#if ( configSUPPORT_STATIC_ALLOCATION == 1 && configSUPPORT_STATIC_ALLOCATION == 0 )
StaticTask_t *pxIdleTaskTCBBuffer[configNUM_CORES] = {NULL};
StackType_t *pxIdleTaskStackBuffer[configNUM_CORES] = {NULL};
uint32_t ulIdleTaskStackSize;
#endif
for(BaseType_t i = 0; i < configNUM_CORES; i++)
{
/* Add the idle task at the lowest priority. */
#if( 0 ) /* configSUPPORT_STATIC_ALLOCATION == 1 ) Temporarily unsupported IDF-2243 */
#ifdef ESP_PLATFORM
/* Create an IDLE task for each core */
for(BaseType_t xCoreID = 0; xCoreID < configNUM_CORES; xCoreID++)
#endif //ESP_PLATFORM
/* Add the idle task at the lowest priority. */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
{
StaticTask_t * pxIdleTaskTCBBuffer = NULL;
StackType_t * pxIdleTaskStackBuffer = NULL;
uint32_t ulIdleTaskStackSize;
/* The Idle task is created using user provided RAM - obtain the
address of the RAM then create the idle task. */
vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer[i], &pxIdleTaskStackBuffer[i], &ulIdleTaskStackSize );
xIdleTaskHandle[i] = xTaskCreateStaticPinnedToCore( prvIdleTask,
vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &ulIdleTaskStackSize );
xIdleTaskHandle[ xCoreID ] = xTaskCreateStaticPinnedToCore( prvIdleTask,
configIDLE_TASK_NAME,
ulIdleTaskStackSize,
( void * ) NULL, /*lint !e961. The cast is not redundant for all compilers. */
portPRIVILEGE_BIT, /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
pxIdleTaskStackBuffer[i],
pxIdleTaskTCBBuffer[i],
i ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
( void * ) NULL, /*lint !e961. The cast is not redundant for all compilers. */
portPRIVILEGE_BIT, /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
pxIdleTaskStackBuffer,
pxIdleTaskTCBBuffer,
xCoreID ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
if( xIdleTaskHandle[i] != NULL )
if( xIdleTaskHandle[ xCoreID ] != NULL )
{
xReturn = pdPASS;
}
@@ -2300,10 +2300,10 @@ void vTaskStartScheduler( void )
configIDLE_TASK_STACK_SIZE,
( void * ) NULL,
portPRIVILEGE_BIT, /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
&xIdleTaskHandle[i],
i ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
&xIdleTaskHandle[ xCoreID ],
xCoreID ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
if( xIdleTaskHandle[i] != NULL )
if( xIdleTaskHandle[ xCoreID ] != NULL )
{
xReturn = pdPASS;
}
@@ -2313,7 +2313,6 @@ void vTaskStartScheduler( void )
}
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
}
#if ( configUSE_TIMERS == 1 )
{