feat(freertos/smp): Update other IDF components to be compatible with FreeRTOS v11.0.1

This commit is contained in:
Darian Leung 2024-02-02 23:38:00 +08:00
parent 83c686c744
commit 48a7f053d5
No known key found for this signature in database
GPG Key ID: 8AC9127B487AA4EF
4 changed files with 19 additions and 19 deletions

View File

@ -223,9 +223,9 @@ else()
endif() endif()
# SMP FreeRTOS user provided minimal idle hook. This allows the user to provide # SMP FreeRTOS user provided minimal idle hook. This allows the user to provide
# their own copy of vApplicationMinimalIdleHook() # their own copy of vApplicationPassiveIdleHook()
if(CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK) if(CONFIG_FREERTOS_USE_PASSIVE_IDLE_HOOK)
list(APPEND link_options "-Wl,--wrap=vApplicationMinimalIdleHook") list(APPEND link_options "-Wl,--wrap=vApplicationPassiveIdleHook")
endif() endif()
# Placing jump tables in flash would cause issues with code that required # Placing jump tables in flash would cause issues with code that required

View File

@ -52,13 +52,13 @@ void esp_restart(void)
} }
} }
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL); vTaskPreemptionDisable(NULL);
#else #else
// Disable scheduler on this core. // Disable scheduler on this core.
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
esp_restart_noos(); esp_restart_noos();
} }

View File

@ -60,13 +60,13 @@ static void do_deep_sleep_from_app_cpu(void)
xTaskCreatePinnedToCore(&deep_sleep_task, "ds", 2048, NULL, 5, NULL, 1); xTaskCreatePinnedToCore(&deep_sleep_task, "ds", 2048, NULL, 5, NULL, 1);
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL); vTaskPreemptionDisable(NULL);
#else #else
// keep running some non-IRAM code // keep running some non-IRAM code
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
while (true) { while (true) {
; ;

View File

@ -118,7 +118,7 @@ void spi_flash_op_unlock(void)
void IRAM_ATTR spi_flash_op_block_func(void *arg) void IRAM_ATTR spi_flash_op_block_func(void *arg)
{ {
// Disable scheduler on this CPU // Disable scheduler on this CPU
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
/* /*
Note: FreeRTOS SMP has changed the behavior of scheduler suspension. But the vTaskPreemptionDisable() function should Note: FreeRTOS SMP has changed the behavior of scheduler suspension. But the vTaskPreemptionDisable() function should
achieve the same affect as before (i.e., prevent the current task from being preempted). achieve the same affect as before (i.e., prevent the current task from being preempted).
@ -126,7 +126,7 @@ void IRAM_ATTR spi_flash_op_block_func(void *arg)
vTaskPreemptionDisable(NULL); vTaskPreemptionDisable(NULL);
#else #else
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
// Restore interrupts that aren't located in IRAM // Restore interrupts that aren't located in IRAM
esp_intr_noniram_disable(); esp_intr_noniram_disable();
uint32_t cpuid = (uint32_t) arg; uint32_t cpuid = (uint32_t) arg;
@ -142,13 +142,13 @@ void IRAM_ATTR spi_flash_op_block_func(void *arg)
spi_flash_restore_cache(cpuid, s_flash_op_cache_state[cpuid]); spi_flash_restore_cache(cpuid, s_flash_op_cache_state[cpuid]);
// Restore interrupts that aren't located in IRAM // Restore interrupts that aren't located in IRAM
esp_intr_noniram_enable(); esp_intr_noniram_enable();
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionEnable(NULL); vTaskPreemptionEnable(NULL);
#else #else
// Re-enable scheduler // Re-enable scheduler
xTaskResumeAll(); xTaskResumeAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
} }
void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void) void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void)
@ -187,13 +187,13 @@ void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void)
// Busy loop and wait for spi_flash_op_block_func to disable cache // Busy loop and wait for spi_flash_op_block_func to disable cache
// on the other CPU // on the other CPU
} }
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL); vTaskPreemptionDisable(NULL);
#else #else
// Disable scheduler on the current CPU // Disable scheduler on the current CPU
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
// Can now set the priority back to the normal one // Can now set the priority back to the normal one
prvTaskPriorityRestore(&SavedPriority); prvTaskPriorityRestore(&SavedPriority);
// This is guaranteed to run on CPU <cpuid> because the other CPU is now // This is guaranteed to run on CPU <cpuid> because the other CPU is now
@ -248,12 +248,12 @@ void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu(void)
// But esp_intr_noniram_enable has to be called on the same CPU which // But esp_intr_noniram_enable has to be called on the same CPU which
// called esp_intr_noniram_disable // called esp_intr_noniram_disable
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) { if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionEnable(NULL); vTaskPreemptionEnable(NULL);
#else #else
xTaskResumeAll(); xTaskResumeAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
} }
// Release API lock // Release API lock
spi_flash_op_unlock(); spi_flash_op_unlock();
@ -290,26 +290,26 @@ void spi_flash_init_lock(void)
void spi_flash_op_lock(void) void spi_flash_op_lock(void)
{ {
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionDisable(NULL); vTaskPreemptionDisable(NULL);
} }
#else #else
vTaskSuspendAll(); vTaskSuspendAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
} }
void spi_flash_op_unlock(void) void spi_flash_op_unlock(void)
{ {
#ifdef CONFIG_FREERTOS_SMP #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {
//Note: Scheduler suspension behavior changed in FreeRTOS SMP //Note: Scheduler suspension behavior changed in FreeRTOS SMP
vTaskPreemptionEnable(NULL); vTaskPreemptionEnable(NULL);
} }
#else #else
xTaskResumeAll(); xTaskResumeAll();
#endif // CONFIG_FREERTOS_SMP #endif // #if ( ( CONFIG_FREERTOS_SMP ) && ( !CONFIG_FREERTOS_UNICORE ) )
} }