diff --git a/components/esp_system/system_init_fn.txt b/components/esp_system/system_init_fn.txt index 260d447ed2..3970de39f0 100644 --- a/components/esp_system/system_init_fn.txt +++ b/components/esp_system/system_init_fn.txt @@ -54,7 +54,7 @@ CORE: 170: init_xt_wdt in components/esp_system/startup_funcs.c on BIT(0) ########### SECONDARY startup stage ########### # esp_timer has to be initialized early, since it is used by several other components -SECONDARY: 100: esp_timer_startup_init in components/esp_timer/src/esp_timer.c on CONFIG_ESP_TIMER_ISR_AFFINITY +SECONDARY: 100: esp_timer_startup_init in components/esp_timer/src/esp_timer.c on ESP_TIMER_INIT_MASK # HW stack guard via assist-debug module. SECONDARY: 101: esp_hw_stack_guard_init in components/esp_system/hw_stack_guard.c on ESP_SYSTEM_INIT_ALL_CORES diff --git a/components/esp_timer/Kconfig b/components/esp_timer/Kconfig index cbce3ae3a8..6cd748fa33 100644 --- a/components/esp_timer/Kconfig +++ b/components/esp_timer/Kconfig @@ -74,12 +74,6 @@ menu "High resolution timer (esp_timer)" depends on !FREERTOS_UNICORE && ESP_TIMER_SHOW_EXPERIMENTAL endchoice - config ESP_TIMER_ISR_AFFINITY - hex - default 0x1 if ESP_TIMER_ISR_AFFINITY_CPU0 - default 0x2 if ESP_TIMER_ISR_AFFINITY_CPU1 - default FREERTOS_NO_AFFINITY if ESP_TIMER_ISR_AFFINITY_NO_AFFINITY - choice ESP_TIMER_ISR_AFFINITY prompt "timer interrupt core affinity" default ESP_TIMER_ISR_AFFINITY_CPU0 diff --git a/components/esp_timer/src/esp_timer.c b/components/esp_timer/src/esp_timer.c index bc3ab3fca2..7440a2c935 100644 --- a/components/esp_timer/src/esp_timer.c +++ b/components/esp_timer/src/esp_timer.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -574,7 +574,16 @@ esp_err_t esp_timer_init(void) return err; } -ESP_SYSTEM_INIT_FN(esp_timer_startup_init, SECONDARY, CONFIG_ESP_TIMER_ISR_AFFINITY, 100) +#if CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0 +#define ESP_TIMER_INIT_MASK BIT(0) +#elif CONFIG_ESP_TIMER_ISR_AFFINITY_CPU1 +#define ESP_TIMER_INIT_MASK BIT(1) +#elif CONFIG_ESP_TIMER_ISR_AFFINITY_NO_AFFINITY +#define ESP_TIMER_INIT_MASK ESP_SYSTEM_INIT_ALL_CORES +#endif // CONFIG_ESP_TIMER_ISR_AFFINITY_* + + +ESP_SYSTEM_INIT_FN(esp_timer_startup_init, SECONDARY, ESP_TIMER_INIT_MASK, 100) { return esp_timer_init(); }