mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
freertos: Fix issue with bootup failure in ESP_MAIN_TASK_AFFINITY_CPU1 config
Idle tick hook that indicates completion of scheduler init must be launched on other core than the one where main task runs. Earlier it was assumed that main task shall always run on PRO cpu but that behavior can be changed with ESP_MAIN_TASK_AFFINITY_CPU1 and hence this fix. Closes https://github.com/espressif/esp-idf/issues/9247 Closes IDFGH-7705
This commit is contained in:
parent
6c5fb29c2c
commit
5ebc86354a
@ -83,10 +83,10 @@ void esp_startup_start_app_common(void)
|
||||
}
|
||||
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
static volatile bool s_app_cpu_startup_done = false;
|
||||
static bool s_app_cpu_startup_idle_hook_cb(void)
|
||||
static volatile bool s_other_cpu_startup_done = false;
|
||||
static bool other_cpu_startup_idle_hook_cb(void)
|
||||
{
|
||||
s_app_cpu_startup_done = true;
|
||||
s_other_cpu_startup_done = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -94,12 +94,12 @@ static bool s_app_cpu_startup_idle_hook_cb(void)
|
||||
static void main_task(void* args)
|
||||
{
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
// Wait for FreeRTOS initialization to finish on APP CPU, before replacing its startup stack
|
||||
esp_register_freertos_idle_hook_for_cpu(s_app_cpu_startup_idle_hook_cb, 1);
|
||||
while (!s_app_cpu_startup_done) {
|
||||
// Wait for FreeRTOS initialization to finish on other core, before replacing its startup stack
|
||||
esp_register_freertos_idle_hook_for_cpu(other_cpu_startup_idle_hook_cb, !xPortGetCoreID());
|
||||
while (!s_other_cpu_startup_done) {
|
||||
;
|
||||
}
|
||||
esp_deregister_freertos_idle_hook_for_cpu(s_app_cpu_startup_idle_hook_cb, 1);
|
||||
esp_deregister_freertos_idle_hook_for_cpu(other_cpu_startup_idle_hook_cb, !xPortGetCoreID());
|
||||
#endif
|
||||
|
||||
// [refactor-todo] check if there is a way to move the following block to esp_system startup
|
||||
|
Loading…
Reference in New Issue
Block a user