forked from espressif/esp-idf
Merge branch 'bugfix/freertos_smp_startup_race_cond' into 'master'
freertos: Add SMP FreeRTOS startup race condition workaround Closes IDF-5284 and IDF-5288 See merge request espressif/esp-idf!18683
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
|
||||
|
@@ -448,6 +448,13 @@ BaseType_t xPortStartScheduler( void )
|
||||
|
||||
port_xSchedulerRunning[xPortGetCoreID()] = 1;
|
||||
|
||||
#if configNUM_CORES > 1
|
||||
// Workaround for non-thread safe multi-core OS startup (see IDF-4524)
|
||||
if (xPortGetCoreID() != 0) {
|
||||
vTaskStartSchedulerOtherCores();
|
||||
}
|
||||
#endif // configNUM_CORES > 1
|
||||
|
||||
// Cannot be directly called from C; never returns
|
||||
__asm__ volatile ("call0 _frxt_dispatch\n");
|
||||
|
||||
|
@@ -369,7 +369,15 @@ PRIVILEGED_DATA static List_t xPendingReadyList; /*< Tas
|
||||
PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U;
|
||||
PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT;
|
||||
PRIVILEGED_DATA static volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY;
|
||||
#if ( ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1 ) )
|
||||
/*
|
||||
Workaround for non-thread safe multi-core OS startup (see IDF-4524)
|
||||
*/
|
||||
PRIVILEGED_DATA static volatile BaseType_t xSchedulerRunningPerCore[ configNUM_CORES ] = { pdFALSE };
|
||||
#define xSchedulerRunning xSchedulerRunningPerCore[ portGET_CORE_ID() ]
|
||||
#else // ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1 )
|
||||
PRIVILEGED_DATA static volatile BaseType_t xSchedulerRunning = pdFALSE;
|
||||
#endif // ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1 )
|
||||
PRIVILEGED_DATA static volatile TickType_t xPendedTicks = ( TickType_t ) 0U;
|
||||
PRIVILEGED_DATA static volatile BaseType_t xYieldPendings[ configNUM_CORES ] = { pdFALSE };
|
||||
PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0;
|
||||
@@ -6443,3 +6451,14 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
|
||||
#endif
|
||||
|
||||
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
|
||||
|
||||
#if ( ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1 ) )
|
||||
/*
|
||||
Workaround for non-thread safe multi-core OS startup (see IDF-4524)
|
||||
*/
|
||||
void vTaskStartSchedulerOtherCores( void )
|
||||
{
|
||||
/* This function is always called with interrupts disabled*/
|
||||
xSchedulerRunning = pdTRUE;
|
||||
}
|
||||
#endif // ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1
|
||||
|
Reference in New Issue
Block a user