File tree Expand file tree Collapse file tree
examples/template_configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 566566 * tskNO_AFFINITY if left undefined. */
567567#define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY
568568
569+ /* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set
570+ * configIDLE_AFFINITY to 1 to pin each Idle task to its corresponding
571+ * core. When set to 1, Idle task N will only run on core N, using an affinity
572+ * mask of (1 << N). Set to 0 to allow the scheduler to run Idle tasks on any
573+ * available core. Defaults to 0 if left undefined. */
574+ #define configIDLE_AFFINITY 0
575+
569576/******************************************************************************/
570577/* ARMv8-M secure side port related definitions. ******************************/
571578/******************************************************************************/
Original file line number Diff line number Diff line change 377377 #define configIDLE_SHOULD_YIELD 1
378378#endif
379379
380+ #ifndef configIDLE_AFFINITY
381+ #define configIDLE_AFFINITY 0
382+ #endif
383+
380384#if configMAX_TASK_NAME_LEN < 1
381385 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
382386#endif
Original file line number Diff line number Diff line change @@ -3790,8 +3790,13 @@ static BaseType_t prvCreateIdleTasks( void )
37903790 /* Assign idle task to each core before SMP scheduler is running. */
37913791 xIdleTaskHandles [ xCoreID ]-> xTaskRunState = xCoreID ;
37923792 pxCurrentTCBs [ xCoreID ] = xIdleTaskHandles [ xCoreID ];
3793+ #if ( ( configIDLE_AFFINITY == 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
3794+ {
3795+ xIdleTaskHandles [ xCoreID ]-> uxCoreAffinityMask = ( ( UBaseType_t ) 1U << ( UBaseType_t ) xCoreID );
3796+ }
3797+ #endif
37933798 }
3794- #endif
3799+ #endif /* if ( configNUMBER_OF_CORES == 1 ) */
37953800 }
37963801 }
37973802
You can’t perform that action at this time.
0 commit comments