Merge branch 'feature/freertos_smp_port_idle_hooks' into 'master'

freertos: Update idle hooks for SMP

Closes IDF-3337

See merge request espressif/esp-idf!17407
This commit is contained in:
Darian 2022-04-06 08:24:04 +08:00
commit 7554194bf1
4 changed files with 32 additions and 9 deletions

View File

@ -206,6 +206,12 @@ else()
list(APPEND link_options "-Wl,--gc-sections")
endif()
# SMP FreeRTOS user provided minimal idle hook. This allows the user to provide
# their own copy of vApplicationMinimalIdleHook()
if(CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK)
list(APPEND link_options "-Wl,--wrap=vApplicationMinimalIdleHook")
endif()
# Placing jump tables in flash would cause issues with code that required
# to be placed in IRAM
list(APPEND compile_options "-fno-jump-tables")

View File

@ -148,7 +148,7 @@ This file get's pulled into assembly sources. Therefore, some includes need to b
#endif
#define configUSE_CORE_AFFINITY 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_MINIMAL_IDLE_HOOK 1
#define configUSE_MINIMAL_IDLE_HOOK 1 // This is always enabled to call IDF style idle hooks, by can be "--Wl,--wrap" if users enable CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
// ------------- Synchronization Primitives ----------------
@ -183,7 +183,11 @@ This file get's pulled into assembly sources. Therefore, some includes need to b
// ------------------------ Hooks --------------------------
#if CONFIG_FREERTOS_USE_IDLE_HOOK
#define configUSE_IDLE_HOOK 1
#else
#define configUSE_IDLE_HOOK 0
#endif
#define configUSE_TICK_HOOK 1
#if CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE
#define configCHECK_FOR_STACK_OVERFLOW 0

View File

@ -613,19 +613,24 @@ void vApplicationTickHook( void )
}
#endif
#if ( configUSE_IDLE_HOOK == 1 )
void vApplicationIdleHook( void )
#if CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
/*
By default, the port uses vApplicationMinimalIdleHook() to run IDF style idle
hooks. However, users may also want to provide their own vApplicationMinimalIdleHook().
In this case, we use to -Wl,--wrap option to wrap the user provided vApplicationMinimalIdleHook()
*/
extern void __real_vApplicationMinimalIdleHook( void );
void __wrap_vApplicationMinimalIdleHook( void )
{
esp_vApplicationIdleHook();
esp_vApplicationIdleHook(); //Run IDF style hooks
__real_vApplicationMinimalIdleHook(); //Call the user provided vApplicationMinimalIdleHook()
}
#endif
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
#else // CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
void vApplicationMinimalIdleHook( void )
{
esp_vApplicationIdleHook();
esp_vApplicationIdleHook(); //Run IDF style hooks
}
#endif
#endif // CONFIG_FREERTOS_USE_MINIMAL_IDLE_HOOK
/* ---------------------------------------------- Misc Implementations -------------------------------------------------
*

View File

@ -215,6 +215,14 @@ menu "FreeRTOS"
- The FreeRTOS idle hook is NOT the same as the ESP-IDF Idle Hook, but both can be enabled
simultaneously.
config FREERTOS_USE_MINIMAL_IDLE_HOOK
bool "Use FreeRTOS minimal idle hook"
depends on FREERTOS_SMP
default n
help
- The application must provide the hook function ``void vApplicationMinimalIdleHook( void );``
- ``vApplicationMinimalIdleHook()`` is called from FreeRTOS idle task(s)
config FREERTOS_USE_TICK_HOOK
bool "Use FreeRTOS tick hook"
default n