Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SMP get idle task memory for static allocation #784

Merged
merged 26 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5ab2cc9
Add static idle task memory support for SMP
chinglee-iot Sep 7, 2023
1e37622
Update for uncrustify
chinglee-iot Sep 7, 2023
7c78535
Remove the prvUpdateIdleTaskName function
chinglee-iot Sep 8, 2023
c226907
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Sep 8, 2023
c20e5ae
Fix typo with variable
chinglee-iot Sep 8, 2023
ec47ccc
Rename the minimal idle task to passive idle task
chinglee-iot Sep 13, 2023
83b61f9
Rename prvActiveIdleTask to prvIdleTask
chinglee-iot Sep 19, 2023
4538aad
Add more check in xTaskGetIdleTaskHandle
chinglee-iot Sep 19, 2023
429b6ef
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Sep 21, 2023
aa7881a
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Sep 25, 2023
8d2eefa
Remove temp files
chinglee-iot Sep 25, 2023
45431fa
Merge branch 'update-smp-idle-task-memory' of https://github.com/chin…
chinglee-iot Sep 25, 2023
997e6f9
Update the comments
chinglee-iot Sep 25, 2023
210a8c5
Support configKERNEL_PROVIDED_STATIC_MEMORY
chinglee-iot Sep 25, 2023
e8869b9
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Sep 26, 2023
aeedc5f
Update comment in task.h
chinglee-iot Sep 26, 2023
95473b5
Merge branch 'update-smp-idle-task-memory' of https://github.com/chin…
chinglee-iot Sep 26, 2023
af7f08a
Fix compilation error
chinglee-iot Sep 26, 2023
af8b2bf
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Sep 28, 2023
4da435c
Code review suggestions
aggarg Oct 4, 2023
5ffda13
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Oct 4, 2023
742b5a4
Fix uncrustify
chinglee-iot Oct 5, 2023
afc2423
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Oct 5, 2023
1196733
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Oct 6, 2023
ca7319e
Merge branch 'main' into update-smp-idle-task-memory
chinglee-iot Oct 11, 2023
9989e0b
Merge branch 'main' into update-smp-idle-task-memory
aggarg Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions include/FreeRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
#endif

#if ( configNUMBER_OF_CORES > 1 )
#ifndef configUSE_MINIMAL_IDLE_HOOK
#error Missing definition: configUSE_MINIMAL_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
#ifndef configUSE_PASSIVE_IDLE_HOOK
#error Missing definition: configUSE_PASSIVE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
#endif
#endif

Expand Down Expand Up @@ -473,9 +473,9 @@
#define configUSE_CORE_AFFINITY 0
#endif /* configUSE_CORE_AFFINITY */

#ifndef configUSE_MINIMAL_IDLE_HOOK
#define configUSE_MINIMAL_IDLE_HOOK 0
#endif /* configUSE_MINIMAL_IDLE_HOOK */
#ifndef configUSE_PASSIVE_IDLE_HOOK
#define configUSE_PASSIVE_IDLE_HOOK 0
#endif /* configUSE_PASSIVE_IDLE_HOOK */

/* The timers module relies on xTaskGetSchedulerState(). */
#if configUSE_TIMERS == 1
Expand Down Expand Up @@ -1834,8 +1834,14 @@
#define traceRETURN_uxTaskGetSystemState( uxTask )
#endif

#ifndef traceENTER_xTaskGetIdleTaskHandle
#define traceENTER_xTaskGetIdleTaskHandle()
#if ( configNUMBER_OF_CORES == 1 )
#ifndef traceENTER_xTaskGetIdleTaskHandle
#define traceENTER_xTaskGetIdleTaskHandle()
#endif
#else
#ifndef traceENTER_xTaskGetIdleTaskHandle
#define traceENTER_xTaskGetIdleTaskHandle( xCoreID )
#endif
#endif

#ifndef traceRETURN_xTaskGetIdleTaskHandle
Expand Down
57 changes: 52 additions & 5 deletions include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,8 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL

#if ( configSUPPORT_STATIC_ALLOCATION == 1 )

#if ( configNUMBER_OF_CORES == 1 )

/**
* task.h
* @code{c}
Expand All @@ -1943,10 +1945,41 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
*/
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
#endif
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
#else /* #if ( configNUMBER_OF_CORES == 1 ) */

/**
* task.h
* @code{c}
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize, BaseType_t xCoreID )
* @endcode
*
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Tasks TCB. This function is required when
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
*
* In the FreeRTOS SMP, there are a total of configNUMBER_OF_CORES idle tasks:
* 1. 1 Active idle task which does all the housekeeping.
* 2. ( configNUMBER_OF_CORES - 1 ) Passive idle tasks which do nothing.
* These idle tasks are created to ensure that each core has an idle task to run when
* no other task is available to run.
*
* The function vApplicationGetIdleTaskMemory is called with xCoreID 0 to get the
* memory for Active idle task. It is called with xCoreID 1, 2 ... ( configNUMBER_OF_CORES - 1 )
* to get memory for passive idle tasks.
*
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
* @param xCoreId The core index of the idle task buffer
*/
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize, /*lint !e526 Symbol not defined as it is an application callback. */
BaseType_t xCoreID );
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */

/**
* task.h
Expand All @@ -1970,8 +2003,22 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask,
*
* Simply returns the handle of the idle task. It is not valid to call
* xTaskGetIdleTaskHandle() before the scheduler has been started.
*
* In the FreeRTOS SMP, there are a total of configNUMBER_OF_CORES idle tasks:
* 1. 1 Active idle task which does all the housekeeping.
* 2. ( configNUMBER_OF_CORES - 1 ) Passive idle tasks which do nothing.
* These idle tasks are created to ensure that each core has an idle task to run when
* no other task is available to run.
*
* Set xCoreID to 0 to get the Active idle task handle. Set xCoreID to
* 1,2 ... ( configNUMBER_OF_CORES - 1 ) to get the Passive idle task
* handles.
*/
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
#if ( configNUMBER_OF_CORES == 1 )
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
TaskHandle_t xTaskGetIdleTaskHandle( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */

/**
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for
Expand Down
Loading