fix(esp_hw_support): fix sleep exception if CONFIG_SPI_FLASH_ROM_IMPL enabled

This commit is contained in:
wuzhenghui
2026-03-09 16:12:11 +08:00
parent 06b5b96b19
commit 945e38b21c
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -552,6 +552,7 @@ static void s_do_deep_sleep_phy_callback(void)
#endif
static int s_cache_suspend_cnt = 0;
static uint32_t s_cache_state = 0;
// Must be called from critical sections.
static void FORCE_IRAM_ATTR suspend_cache(void) {
@@ -563,7 +564,7 @@ static void FORCE_IRAM_ATTR suspend_cache(void) {
// fully check the access to external memory, writeback & invalidate is needed here.
Cache_WriteBack_Invalidate_All(CACHE_MAP_MASK);
#endif
spi_flash_disable_cache(esp_cpu_get_core_id(), NULL);
spi_flash_disable_cache(esp_cpu_get_core_id(), &s_cache_state);
}
}
@@ -572,7 +573,7 @@ static void FORCE_IRAM_ATTR resume_cache(void) {
s_cache_suspend_cnt--;
assert(s_cache_suspend_cnt >= 0 && DRAM_STR("cache resume doesn't match suspend ops"));
if (s_cache_suspend_cnt == 0) {
spi_flash_restore_cache(esp_cpu_get_core_id(), 0);
spi_flash_restore_cache(esp_cpu_get_core_id(), s_cache_state);
}
}
@@ -2,3 +2,4 @@ CONFIG_PM_SLP_IRAM_OPT=y
CONFIG_PM_RTOS_IDLE_OPT=y
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
CONFIG_SPI_FLASH_ROM_IMPL=y