From 6c6a6ad44a52cd0b706cb23aee4c1c31fb76bf1f Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Thu, 19 Oct 2023 19:48:08 +0800 Subject: [PATCH] fix(freertos/idf): Add workaround for same priority preemption in xTaskIncrementTick() This commit temporarily disables a bugfixed introduced by FreeRTOS v10.5.1 that ensures timed out tasks will only preempt if their priority is higher than the currently running task. This bugfix has been temporarily reversed due to some compatibility issues with some IDF tests. --- components/freertos/FreeRTOS-Kernel/tasks.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/freertos/FreeRTOS-Kernel/tasks.c b/components/freertos/FreeRTOS-Kernel/tasks.c index 84861496a9..3570fef796 100644 --- a/components/freertos/FreeRTOS-Kernel/tasks.c +++ b/components/freertos/FreeRTOS-Kernel/tasks.c @@ -3267,7 +3267,9 @@ BaseType_t xTaskIncrementTick( void ) * 0, we only need to context switch if the unblocked * task can run on core 0 and has a higher priority * than the current task. */ - if( ( taskIS_AFFINITY_COMPATIBLE( 0, pxTCB->xCoreID ) == pdTRUE ) && ( pxTCB->uxPriority > pxCurrentTCBs[ 0 ]->uxPriority ) ) + + /* ">" changed to ">="" due to IDF incompatibility (IDF-8428) */ + if( ( taskIS_AFFINITY_COMPATIBLE( 0, pxTCB->xCoreID ) == pdTRUE ) && ( pxTCB->uxPriority >= pxCurrentTCBs[ 0 ]->uxPriority ) ) { xSwitchRequired = pdTRUE; }