diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h index 4d3158e535..7f436bcb0d 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h @@ -3306,23 +3306,6 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC */ void vTaskYieldWithinAPI( void ); -/* ------------------------------------------------ IDF Compatibility -------------------------------------------------- - * - * ------------------------------------------------------------------------------------------------------------------ */ - -#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 - -#endif //ESP_PLATFORM - /* *INDENT-OFF* */ #ifdef __cplusplus } diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c index ad5fa3dbd9..cb84e80931 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/port.c @@ -18,6 +18,7 @@ #include "xtensa/config/core.h" #include "xtensa/config/core-isa.h" #include "xtensa/xtruntime.h" +#include "esp_private/freertos_idf_additions_priv.h" #include "esp_private/esp_int_wdt.h" #include "esp_private/systimer.h" #include "esp_private/periph_ctrl.h" @@ -328,7 +329,7 @@ BaseType_t xPortStartScheduler( void ) #if configNUM_CORES > 1 // Workaround for non-thread safe multi-core OS startup (see IDF-4524) if (xPortGetCoreID() != 0) { - vTaskStartSchedulerOtherCores(); + prvStartSchedulerOtherCores(); } #endif // configNUM_CORES > 1 diff --git a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c index b7a8f03253..254fc0a830 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c @@ -6506,14 +6506,3 @@ 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 diff --git a/components/freertos/esp_additions/freertos_tasks_c_additions.h b/components/freertos/esp_additions/freertos_tasks_c_additions.h index 560c57898a..9a3beeb6b7 100644 --- a/components/freertos/esp_additions/freertos_tasks_c_additions.h +++ b/components/freertos/esp_additions/freertos_tasks_c_additions.h @@ -31,6 +31,22 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt _Static_assert( tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "CONFIG_FREERTOS_NO_AFFINITY must be the same as tskNO_AFFINITY" ); #endif /* CONFIG_FREERTOS_SMP */ +/* ------------------------------------------------- Kernel Control ------------------------------------------------- */ + +#if ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) + +/* + * Workaround for non-thread safe multi-core OS startup (see IDF-4524) + */ + void prvStartSchedulerOtherCores( void ) + { + /* This function is always called with interrupts disabled*/ + xSchedulerRunning = pdTRUE; + } + +#endif /* ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) */ +/*----------------------------------------------------------*/ + /* -------------------------------------------------- Task Creation ------------------------------------------------- */ #if CONFIG_FREERTOS_SMP diff --git a/components/freertos/esp_additions/include/esp_private/freertos_idf_additions_priv.h b/components/freertos/esp_additions/include/esp_private/freertos_idf_additions_priv.h index 2670a46ad2..0318f166d1 100644 --- a/components/freertos/esp_additions/include/esp_private/freertos_idf_additions_priv.h +++ b/components/freertos/esp_additions/include/esp_private/freertos_idf_additions_priv.h @@ -20,6 +20,22 @@ #endif /* *INDENT-ON* */ +/*------------------------------------------------------------------------------ + * KERNEL CONTROL (PRIVATE) + *----------------------------------------------------------------------------*/ + +#if ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) + +/** + * @brief 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 prvStartSchedulerOtherCores( void ); + +#endif /* ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) */ + /*------------------------------------------------------------------------------ * TASK UTILITIES (PRIVATE) *----------------------------------------------------------------------------*/