fix(ulp): fixes potential race-condition for lp-timer wakeup with lp-core

Reconfigure wakeup time before enabling the wakeup source to avoid
a wakeup from potentially stale values.

Closes https://github.com/espressif/esp-idf/issues/17009
This commit is contained in:
Marius Vikhammer
2026-06-10 11:10:01 +08:00
parent ecb4123afd
commit 42bb45db22
+7 -7
View File
@@ -161,16 +161,9 @@ esp_err_t ulp_lp_core_run(ulp_lp_core_cfg_t* cfg)
otherwise configured HW breakpoints and dcsr.ebreak* bits will be missed */
lp_core_ll_rst_at_sleep_enable(!(CONFIG_ULP_NORESET_UNDER_DEBUG && esp_cpu_dbgr_is_attached()));
/* Set wake-up sources */
lp_core_ll_set_wakeup_source(lp_core_get_wakeup_source_hw_flags(cfg->wakeup_source));
/* Enable JTAG debugging */
lp_core_ll_debug_module_enable(true);
if (cfg->wakeup_source & ULP_LP_CORE_WAKEUP_SOURCE_HP_CPU) {
lp_core_ll_hp_wake_lp();
}
#if SOC_ULP_LP_UART_SUPPORTED
if (cfg->wakeup_source & ULP_LP_CORE_WAKEUP_SOURCE_LP_UART) {
lp_core_ll_enable_lp_uart_wakeup(true);
@@ -192,6 +185,13 @@ esp_err_t ulp_lp_core_run(ulp_lp_core_cfg_t* cfg)
}
#endif
/* Set wake-up sources */
lp_core_ll_set_wakeup_source(lp_core_get_wakeup_source_hw_flags(cfg->wakeup_source));
if (cfg->wakeup_source & ULP_LP_CORE_WAKEUP_SOURCE_HP_CPU) {
lp_core_ll_hp_wake_lp();
}
return ESP_OK;
}