mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Add default implementations of vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory (#790)
This PR introduces configKERNEL_PROVIDED_STATIC_MEMORY option which the application can set to 1 to use the default implementations of vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory functions. If the application enables static allocation (i.e. sets configUSE_STATIC_ALLOCATION to 1) and does not provide the above 2 functions, it will result in linker error. The application has two options: 1. Set configKERNEL_PROVIDED_STATIC_MEMORY to 1 to use the default implementations of these functions. 2. Provide implementations of these 2 functions. Note that default definitions are only available for non-MPU ports. The reason is that the stack alignment requirements vary for different architectures.
This commit is contained in:
parent
c3ece08119
commit
7cd201c290
|
@ -1131,6 +1131,10 @@
|
||||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configKERNEL_PROVIDED_STATIC_MEMORY
|
||||||
|
#define configKERNEL_PROVIDED_STATIC_MEMORY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
|
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
|
||||||
/* Defaults to 1 for backward compatibility. */
|
/* Defaults to 1 for backward compatibility. */
|
||||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
|
49
tasks.c
49
tasks.c
|
@ -7653,3 +7653,52 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
|
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the kernel provided implementation of vApplicationGetIdleTaskMemory()
|
||||||
|
* to provide the memory that is used by the Idle task. It is used when
|
||||||
|
* configKERNEL_PROVIDED_STATIC_MEMORY is set to 1. The application can provide
|
||||||
|
* it's own implementation of vApplicationGetIdleTaskMemory by setting
|
||||||
|
* configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined.
|
||||||
|
*/
|
||||||
|
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||||
|
StackType_t ** ppxIdleTaskStackBuffer,
|
||||||
|
uint32_t * pulIdleTaskStackSize )
|
||||||
|
{
|
||||||
|
static StaticTask_t xIdleTaskTCB;
|
||||||
|
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||||
|
|
||||||
|
*ppxIdleTaskTCBBuffer = &( xIdleTaskTCB );
|
||||||
|
*ppxIdleTaskStackBuffer = &( uxIdleTaskStack[ 0 ] );
|
||||||
|
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the kernel provided implementation of vApplicationGetTimerTaskMemory()
|
||||||
|
* to provide the memory that is used by the Timer service task. It is used when
|
||||||
|
* configKERNEL_PROVIDED_STATIC_MEMORY is set to 1. The application can provide
|
||||||
|
* it's own implementation of vApplicationGetTimerTaskMemory by setting
|
||||||
|
* configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined.
|
||||||
|
*/
|
||||||
|
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||||
|
StackType_t ** ppxTimerTaskStackBuffer,
|
||||||
|
uint32_t * pulTimerTaskStackSize )
|
||||||
|
{
|
||||||
|
static StaticTask_t xTimerTaskTCB;
|
||||||
|
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||||
|
|
||||||
|
*ppxTimerTaskTCBBuffer = &( xTimerTaskTCB );
|
||||||
|
*ppxTimerTaskStackBuffer = &( uxTimerTaskStack[ 0 ] );
|
||||||
|
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 1 ) && ( portUSING_MPU_WRAPPERS == 0 ) ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue