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-11 09:02:47 +08:00
parent 702f0d8ed4
commit 6124c9c153
+7 -7
View File
@@ -122,16 +122,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);
@@ -153,6 +146,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;
}