Skip to content

Commit 14dd5b5

Browse files
feilipukar-rahul-awsSkptakaggarg
authored
use configSTACK_DEPTH_TYPE consequently (updated for 11.0.x) (#942)
* use configSTACK_DEPTH_TYPE consequently * update default to uint32_t * Update FreeRTOS.h Revert for backwards compatibility * Update portable.h * configSTACK_DEPTH_TYPE - unify stack variable naming * update lexicon.txt * update typo lexicon.txt * Update task.h * Update timers.h * fix merge typo * fix stack type * fix timer stack type * fix timer stack more * fix affinity set stack * adjust ports to use configSTACK_DEPTH_TYPE * fix vTaskListTasks * set default stack depth type in portable.h * fix History.txt * update affinityset * resolve reviewer comments * fix prvTaskCheckFreeStackSpace for variable stack size type * restore CoRoutine defines * remove obsolete stack ttype casts * fix (attempt) for format portable.h * Formatting fixes * prvTaskCheckFreeStackSpace make variable naming compliant * Update portable/GCC/ARM_CM33/non_secure/port.c Co-authored-by: Soren Ptak <[email protected]> * Update portable/GCC/ARM_CM23/non_secure/port.c Co-authored-by: Soren Ptak <[email protected]> * Apply suggestions from code review Update ulStackDepth to uxStackDepth Co-authored-by: Soren Ptak <[email protected]> * Correct uxStackDepth in port.c Also add uint32_t cast prvGetMPURegionSizeSetting. * Update ARM CM3 MPU port.c Revert casting of ( uint32_t ) pxBottomOfStack * Code review suggestions Signed-off-by: Gaurav Aggarwal <[email protected]> --------- Signed-off-by: Gaurav Aggarwal <[email protected]> Co-authored-by: Rahul Kar <[email protected]> Co-authored-by: Soren Ptak <[email protected]> Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]> Co-authored-by: Gaurav Aggarwal <[email protected]>
1 parent 5040a67 commit 14dd5b5

File tree

38 files changed

+197
-189
lines changed

38 files changed

+197
-189
lines changed

History.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Documentation and download available at https://www.FreeRTOS.org/
22

3+
+ Update all the APIs to use configSTACK_DEPTH_TYPE for stack type. If left
4+
undefined, configSTACK_DEPTH_TYPE defaults to StackType_t.
5+
36
Changes between FreeRTOS V11.0.0 and FreeRTOS V11.0.1 released December 21, 2023
47

58
+ Updated the SBOM file.

include/FreeRTOS.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1642,15 +1642,15 @@
16421642
#endif
16431643

16441644
#ifndef traceENTER_xTaskCreateStatic
1645-
#define traceENTER_xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer )
1645+
#define traceENTER_xTaskCreateStatic( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer )
16461646
#endif
16471647

16481648
#ifndef traceRETURN_xTaskCreateStatic
16491649
#define traceRETURN_xTaskCreateStatic( xReturn )
16501650
#endif
16511651

16521652
#ifndef traceENTER_xTaskCreateStaticAffinitySet
1653-
#define traceENTER_xTaskCreateStaticAffinitySet( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask )
1653+
#define traceENTER_xTaskCreateStaticAffinitySet( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask )
16541654
#endif
16551655

16561656
#ifndef traceRETURN_xTaskCreateStaticAffinitySet
@@ -1690,15 +1690,15 @@
16901690
#endif
16911691

16921692
#ifndef traceENTER_xTaskCreate
1693-
#define traceENTER_xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask )
1693+
#define traceENTER_xTaskCreate( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, pxCreatedTask )
16941694
#endif
16951695

16961696
#ifndef traceRETURN_xTaskCreate
16971697
#define traceRETURN_xTaskCreate( xReturn )
16981698
#endif
16991699

17001700
#ifndef traceENTER_xTaskCreateAffinitySet
1701-
#define traceENTER_xTaskCreateAffinitySet( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask )
1701+
#define traceENTER_xTaskCreateAffinitySet( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask )
17021702
#endif
17031703

17041704
#ifndef traceRETURN_xTaskCreateAffinitySet

