mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-25 17:58:46 +00:00
freertos: Add multi-core OS startup race condition workaround
FreeRTOS uses a single "xSchedulerRunning" variable to tack whether the scheduler has started, and this variable is set to "pdTRUE" by core 0 via calling vTaskStartScheduler(). However, with SMP FreeRTOS, there is a race condition where core 0 has already started the scheduler and another core has not called xPortStartScheduler() yet and calls some FreeRTOS API. Thus the resultant FreeRTOS API can cause errors as it thinks the scheduler has started. This commit adds a temporary workaround (by having each core maintain their own "xSchedulerRunning" variable.
This commit is contained in:
@@ -3279,6 +3279,15 @@ void vTaskYieldWithinAPI( void );
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
/*
|
||||
Workaround for non-thread safe multi-core OS startup (see IDF-4524)
|
||||
This function must be called with interrupts disabled on all cores other than
|
||||
core 0 during startup.
|
||||
*/
|
||||
void vTaskStartSchedulerOtherCores( void );
|
||||
#endif // configNUM_CORES > 1
|
||||
|
||||
#include "idf_additions.h"
|
||||
|
||||
#endif //ESP_PLATFORM
|
||||
|
Reference in New Issue
Block a user