From 5d7564a03953ae8ed28239a172fc2a29225f91b9 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Mon, 11 Nov 2019 09:54:15 +0800 Subject: [PATCH] freertos/Kconfig: make optimized task selection dependent on FREERTOS_UNICORE option freertos: fix decrement loop of high priority task selection --- components/freertos/Kconfig | 1 + components/freertos/include/freertos/portmacro.h | 2 +- components/freertos/tasks.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 102ed95df9..86544ab915 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -41,6 +41,7 @@ menu "FreeRTOS" config FREERTOS_OPTIMIZED_SCHEDULER bool "Enable FreeRTOS pĺatform optimized scheduler" + depends on FREERTOS_UNICORE default y help On most platforms there are instructions can speedup the ready task diff --git a/components/freertos/include/freertos/portmacro.h b/components/freertos/include/freertos/portmacro.h index b96bd8ff23..f544c2d768 100644 --- a/components/freertos/include/freertos/portmacro.h +++ b/components/freertos/include/freertos/portmacro.h @@ -476,7 +476,7 @@ void vApplicationSleep( TickType_t xExpectedIdleTime ); /* Check the configuration. */ #if( configMAX_PRIORITIES > 32 ) - #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. + #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice. #endif /* Store/clear the ready priorities in a bit map. */ diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 1f89457ef5..f34227d3ba 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -2782,7 +2782,7 @@ void vTaskSwitchContext( void ) vPortCPUAcquireMutex( &xTaskQueueMutex ); #endif -#if !CONFIG_FREERTOS_UNICORE +#if !configUSE_PORT_OPTIMISED_TASK_SELECTION unsigned portBASE_TYPE foundNonExecutingWaiter = pdFALSE, ableToSchedule = pdFALSE, resetListHead; unsigned portBASE_TYPE holdTop=pdFALSE; tskTCB * pxTCB; @@ -2863,7 +2863,7 @@ void vTaskSwitchContext( void ) } } while ((ableToSchedule == pdFALSE) && (pxTCB != pxRefTCB)); } else { - if (!holdTop) uxTopReadyPriority--; + if (!holdTop) --uxTopReadyPriority; } --uxDynamicTopReady; }