include/mpu_prototypes.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL;
138138
* with all the APIs. */
139139
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
140140
const char * const pcName,
141-
const uint16_t usStackDepth,
141+
const configSTACK_DEPTH_TYPE uxStackDepth,
142142
void * const pvParameters,
143143
UBaseType_t uxPriority,
144144
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
145145
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
146146
const char * const pcName,
147-
const uint32_t ulStackDepth,
147+
const configSTACK_DEPTH_TYPE uxStackDepth,
148148
void * const pvParameters,
149149
UBaseType_t uxPriority,
150150
StackType_t * const puxStackBuffer,

include/portable.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
#define portARCH_NAME NULL
8686
#endif
8787

88+
#ifndef configSTACK_DEPTH_TYPE
89+
#define configSTACK_DEPTH_TYPE StackType_t
90+
#endif
91+
8892
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
8993
/* Defaults to 0 for backward compatibility. */
9094
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
@@ -228,7 +232,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
228232
void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
229233
const struct xMEMORY_REGION * const xRegions,
230234
StackType_t * pxBottomOfStack,
231-
uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
235+
configSTACK_DEPTH_TYPE uxStackDepth ) PRIVILEGED_FUNCTION;
232236
#endif
233237

234238
/**

include/task.h

+21-21
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ typedef enum
288288
* @code{c}
289289
* BaseType_t xTaskCreate(
290290
* TaskFunction_t pxTaskCode,
291-
* const char *pcName,
292-
* configSTACK_DEPTH_TYPE usStackDepth,
291+
* const char * const pcName,
292+
* const configSTACK_DEPTH_TYPE uxStackDepth,
293293
* void *pvParameters,
294294
* UBaseType_t uxPriority,
295295
* TaskHandle_t *pxCreatedTask
@@ -323,9 +323,9 @@ typedef enum
323323
* facilitate debugging. Max length defined by configMAX_TASK_NAME_LEN - default
324324
* is 16.
325325
*
326-
* @param usStackDepth The size of the task stack specified as the number of
326+
* @param uxStackDepth The size of the task stack specified as the number of
327327
* variables the stack can hold - not the number of bytes. For example, if
328-
* the stack is 16 bits wide and usStackDepth is defined as 100, 200 bytes
328+
* the stack is 16 bits wide and uxStackDepth is defined as 100, 200 bytes
329329
* will be allocated for stack storage.
330330
*
331331
* @param pvParameters Pointer that will be used as the parameter for the task
@@ -380,7 +380,7 @@ typedef enum
380380
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
381381
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
382382
const char * const pcName,
383-
const configSTACK_DEPTH_TYPE usStackDepth,
383+
const configSTACK_DEPTH_TYPE uxStackDepth,
384384
void * const pvParameters,
385385
UBaseType_t uxPriority,
386386
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
@@ -389,7 +389,7 @@ typedef enum
389389
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
390390
BaseType_t xTaskCreateAffinitySet( TaskFunction_t pxTaskCode,
391391
const char * const pcName,
392-
const configSTACK_DEPTH_TYPE usStackDepth,
392+
const configSTACK_DEPTH_TYPE uxStackDepth,
393393
void * const pvParameters,
394394
UBaseType_t uxPriority,
395395
UBaseType_t uxCoreAffinityMask,
@@ -400,8 +400,8 @@ typedef enum
400400
* task. h
401401
* @code{c}
402402
* TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
403-
* const char *pcName,
404-
* uint32_t ulStackDepth,
403+
* const char * const pcName,
404+
* const configSTACK_DEPTH_TYPE uxStackDepth,
405405
* void *pvParameters,
406406
* UBaseType_t uxPriority,
407407
* StackType_t *puxStackBuffer,
@@ -427,9 +427,9 @@ typedef enum
427427
* facilitate debugging. The maximum length of the string is defined by
428428
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
429429
*
430-
* @param ulStackDepth The size of the task stack specified as the number of
430+
* @param uxStackDepth The size of the task stack specified as the number of
431431
* variables the stack can hold - not the number of bytes. For example, if
432-
* the stack is 32-bits wide and ulStackDepth is defined as 100 then 400 bytes
432+
* the stack is 32-bits wide and uxStackDepth is defined as 100 then 400 bytes
433433
* will be allocated for stack storage.
434434
*
435435
* @param pvParameters Pointer that will be used as the parameter for the task
@@ -438,7 +438,7 @@ typedef enum
438438
* @param uxPriority The priority at which the task will run.
439439
*
440440
* @param puxStackBuffer Must point to a StackType_t array that has at least
441-
* ulStackDepth indexes - the array will then be used as the task's stack,
441+
* uxStackDepth indexes - the array will then be used as the task's stack,
442442
* removing the need for the stack to be allocated dynamically.
443443
*
444444
* @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will
@@ -507,7 +507,7 @@ typedef enum
507507
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
508508
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
509509
const char * const pcName,
510-
const uint32_t ulStackDepth,
510+
const configSTACK_DEPTH_TYPE uxStackDepth,
511511
void * const pvParameters,
512512
UBaseType_t uxPriority,
513513
StackType_t * const puxStackBuffer,
@@ -517,7 +517,7 @@ typedef enum
517517
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
518518
TaskHandle_t xTaskCreateStaticAffinitySet( TaskFunction_t pxTaskCode,
519519
const char * const pcName,
520-
const uint32_t ulStackDepth,
520+
const configSTACK_DEPTH_TYPE uxStackDepth,
521521
void * const pvParameters,
522522
UBaseType_t uxPriority,
523523
StackType_t * const puxStackBuffer,
@@ -561,7 +561,7 @@ typedef enum
561561
* {
562562
* vATask, // pvTaskCode - the function that implements the task.
563563
* "ATask", // pcName - just a text name for the task to assist debugging.
564-
* 100, // usStackDepth - the stack size DEFINED IN WORDS.
564+
* 100, // uxStackDepth - the stack size DEFINED IN WORDS.
565565
* NULL, // pvParameters - passed into the task function as the function parameters.
566566
* ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
567567
* cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
@@ -655,7 +655,7 @@ typedef enum
655655
* {
656656
* vATask, // pvTaskCode - the function that implements the task.
657657
* "ATask", // pcName - just a text name for the task to assist debugging.
658-
* 100, // usStackDepth - the stack size DEFINED IN WORDS.
658+
* 100, // uxStackDepth - the stack size DEFINED IN WORDS.
659659
* NULL, // pvParameters - passed into the task function as the function parameters.
660660
* ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
661661
* cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
@@ -1987,24 +1987,24 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
19871987
/**
19881988
* task.h
19891989
* @code{c}
1990-
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
1990+
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, configSTACK_DEPTH_TYPE * puxIdleTaskStackSize )
19911991
* @endcode
19921992
*
19931993
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task TCB. This function is required when
19941994
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
19951995
*
19961996
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
19971997
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
1998-
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
1998+
* @param puxIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
19991999
*/
20002000
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
20012001
StackType_t ** ppxIdleTaskStackBuffer,
2002-
uint32_t * pulIdleTaskStackSize );
2002+
configSTACK_DEPTH_TYPE * puxIdleTaskStackSize );
20032003

