@@ -463,6 +463,7 @@ typedef tskTCB TCB_t;
463
463
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-84 */
464
464
/* coverity[misra_c_2012_rule_8_4_violation] */
465
465
portDONT_DISCARD PRIVILEGED_DATA TCB_t * volatile pxCurrentTCBs [ configNUMBER_OF_CORES ];
466
+ #define pxCurrentTCB prvGetCurrentTCBUnsafe()
466
467
#endif
467
468
468
469
/* Lists for ready and blocked tasks. --------------------
@@ -2810,7 +2811,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
2810
2811
TCB_t * pxTCB ;
2811
2812
UBaseType_t uxCurrentBasePriority , uxPriorityUsedOnEntry ;
2812
2813
BaseType_t xYieldRequired = pdFALSE ;
2813
- TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCB ();
2814
2814
2815
2815
#if ( configNUMBER_OF_CORES > 1 )
2816
2816
BaseType_t xYieldForTask = pdFALSE ;
@@ -2856,6 +2856,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
2856
2856
{
2857
2857
#if ( configNUMBER_OF_CORES == 1 )
2858
2858
{
2859
+ TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCB ();
2860
+
2859
2861
if ( taskTASK_IS_RUNNING ( pxTCB ) == pdFALSE )
2860
2862
{
2861
2863
/* The priority of a task other than the currently
@@ -3459,7 +3461,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
3459
3461
BaseType_t xYieldRequired = pdFALSE ;
3460
3462
TCB_t * const pxTCB = xTaskToResume ;
3461
3463
UBaseType_t uxSavedInterruptStatus ;
3462
- TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
3463
3464
3464
3465
traceENTER_xTaskResumeFromISR ( xTaskToResume );
3465
3466
@@ -3497,6 +3498,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
3497
3498
{
3498
3499
#if ( configNUMBER_OF_CORES == 1 )
3499
3500
{
3501
+ TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
3502
+
3500
3503
/* Ready lists can be accessed so move the task from the
3501
3504
* suspended list to the ready list directly. */
3502
3505
if ( pxTCB -> uxPriority > pxConstCurrentTCB -> uxPriority )
@@ -4019,7 +4022,6 @@ BaseType_t xTaskResumeAll( void )
4019
4022
taskENTER_CRITICAL ();
4020
4023
{
4021
4024
BaseType_t xCoreID = portGET_CORE_ID ();
4022
- TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
4023
4025
4024
4026
/* If uxSchedulerSuspended is zero then this function does not match a
4025
4027
* previous call to vTaskSuspendAll(). */
@@ -4047,6 +4049,8 @@ BaseType_t xTaskResumeAll( void )
4047
4049
4048
4050
#if ( configNUMBER_OF_CORES == 1 )
4049
4051
{
4052
+ TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
4053
+
4050
4054
/* If the moved task has a priority higher than the current
4051
4055
* task then a yield must be performed. */
4052
4056
if ( pxTCB -> uxPriority > pxConstCurrentTCB -> uxPriority )
@@ -4721,7 +4725,10 @@ BaseType_t xTaskIncrementTick( void )
4721
4725
TCB_t * pxTCB ;
4722
4726
TickType_t xItemValue ;
4723
4727
BaseType_t xSwitchRequired = pdFALSE ;
4724
- TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
4728
+
4729
+ #if ( configNUMBER_OF_CORES == 1 )
4730
+ TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe ();
4731
+ #endif /* #if ( configNUMBER_OF_CORES == 1 ) */
4725
4732
4726
4733
#if ( configUSE_PREEMPTION == 1 ) && ( configNUMBER_OF_CORES > 1 )
4727
4734
BaseType_t xYieldRequiredForCore [ configNUMBER_OF_CORES ] = { pdFALSE };
0 commit comments