Commit 8c7ab2e8 authored by Johannes Wiesboeck's avatar Johannes Wiesboeck Committed by Oliver Horst
Browse files

[chg] Prefer dynamic over static allocation for system tasks.

Static allocation support is needed for POSIX layer, but messes with the
allocation of system tasks. Now dynamic allocation is enabled but system
tasks are allocated dynamically if possible.
parent f436a1ba
......@@ -1973,7 +1973,17 @@ void vTaskStartScheduler( void )
BaseType_t xReturn;
/* Add the idle task at the lowest priority. */
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
{
/* The Idle task is being created using dynamically allocated RAM. */
xReturn = xTaskCreate( prvIdleTask,
configIDLE_TASK_NAME,
configMINIMAL_STACK_SIZE,
( void * ) NULL,
( tskIDLE_PRIORITY | portPRIVILEGE_BIT ),
&xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
}
#else
{
StaticTask_t *pxIdleTaskTCBBuffer = NULL;
StackType_t *pxIdleTaskStackBuffer = NULL;
......@@ -1999,17 +2009,7 @@ BaseType_t xReturn;
xReturn = pdFAIL;
}
}
#else
{
/* The Idle task is being created using dynamically allocated RAM. */
xReturn = xTaskCreate( prvIdleTask,
configIDLE_TASK_NAME,
configMINIMAL_STACK_SIZE,
( void * ) NULL,
( tskIDLE_PRIORITY | portPRIVILEGE_BIT ),
&xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
#if ( configUSE_TIMERS == 1 )
{
......
......@@ -235,7 +235,16 @@ BaseType_t xReturn = pdFAIL;
if( xTimerQueue != NULL )
{
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
{
xReturn = xTaskCreate( prvTimerTask,
configTIMER_SERVICE_TASK_NAME,
configTIMER_TASK_STACK_DEPTH,
NULL,
( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
&xTimerTaskHandle );
}
#else
{
StaticTask_t *pxTimerTaskTCBBuffer = NULL;
StackType_t *pxTimerTaskStackBuffer = NULL;
......@@ -255,16 +264,7 @@ BaseType_t xReturn = pdFAIL;
xReturn = pdPASS;
}
}
#else
{
xReturn = xTaskCreate( prvTimerTask,
configTIMER_SERVICE_TASK_NAME,
configTIMER_TASK_STACK_DEPTH,
NULL,
( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
&xTimerTaskHandle );
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment