From 7726f343e8e124e0ad5cf320f1a8885c93348e0a Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Fri, 17 Jun 2022 09:11:02 +0200 Subject: [PATCH] freertos-smp: Update prvYieldCore() to fix compile warning prvYieldCore() leads to an array-out-of-bounds error when compiled with -Os optimization and configNUM_CORES = 1. This commit avoids this compile warning by compiling out the part of code which is unnecessary when configNUM_CORES is 1. --- components/freertos/FreeRTOS-Kernel-SMP/tasks.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c index 04984ece01..b76a6e1678 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c @@ -709,11 +709,17 @@ static void prvYieldCore( BaseType_t xCoreID ) { xYieldPendings[ xCoreID ] = pdTRUE; } - else - { - portYIELD_CORE( xCoreID ); - pxCurrentTCBs[ xCoreID ]->xTaskRunState = taskTASK_YIELDING; - } + +#ifdef ESP_PLATFORM +// TODO: IDF-5256 + #if ( configNUM_CORES > 1 ) + else + { + portYIELD_CORE( xCoreID ); + pxCurrentTCBs[ xCoreID ]->xTaskRunState = taskTASK_YIELDING; + } + #endif /* ( configNUM_CORES > 1 ) */ +#endif /* ESP_PLATFORM */ } }