Skip to content

Commit 69581fa

Browse files
committed
Fix compiler error
1 parent c774dfd commit 69581fa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tasks.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ typedef tskTCB TCB_t;
463463
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-84 */
464464
/* coverity[misra_c_2012_rule_8_4_violation] */
465465
portDONT_DISCARD PRIVILEGED_DATA TCB_t * volatile pxCurrentTCBs[ configNUMBER_OF_CORES ];
466+
#define pxCurrentTCB prvGetCurrentTCBUnsafe()
466467
#endif
467468

468469
/* Lists for ready and blocked tasks. --------------------
@@ -2810,7 +2811,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
28102811
TCB_t * pxTCB;
28112812
UBaseType_t uxCurrentBasePriority, uxPriorityUsedOnEntry;
28122813
BaseType_t xYieldRequired = pdFALSE;
2813-
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCB();
28142814

28152815
#if ( configNUMBER_OF_CORES > 1 )
28162816
BaseType_t xYieldForTask = pdFALSE;
@@ -2856,6 +2856,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
28562856
{
28572857
#if ( configNUMBER_OF_CORES == 1 )
28582858
{
2859+
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCB();
2860+
28592861
if( taskTASK_IS_RUNNING( pxTCB ) == pdFALSE )
28602862
{
28612863
/* The priority of a task other than the currently
@@ -3459,7 +3461,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
34593461
BaseType_t xYieldRequired = pdFALSE;
34603462
TCB_t * const pxTCB = xTaskToResume;
34613463
UBaseType_t uxSavedInterruptStatus;
3462-
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe();
34633464

34643465
traceENTER_xTaskResumeFromISR( xTaskToResume );
34653466

@@ -3497,6 +3498,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
34973498
{
34983499
#if ( configNUMBER_OF_CORES == 1 )
34993500
{
3501+
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe();
3502+
35003503
/* Ready lists can be accessed so move the task from the
35013504
* suspended list to the ready list directly. */
35023505
if( pxTCB->uxPriority > pxConstCurrentTCB->uxPriority )
@@ -4019,7 +4022,6 @@ BaseType_t xTaskResumeAll( void )
40194022
taskENTER_CRITICAL();
40204023
{
40214024
BaseType_t xCoreID = portGET_CORE_ID();
4022-
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe();
40234025

40244026
/* If uxSchedulerSuspended is zero then this function does not match a
40254027
* previous call to vTaskSuspendAll(). */
@@ -4047,6 +4049,8 @@ BaseType_t xTaskResumeAll( void )
40474049

40484050
#if ( configNUMBER_OF_CORES == 1 )
40494051
{
4052+
TCB_t * const pxConstCurrentTCB = prvGetCurrentTaskTCBUnsafe();
4053+
40504054
/* If the moved task has a priority higher than the current
40514055
* task then a yield must be performed. */
40524056
if( pxTCB->uxPriority > pxConstCurrentTCB->uxPriority )
@@ -4721,7 +4725,10 @@ BaseType_t xTaskIncrementTick( void )
47214725
TCB_t * pxTCB;
47224726
TickType_t xItemValue;
47234727
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 ) */
47254732

47264733
#if ( configUSE_PREEMPTION == 1 ) && ( configNUMBER_OF_CORES > 1 )
47274734
BaseType_t xYieldRequiredForCore[ configNUMBER_OF_CORES ] = { pdFALSE };

0 commit comments

Comments
 (0)