@@ -474,6 +474,11 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
474
474
475
475
#endif
476
476
477
+ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configNUMBER_OF_CORES > 1 )
478
+ static StaticTask_t xIdleTCBBuffers [ configNUMBER_OF_CORES - 1 ];
479
+ static StackType_t xIdleTaskStackBuffers [ configNUMBER_OF_CORES - 1 ][ configMINIMAL_STACK_SIZE ];
480
+ #endif /* #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configNUMBER_OF_CORES > 1 ) */
481
+
477
482
/*lint -restore */
478
483
479
484
/*-----------------------------------------------------------*/
@@ -1049,106 +1054,101 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
1049
1054
1050
1055
/* There are configNUMBER_OF_CORES Idle tasks created when scheduler started.
1051
1056
* The scheduler should be able to select a task to run when uxCurrentPriority
1052
- * is tskIDLE_PRIORITY. */
1053
- configASSERT ( ( uxCurrentPriority > tskIDLE_PRIORITY ) || ( xTaskScheduled == pdTRUE ) );
1057
+ * is tskIDLE_PRIORITY. uxCurrentPriority is never decreased to value blow
1058
+ * tskIDLE_PRIORITY. */
1054
1059
uxCurrentPriority -- ;
1055
1060
}
1056
1061
1057
- if ( xTaskScheduled == pdTRUE )
1062
+ #if ( configRUN_MULTIPLE_PRIORITIES == 0 )
1058
1063
{
1059
- configASSERT ( taskTASK_IS_RUNNING ( pxCurrentTCBs [ xCoreID ] ) == pdTRUE );
1060
-
1061
- #if ( configRUN_MULTIPLE_PRIORITIES == 0 )
1064
+ if ( xPriorityDropped != pdFALSE )
1062
1065
{
1063
- if ( xPriorityDropped != pdFALSE )
1064
- {
1065
- /* There may be several ready tasks that were being prevented from running because there was
1066
- * a higher priority task running. Now that the last of the higher priority tasks is no longer
1067
- * running, make sure all the other idle tasks yield. */
1068
- BaseType_t x ;
1066
+ /* There may be several ready tasks that were being prevented from running because there was
1067
+ * a higher priority task running. Now that the last of the higher priority tasks is no longer
1068
+ * running, make sure all the other idle tasks yield. */
1069
+ BaseType_t x ;
1069
1070
1070
- for ( x = ( BaseType_t ) 0 ; x < ( BaseType_t ) configNUMBER_OF_CORES ; x ++ )
1071
+ for ( x = ( BaseType_t ) 0 ; x < ( BaseType_t ) configNUMBER_OF_CORES ; x ++ )
1072
+ {
1073
+ if ( ( pxCurrentTCBs [ x ]-> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0 )
1071
1074
{
1072
- if ( ( pxCurrentTCBs [ x ]-> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0 )
1073
- {
1074
- prvYieldCore ( x );
1075
- }
1075
+ prvYieldCore ( x );
1076
1076
}
1077
1077
}
1078
1078
}
1079
- #endif /* #if ( configRUN_MULTIPLE_PRIORITIES == 0 ) */
1079
+ }
1080
+ #endif /* #if ( configRUN_MULTIPLE_PRIORITIES == 0 ) */
1080
1081
1081
- #if ( configUSE_CORE_AFFINITY == 1 )
1082
+ #if ( configUSE_CORE_AFFINITY == 1 )
1083
+ {
1084
+ if ( ( pxPreviousTCB != NULL ) && ( listIS_CONTAINED_WITHIN ( & ( pxReadyTasksLists [ pxPreviousTCB -> uxPriority ] ), & ( pxPreviousTCB -> xStateListItem ) ) != pdFALSE ) )
1082
1085
{
1083
- if ( ( pxPreviousTCB != NULL ) && ( listIS_CONTAINED_WITHIN ( & ( pxReadyTasksLists [ pxPreviousTCB -> uxPriority ] ), & ( pxPreviousTCB -> xStateListItem ) ) != pdFALSE ) )
1086
+ /* A ready task was just evicted from this core. See if it can be
1087
+ * scheduled on any other core. */
1088
+ UBaseType_t uxCoreMap = pxPreviousTCB -> uxCoreAffinityMask ;
1089
+ BaseType_t xLowestPriority = ( BaseType_t ) pxPreviousTCB -> uxPriority ;
1090
+ BaseType_t xLowestPriorityCore = -1 ;
1091
+ BaseType_t x ;
1092
+
1093
+ if ( ( pxPreviousTCB -> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
1084
1094
{
1085
- /* A ready task was just evicted from this core. See if it can be
1086
- * scheduled on any other core. */
1087
- UBaseType_t uxCoreMap = pxPreviousTCB -> uxCoreAffinityMask ;
1088
- BaseType_t xLowestPriority = ( BaseType_t ) pxPreviousTCB -> uxPriority ;
1089
- BaseType_t xLowestPriorityCore = -1 ;
1090
- BaseType_t x ;
1095
+ xLowestPriority = xLowestPriority - 1 ;
1096
+ }
1091
1097
1092
- if ( ( pxPreviousTCB -> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
1093
- {
1094
- xLowestPriority = xLowestPriority - 1 ;
1095
- }
1098
+ if ( ( uxCoreMap & ( ( UBaseType_t ) 1U << ( UBaseType_t ) xCoreID ) ) != 0U )
1099
+ {
1100
+ /* The ready task that was removed from this core is not excluded from it.
1101
+ * Only look at the intersection of the cores the removed task is allowed to run
1102
+ * on with the cores that the new task is excluded from. It is possible that the
1103
+ * new task was only placed onto this core because it is excluded from another.
1104
+ * Check to see if the previous task could run on one of those cores. */
1105
+ uxCoreMap &= ~( pxCurrentTCBs [ xCoreID ]-> uxCoreAffinityMask );
1106
+ }
1107
+ else
1108
+ {
1109
+ /* The ready task that was removed from this core is excluded from it. */
1110
+ }
1096
1111
1097
- if ( ( uxCoreMap & ( ( UBaseType_t ) 1U << ( UBaseType_t ) xCoreID ) ) != 0U )
1098
- {
1099
- /* The ready task that was removed from this core is not excluded from it.
1100
- * Only look at the intersection of the cores the removed task is allowed to run
1101
- * on with the cores that the new task is excluded from. It is possible that the
1102
- * new task was only placed onto this core because it is excluded from another.
1103
- * Check to see if the previous task could run on one of those cores. */
1104
- uxCoreMap &= ~( pxCurrentTCBs [ xCoreID ]-> uxCoreAffinityMask );
1105
- }
1106
- else
1107
- {
1108
- /* The ready task that was removed from this core is excluded from it. */
1109
- }
1112
+ uxCoreMap &= ( ( 1U << configNUMBER_OF_CORES ) - 1U );
1110
1113
1111
- uxCoreMap &= ( ( 1U << configNUMBER_OF_CORES ) - 1U );
1114
+ for ( x = ( ( BaseType_t ) configNUMBER_OF_CORES - 1 ); x >= ( BaseType_t ) 0 ; x -- )
1115
+ {
1116
+ UBaseType_t uxCore = ( UBaseType_t ) x ;
1117
+ BaseType_t xTaskPriority ;
1112
1118
1113
- for ( x = ( ( BaseType_t ) configNUMBER_OF_CORES - 1 ); x >= ( BaseType_t ) 0 ; x -- )
1119
+ if ( ( uxCoreMap & ( 1 << uxCore ) ) != 0 )
1114
1120
{
1115
- UBaseType_t uxCore = ( UBaseType_t ) x ;
1116
- BaseType_t xTaskPriority ;
1121
+ xTaskPriority = ( BaseType_t ) pxCurrentTCBs [ uxCore ]-> uxPriority ;
1117
1122
1118
- if ( ( uxCoreMap & ( 1 << uxCore ) ) != 0 )
1123
+ if ( ( pxCurrentTCBs [ uxCore ] -> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
1119
1124
{
1120
- xTaskPriority = ( BaseType_t ) pxCurrentTCBs [ uxCore ]-> uxPriority ;
1121
-
1122
- if ( ( pxCurrentTCBs [ uxCore ]-> uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
1123
- {
1124
- xTaskPriority = xTaskPriority - ( BaseType_t ) 1 ;
1125
- }
1125
+ xTaskPriority = xTaskPriority - ( BaseType_t ) 1 ;
1126
+ }
1126
1127
1127
- uxCoreMap &= ~( ( UBaseType_t ) 1U << uxCore );
1128
+ uxCoreMap &= ~( ( UBaseType_t ) 1U << uxCore );
1128
1129
1129
- if ( ( xTaskPriority < xLowestPriority ) &&
1130
- ( taskTASK_IS_RUNNING ( pxCurrentTCBs [ uxCore ] ) != pdFALSE ) &&
1131
- ( xYieldPendings [ uxCore ] == pdFALSE ) )
1130
+ if ( ( xTaskPriority < xLowestPriority ) &&
1131
+ ( taskTASK_IS_RUNNING ( pxCurrentTCBs [ uxCore ] ) != pdFALSE ) &&
1132
+ ( xYieldPendings [ uxCore ] == pdFALSE ) )
1133
+ {
1134
+ #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1135
+ if ( pxCurrentTCBs [ uxCore ]-> xPreemptionDisable == pdFALSE )
1136
+ #endif
1132
1137
{
1133
- #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1134
- if ( pxCurrentTCBs [ uxCore ]-> xPreemptionDisable == pdFALSE )
1135
- #endif
1136
- {
1137
- xLowestPriority = xTaskPriority ;
1138
- xLowestPriorityCore = ( BaseType_t ) uxCore ;
1139
- }
1138
+ xLowestPriority = xTaskPriority ;
1139
+ xLowestPriorityCore = ( BaseType_t ) uxCore ;
1140
1140
}
1141
1141
}
1142
1142
}
1143
+ }
1143
1144
1144
- if ( taskVALID_CORE_ID ( xLowestPriorityCore ) == pdTRUE )
1145
- {
1146
- prvYieldCore ( xLowestPriorityCore );
1147
- }
1145
+ if ( xLowestPriorityCore >= 0 )
1146
+ {
1147
+ prvYieldCore ( xLowestPriorityCore );
1148
1148
}
1149
1149
}
1150
- #endif /* #if ( configUSE_CORE_AFFINITY == 1 ) */
1151
1150
}
1151
+ #endif /* #if ( configUSE_CORE_AFFINITY == 1 ) */
1152
1152
}
1153
1153
1154
1154
#endif /* ( configNUMBER_OF_CORES > 1 ) */
@@ -3214,9 +3214,6 @@ static BaseType_t prvCreateIdleTasks( void )
3214
3214
}
3215
3215
else
3216
3216
{
3217
- static StaticTask_t xIdleTCBBuffers [ configNUMBER_OF_CORES - 1 ];
3218
- static StackType_t xIdleTaskStackBuffers [ configNUMBER_OF_CORES - 1 ][ configMINIMAL_STACK_SIZE ];
3219
-
3220
3217
xIdleTaskHandles [ xCoreID ] = xTaskCreateStatic ( prvMinimalIdleTask ,
3221
3218
cIdleName ,
3222
3219
configMINIMAL_STACK_SIZE ,
0 commit comments