From 191d7f8f7c6cf3c216a79e4a926768dc464021c6 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Mon, 4 Sep 2023 18:22:03 +0800 Subject: [PATCH 1/3] Update taskSELECT_HIGHEST_PRIORITY_TASK macro for SMP * Move the configUSE_PORT_OPTIMISED_TASK_SELECTION check to FreeRTOS.h * SMP also use taskSELECT_HIGHEST_PRIORITY_TASK macro --- include/FreeRTOS.h | 4 ++++ tasks.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index ca5818eae49..1a6468b186a 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -1165,6 +1165,10 @@ #error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS #endif +#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PORT_OPTIMISED_TASK_SELECTION != 0 ) ) + #error configUSE_PORT_OPTIMISED_TASK_SELECTION is not supported in SMP FreeRTOS +#endif + #ifndef configINITIAL_TICK_COUNT #define configINITIAL_TICK_COUNT 0 #endif diff --git a/tasks.c b/tasks.c index 2786c5ab0e1..744d1f14fa7 100644 --- a/tasks.c +++ b/tasks.c @@ -152,6 +152,10 @@ listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ uxTopReadyPriority = uxTopPriority; \ } while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */ + #else + + #define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID ) + #endif /* if ( configNUMBER_OF_CORES == 1 ) */ /*-----------------------------------------------------------*/ @@ -164,10 +168,6 @@ #else /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ - #if ( configNUMBER_OF_CORES > 1 ) - #error configUSE_PORT_OPTIMISED_TASK_SELECTION not supported in FreeRTOS SMP. - #endif - /* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is * performed in a way that is tailored to the particular microcontroller * architecture being used. */ @@ -4701,7 +4701,7 @@ BaseType_t xTaskIncrementTick( void ) #endif /* Select a new task to run. */ - prvSelectHighestPriorityTask( xCoreID ); + taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ); traceTASK_SWITCHED_IN(); /* After the new task is switched in, update the global errno. */ From 73b13546ddab07017282f8713af82ac4d90993d7 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Tue, 5 Sep 2023 11:21:03 +0800 Subject: [PATCH 2/3] Fix uncrustify --- tasks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks.c b/tasks.c index 744d1f14fa7..da2cb17fc40 100644 --- a/tasks.c +++ b/tasks.c @@ -152,9 +152,9 @@ listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ uxTopReadyPriority = uxTopPriority; \ } while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */ - #else + #else /* if ( configNUMBER_OF_CORES == 1 ) */ - #define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID ) + #define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID ) #endif /* if ( configNUMBER_OF_CORES == 1 ) */ From e1a2eef12ae068f54834f9672b80648081834293 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Wed, 6 Sep 2023 14:53:42 +0800 Subject: [PATCH 3/3] Update for uncrustify --- tasks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.c b/tasks.c index da2cb17fc40..73f26e99b29 100644 --- a/tasks.c +++ b/tasks.c @@ -152,7 +152,7 @@ listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \ uxTopReadyPriority = uxTopPriority; \ } while( 0 ) /* taskSELECT_HIGHEST_PRIORITY_TASK */ - #else /* if ( configNUMBER_OF_CORES == 1 ) */ + #else /* if ( configNUMBER_OF_CORES == 1 ) */ #define taskSELECT_HIGHEST_PRIORITY_TASK( xCoreID ) prvSelectHighestPriorityTask( xCoreID )