@@ -527,7 +527,9 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
527
527
*/
528
528
static void prvResetNextTaskUnblockTime ( void ) PRIVILEGED_FUNCTION ;
529
529
530
- #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )
530
+ #if ( ( ( configUSE_TRACE_FACILITY == 1 ) || ( configGENERATE_RUN_TIME_STATS == 1 ) ) && \
531
+ ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && \
532
+ ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
531
533
532
534
/*
533
535
* Helper function used to pad task names with spaces when printing out
@@ -602,6 +604,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
602
604
/* The memory used for the task's TCB and stack are passed into this
603
605
* function - use them. */
604
606
pxNewTCB = ( TCB_t * ) pxTaskBuffer ; /*lint !e740 !e9087 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */
607
+ memset ( ( void * ) pxNewTCB , 0x00 , sizeof ( TCB_t ) );
605
608
pxNewTCB -> pxStack = ( StackType_t * ) puxStackBuffer ;
606
609
607
610
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
@@ -643,6 +646,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
643
646
* on the implementation of the port malloc function and whether or
644
647
* not static allocation is being used. */
645
648
pxNewTCB = ( TCB_t * ) pxTaskDefinition -> pxTaskBuffer ;
649
+ memset ( ( void * ) pxNewTCB , 0x00 , sizeof ( TCB_t ) );
646
650
647
651
/* Store the stack location in the TCB. */
648
652
pxNewTCB -> pxStack = pxTaskDefinition -> puxStackBuffer ;
@@ -692,6 +696,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
692
696
693
697
if ( pxNewTCB != NULL )
694
698
{
699
+ memset ( ( void * ) pxNewTCB , 0x00 , sizeof ( TCB_t ) );
700
+
695
701
/* Store the stack location in the TCB. */
696
702
pxNewTCB -> pxStack = pxTaskDefinition -> puxStackBuffer ;
697
703
@@ -747,6 +753,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
747
753
748
754
if ( pxNewTCB != NULL )
749
755
{
756
+ memset ( ( void * ) pxNewTCB , 0x00 , sizeof ( TCB_t ) );
757
+
750
758
/* Allocate space for the stack used by the task being created.
751
759
* The base of the stack memory stored in the TCB so the task can
752
760
* be deleted later if required. */
@@ -774,6 +782,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
774
782
775
783
if ( pxNewTCB != NULL )
776
784
{
785
+ memset ( ( void * ) pxNewTCB , 0x00 , sizeof ( TCB_t ) );
786
+
777
787
/* Store the stack location in the TCB. */
778
788
pxNewTCB -> pxStack = pxStack ;
779
789
}
@@ -910,9 +920,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
910
920
}
911
921
else
912
922
{
913
- /* The task has not been given a name, so just ensure there is a NULL
914
- * terminator when it is read out. */
915
- pxNewTCB -> pcTaskName [ 0 ] = 0x00 ;
923
+ mtCOVERAGE_TEST_MARKER ();
916
924
}
917
925
918
926
/* This is used as an array index so must ensure it's not too large. */
@@ -931,7 +939,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
931
939
#if ( configUSE_MUTEXES == 1 )
932
940
{
933
941
pxNewTCB -> uxBasePriority = uxPriority ;
934
- pxNewTCB -> uxMutexesHeld = 0 ;
935
942
}
936
943
#endif /* configUSE_MUTEXES */
937
944
@@ -946,24 +953,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
946
953
listSET_LIST_ITEM_VALUE ( & ( pxNewTCB -> xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
947
954
listSET_LIST_ITEM_OWNER ( & ( pxNewTCB -> xEventListItem ), pxNewTCB );
948
955
949
- #if ( portCRITICAL_NESTING_IN_TCB == 1 )
950
- {
951
- pxNewTCB -> uxCriticalNesting = ( UBaseType_t ) 0U ;
952
- }
953
- #endif /* portCRITICAL_NESTING_IN_TCB */
954
-
955
- #if ( configUSE_APPLICATION_TASK_TAG == 1 )
956
- {
957
- pxNewTCB -> pxTaskTag = NULL ;
958
- }
959
- #endif /* configUSE_APPLICATION_TASK_TAG */
960
-
961
- #if ( configGENERATE_RUN_TIME_STATS == 1 )
962
- {
963
- pxNewTCB -> ulRunTimeCounter = ( configRUN_TIME_COUNTER_TYPE ) 0 ;
964
- }
965
- #endif /* configGENERATE_RUN_TIME_STATS */
966
-
967
956
#if ( portUSING_MPU_WRAPPERS == 1 )
968
957
{
969
958
vPortStoreTaskMPUSettings ( & ( pxNewTCB -> xMPUSettings ), xRegions , pxNewTCB -> pxStack , ulStackDepth );
@@ -975,19 +964,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
975
964
}
976
965
#endif
977
966
978
- #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
979
- {
980
- memset ( ( void * ) & ( pxNewTCB -> pvThreadLocalStoragePointers [ 0 ] ), 0x00 , sizeof ( pxNewTCB -> pvThreadLocalStoragePointers ) );
981
- }
982
- #endif
983
-
984
- #if ( configUSE_TASK_NOTIFICATIONS == 1 )
985
- {
986
- memset ( ( void * ) & ( pxNewTCB -> ulNotifiedValue [ 0 ] ), 0x00 , sizeof ( pxNewTCB -> ulNotifiedValue ) );
987
- memset ( ( void * ) & ( pxNewTCB -> ucNotifyState [ 0 ] ), 0x00 , sizeof ( pxNewTCB -> ucNotifyState ) );
988
- }
989
- #endif
990
-
991
967
#if ( configUSE_NEWLIB_REENTRANT == 1 )
992
968
{
993
969
/* Initialise this task's Newlib reent structure.
@@ -997,12 +973,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
997
973
}
998
974
#endif
999
975
1000
- #if ( INCLUDE_xTaskAbortDelay == 1 )
1001
- {
1002
- pxNewTCB -> ucDelayAborted = pdFALSE ;
1003
- }
1004
- #endif
1005
-
1006
976
/* Initialize the TCB stack to look as if the task was already running,
1007
977
* but had been interrupted by the scheduler. The return address is set
1008
978
* to the start of the task function. Once the stack has been initialised
@@ -1122,10 +1092,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
1122
1092
{
1123
1093
/* Add a counter into the TCB for tracing only. */
1124
1094
pxNewTCB -> uxTCBNumber = uxTaskNumber ;
1125
-
1126
- /* Initialize the uxTaskNumber member to zero. It is utilized by the
1127
- * application using vTaskSetTaskNumber and uxTaskGetTaskNumber APIs. */
1128
- pxNewTCB -> uxTaskNumber = 0 ;
1129
1095
}
1130
1096
#endif /* configUSE_TRACE_FACILITY */
1131
1097
traceTASK_CREATE ( pxNewTCB );
@@ -3563,8 +3529,11 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
3563
3529
3564
3530
eSleepModeStatus eTaskConfirmSleepModeStatus ( void )
3565
3531
{
3566
- /* The idle task exists in addition to the application tasks. */
3567
- const UBaseType_t uxNonApplicationTasks = 1 ;
3532
+ #if ( INCLUDE_vTaskSuspend == 1 )
3533
+ /* The idle task exists in addition to the application tasks. */
3534
+ const UBaseType_t uxNonApplicationTasks = 1 ;
3535
+ #endif /* INCLUDE_vTaskSuspend */
3536
+
3568
3537
eSleepModeStatus eReturn = eStandardSleep ;
3569
3538
3570
3539
/* This function must be called from a critical section. */
@@ -3585,20 +3554,20 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
3585
3554
* because the scheduler is suspended. */
3586
3555
eReturn = eAbortSleep ;
3587
3556
}
3588
- else
3589
- {
3590
- /* If all the tasks are in the suspended list (which might mean they
3591
- * have an infinite block time rather than actually being suspended)
3592
- * then it is safe to turn all clocks off and just wait for external
3593
- * interrupts. */
3594
- if ( listCURRENT_LIST_LENGTH ( & xSuspendedTaskList ) == ( uxCurrentNumberOfTasks - uxNonApplicationTasks ) )
3557
+
3558
+ #if ( INCLUDE_vTaskSuspend == 1 )
3559
+ else if ( listCURRENT_LIST_LENGTH ( & xSuspendedTaskList ) == ( uxCurrentNumberOfTasks - uxNonApplicationTasks ) )
3595
3560
{
3561
+ /* If all the tasks are in the suspended list (which might mean they
3562
+ * have an infinite block time rather than actually being suspended)
3563
+ * then it is safe to turn all clocks off and just wait for external
3564
+ * interrupts. */
3596
3565
eReturn = eNoTasksWaitingTimeout ;
3597
3566
}
3598
- else
3599
- {
3600
- mtCOVERAGE_TEST_MARKER ();
3601
- }
3567
+ #endif /* INCLUDE_vTaskSuspend */
3568
+ else
3569
+ {
3570
+ mtCOVERAGE_TEST_MARKER ();
3602
3571
}
3603
3572
3604
3573
return eReturn ;
@@ -4412,7 +4381,9 @@ static void prvResetNextTaskUnblockTime( void )
4412
4381
#endif /* portCRITICAL_NESTING_IN_TCB */
4413
4382
/*-----------------------------------------------------------*/
4414
4383
4415
- #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )
4384
+ #if ( ( ( configUSE_TRACE_FACILITY == 1 ) || ( configGENERATE_RUN_TIME_STATS == 1 ) ) && \
4385
+ ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && \
4386
+ ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
4416
4387
4417
4388
static char * prvWriteNameToBuffer ( char * pcBuffer ,
4418
4389
const char * pcTaskName )
0 commit comments