20042004
/**
20052005
* task.h
20062006
* @code{c}
2007-
* void vApplicationGetPassiveIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize, BaseType_t xCoreID )
2007+
* void vApplicationGetPassiveIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, configSTACK_DEPTH_TYPE * puxIdleTaskStackSize, BaseType_t xCoreID )
20082008
* @endcode
20092009
*
20102010
* 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
@@ -2022,13 +2022,13 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
20222022
*
20232023
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
20242024
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
2025-
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
2025+
* @param puxIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
20262026
* @param xPassiveIdleTaskIndex The passive idle task index of the idle task buffer
20272027
*/
20282028
#if ( configNUMBER_OF_CORES > 1 )
20292029
void vApplicationGetPassiveIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
20302030
StackType_t ** ppxIdleTaskStackBuffer,
2031-
uint32_t * pulIdleTaskStackSize,
2031+
configSTACK_DEPTH_TYPE * puxIdleTaskStackSize,
20322032
BaseType_t xPassiveIdleTaskIndex );
20332033
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
20342034
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */

include/timers.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1384,19 +1384,19 @@ BaseType_t xTimerGenericCommandFromISR( TimerHandle_t xTimer,
13841384
/**
13851385
* task.h
13861386
* @code{c}
1387-
* void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
1387+
* void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, configSTACK_DEPTH_TYPE * puxTimerTaskStackSize )
13881388
* @endcode
13891389
*
13901390
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when
13911391
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
13921392
*
13931393
* @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer
13941394
* @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
1395-
* @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
1395+
* @param puxTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
13961396
*/
13971397
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
13981398
StackType_t ** ppxTimerTaskStackBuffer,
1399-
uint32_t * pulTimerTaskStackSize );
1399+
configSTACK_DEPTH_TYPE * puxTimerTaskStackSize );
14001400

