mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
refactor(freertos/idf): Move weak xTimerCreateTimerTask() to IDF additions header
A weak xTimerCreateTimerTask() was added to tasks.c as a workaround in ESP-IDF in order to prevent timers.c from being linked when unused. This commit moves that workaround to `freertos_tasks_c_additions.h`
This commit is contained in:
parent
a5f9a2505e
commit
e612db7d32
@ -6304,9 +6304,3 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
|
||||
#endif
|
||||
|
||||
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
|
||||
|
||||
/* If timers.c is not referenced anywhere, don't create the timer task to save RAM */
|
||||
BaseType_t __attribute__( ( weak ) ) xTimerCreateTimerTask( void )
|
||||
{
|
||||
return pdPASS;
|
||||
}
|
||||
|
@ -242,6 +242,27 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
|
||||
#endif /* CONFIG_FREERTOS_SMP && ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
||||
/*----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_TIMERS == 1 )
|
||||
|
||||
/*
|
||||
* In ESP-IDF, configUSE_TIMERS is always defined as 1 (i.e., not user configurable).
|
||||
* However, tasks.c: vTaskStartScheduler() will always call xTimerCreateTimerTask()
|
||||
* if ( configUSE_TIMERS == 1 ), thus causing the linker to link timers.c and
|
||||
* wasting some memory (due to the timer task being created)/
|
||||
*
|
||||
* If we provide a weak version of xTimerCreateTimerTask(), this version will be
|
||||
* compiled if the application does not call any other FreeRTOS timer functions.
|
||||
* Thus we can save some text/RAM as timers.c will not be linked and the timer
|
||||
* task never created.
|
||||
*/
|
||||
BaseType_t __attribute__( ( weak ) ) xTimerCreateTimerTask( void )
|
||||
{
|
||||
return pdPASS;
|
||||
}
|
||||
|
||||
#endif /* configUSE_TIMERS */
|
||||
/*----------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------- Task Utilities ------------------------------------------------- */
|
||||
|
||||
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
|
||||
|
Loading…
Reference in New Issue
Block a user