Skip to content

Commit c6de000

Browse files
committed
Added uxTaskGetStackHighWaterMark2(), which is the same as uxTaskGetStackHighWaterMark() other than the return type.
Allows the task name parameter passed into xTaskCreate() to be NULL.
1 parent e3dc5e9 commit c6de000

File tree

14 files changed

+140
-27
lines changed

14 files changed

+140
-27
lines changed

FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ to exclude the API function. */
114114
#define INCLUDE_xTaskGetSchedulerState 1
115115
#define INCLUDE_xTaskGetIdleTaskHandle 1
116116
#define INCLUDE_uxTaskGetStackHighWaterMark 1
117+
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
117118

118119
/* Cortex-M specific definitions. */
119120
#ifdef __NVIC_PRIO_BITS

FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<DebugFlag>
179179
<trace>0</trace>
180180
<periodic>1</periodic>
181-
<aLwin>1</aLwin>
181+
<aLwin>0</aLwin>
182182
<aCover>0</aCover>
183183
<aSer1>0</aSer1>
184184
<aSer2>0</aSer2>

FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ static void prvTaskToDelete( void *pvParameters )
766766

767767
/* For code coverage test purposes it is deleted by the Idle task. */
768768
configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 );
769+
configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 );
769770
vTaskSuspend( NULL );
770771
}
771772
/*-----------------------------------------------------------*/
@@ -1057,7 +1058,7 @@ void vApplicationMallocFailedHook( void )
10571058
}
10581059
/*-----------------------------------------------------------*/
10591060

1060-
static void prvTimerCallback( TaskHandle_t xExpiredTimer )
1061+
static void prvTimerCallback( TimerHandle_t xExpiredTimer )
10611062
{
10621063
uint32_t ulCount;
10631064

FreeRTOS/Demo/Common/Minimal/StaticAllocation.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,9 @@ TaskHandle_t xCreatedTask;
729729

730730
/* The variable that will hold the TCB of tasks created by this function. See
731731
the comments above the declaration of the xCreatorTaskTCBBuffer variable for
732-
more information. */
732+
more information. NOTE: This is not static so relies on the tasks that use it
733+
being deleted before this function returns and deallocates its stack. That will
734+
only be the case if configUSE_PREEMPTION is set to 1. */
733735
StaticTask_t xTCBBuffer;
734736

735737
/* This buffer that will be used as the stack of tasks created by this function.

FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ functions anyway. */
104104
#define INCLUDE_vTaskDelayUntil 1
105105
#define INCLUDE_vTaskDelay 1
106106
#define INCLUDE_uxTaskGetStackHighWaterMark 1
107+
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
107108
#define INCLUDE_xTaskGetSchedulerState 1
108109
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
109110
#define INCLUDE_xTaskGetIdleTaskHandle 1

FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
381381
xReturn = pdFAIL;
382382
}
383383

384+
if( uxTaskGetStackHighWaterMark2( NULL ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
385+
{
386+
xReturn = pdFAIL;
387+
}
388+
384389
/* Now obtain a task status without the high water mark but with the state,
385390
which in the case of the idle task should be Read. */
386391
xTimerTask = xTimerGetTimerDaemonTaskHandle();
@@ -408,6 +413,10 @@ const uint32_t ulRunTimeTollerance = ( uint32_t ) 0xfff;
408413
{
409414
xReturn = pdFAIL;
410415
}
416+
if( uxTaskGetStackHighWaterMark2( xTimerTask ) != ( configSTACK_DEPTH_TYPE ) xStatus.usStackHighWaterMark )
417+
{
418+
xReturn = pdFAIL;
419+
}
411420

412421
/* Attempting to abort a delay in the idle task should be guaranteed to
413422
fail as the idle task should never block. */

FreeRTOS/Demo/WIN32-MingW/main_full.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ int main_full( void )
201201
vStartDynamicPriorityTasks();
202202
vStartQueueSetTasks();
203203
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
204-
xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
204+
xTaskCreate( prvDemoQueueSpaceFunctions, NULL, configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); /* Name is null for code coverage. */
205205
vStartEventGroupTasks();
206206
vStartInterruptSemaphoreTasks();
207207
vStartQueueSetPollingTask();

FreeRTOS/Source/include/FreeRTOS.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ extern "C" {
156156
#define INCLUDE_uxTaskGetStackHighWaterMark 0
157157
#endif
158158

159+
#ifndef INCLUDE_uxTaskGetStackHighWaterMark2
160+
#define INCLUDE_uxTaskGetStackHighWaterMark2 0
161+
#endif
162+
159163
#ifndef INCLUDE_eTaskGetState
160164
#define INCLUDE_eTaskGetState 0
161165
#endif

FreeRTOS/Source/include/mpu_prototypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ UBaseType_t MPU_uxTaskGetNumberOfTasks( void );
6161
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery );
6262
TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery );
6363
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
64+
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask );
6465
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction );
6566
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask );
6667
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue );

FreeRTOS/Source/include/mpu_wrappers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ only for ports that are using the MPU. */
6767
#define pcTaskGetName MPU_pcTaskGetName
6868
#define xTaskGetHandle MPU_xTaskGetHandle
6969
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
70+
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
7071
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
7172
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
7273
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer

0 commit comments

Comments
 (0)