14011401
#endif
14021402

portable/ARMv8M/non_secure/port.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
17751775
void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
17761776
const struct xMEMORY_REGION * const xRegions,
17771777
StackType_t * pxBottomOfStack,
1778-
uint32_t ulStackDepth )
1778+
configSTACK_DEPTH_TYPE uxStackDepth )
17791779
{
17801780
uint32_t ulRegionStartAddress, ulRegionEndAddress, ulRegionNumber;
17811781
int32_t lIndex = 0;
@@ -1800,10 +1800,10 @@ void vPortEndScheduler( void ) /* PRIVILEGED_FUNCTION */
18001800
* which case the stack region parameters will be valid. At all other
18011801
* times the stack parameters will not be valid and it is assumed that
18021802
* the stack region has already been configured. */
1803-
if( ulStackDepth > 0 )
1803+
if( uxStackDepth > 0 )
18041804
{
18051805
ulRegionStartAddress = ( uint32_t ) pxBottomOfStack;
1806-
ulRegionEndAddress = ( uint32_t ) pxBottomOfStack + ( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) - 1;
1806+
ulRegionEndAddress = ( uint32_t ) pxBottomOfStack + ( uxStackDepth * ( configSTACK_DEPTH_TYPE ) sizeof( StackType_t ) ) - 1;
18071807

18081808
/* If the stack is within the privileged SRAM, do not protect it
18091809
* using a separate MPU region. This is needed because privileged

portable/Common/mpu_wrappers.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
5858
BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode,
5959
const char * const pcName,
60-
uint16_t usStackDepth,
60+
const configSTACK_DEPTH_TYPE uxStackDepth,
6161
void * pvParameters,
6262
UBaseType_t uxPriority,
6363
TaskHandle_t * pxCreatedTask ) /* FREERTOS_SYSTEM_CALL */
@@ -72,15 +72,15 @@
7272
uxPriority = uxPriority & ~( portPRIVILEGE_BIT );
7373
portMEMORY_BARRIER();
7474

75-
xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
75+
xReturn = xTaskCreate( pvTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, pxCreatedTask );
7676
portMEMORY_BARRIER();
7777

7878
portRESET_PRIVILEGE();
7979
portMEMORY_BARRIER();
8080
}
8181
else
8282
{
83-
xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
83+
xReturn = xTaskCreate( pvTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, pxCreatedTask );
8484
}
8585

8686
return xReturn;
@@ -91,7 +91,7 @@
9191
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
9292
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
9393
const char * const pcName,
94-
const uint32_t ulStackDepth,
94+
const configSTACK_DEPTH_TYPE uxStackDepth,
9595
void * const pvParameters,
9696
UBaseType_t uxPriority,
9797
StackType_t * const puxStackBuffer,
@@ -107,15 +107,15 @@
107107
uxPriority = uxPriority & ~( portPRIVILEGE_BIT );
108108
portMEMORY_BARRIER();
109109

110-
xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
110+
xReturn = xTaskCreateStatic( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
111111
portMEMORY_BARRIER();
112112

113113
portRESET_PRIVILEGE();
114114
portMEMORY_BARRIER();
115115
}
116116
else
117117
{
118-
xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
118+
xReturn = xTaskCreateStatic( pxTaskCode, pcName, uxStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
119119
}
120120

121121
return xReturn;

0 commit comments

Comments
 (0)