From e2b299660e0e18220409a2e6d2ed6e09d709d9bc Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Thu, 8 Dec 2022 12:01:25 +0800 Subject: [PATCH] bugfix: unstall other cpu on core reset - Closes https://github.com/espressif/esp-idf/issues/10320 --- components/esp_system/esp_system.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/esp_system/esp_system.c b/components/esp_system/esp_system.c index 8d2457b2c0..3fa64c9935 100644 --- a/components/esp_system/esp_system.c +++ b/components/esp_system/esp_system.c @@ -36,10 +36,19 @@ void IRAM_ATTR esp_restart_noos_dig(void) // switch to XTAL (otherwise we will keep running from the PLL) rtc_clk_cpu_freq_set_xtal(); -#if CONFIG_IDF_TARGET_ESP32 - esp_cpu_unstall(PRO_CPU_NUM); + // esp_restart_noos_dig() will generates a core reset, which does not reset the + // registers of the RTC domain, so the CPU's stall state remains after the reset, + // we need to release them here +#if !CONFIG_FREERTOS_UNICORE + // Unstall all other cores + int core_id = cpu_hal_get_core_id(); + for (uint32_t i = 0; i < SOC_CPU_CORES_NUM; i++) { + if (i != core_id) { + esp_cpu_unstall(i); + } + } #endif - // reset the digital part + // generate core reset SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST); while (true) { ;