fix(esp_hw_support): fix core1 branch predictor access ext mem after cache disabled by core0

This commit is contained in:
wuzhenghui
2026-05-07 20:58:55 +08:00
parent 1aae08cb12
commit d0766f2a7f
3 changed files with 6 additions and 0 deletions
@@ -479,6 +479,7 @@ esp_err_t sleep_cpu_configure(bool light_sleep_enable)
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU
static IRAM_ATTR void smp_core_do_retention(void) static IRAM_ATTR void smp_core_do_retention(void)
{ {
esp_cpu_branch_prediction_disable();
uint8_t core_id = esp_cpu_get_core_id(); uint8_t core_id = esp_cpu_get_core_id();
if (core_id == 0) { if (core_id == 0) {
@@ -550,6 +551,7 @@ static IRAM_ATTR void smp_core_do_retention(void)
; ;
} }
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE); atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
esp_cpu_branch_prediction_enable();
} }
@@ -397,6 +397,7 @@ esp_err_t sleep_cpu_configure(bool light_sleep_enable)
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU
static SPM_IRAM_ATTR void smp_core_do_retention(void) static SPM_IRAM_ATTR void smp_core_do_retention(void)
{ {
esp_cpu_branch_prediction_disable();
uint8_t core_id = esp_cpu_get_core_id(); uint8_t core_id = esp_cpu_get_core_id();
if (core_id == 0) { if (core_id == 0) {
@@ -465,6 +466,7 @@ static SPM_IRAM_ATTR void smp_core_do_retention(void)
; ;
} }
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE); atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
esp_cpu_branch_prediction_enable();
} }
@@ -420,6 +420,7 @@ esp_err_t sleep_cpu_configure(bool light_sleep_enable)
#if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU
static IRAM_ATTR void smp_core_do_retention(void) static IRAM_ATTR void smp_core_do_retention(void)
{ {
esp_cpu_branch_prediction_disable();
uint8_t core_id = esp_cpu_get_core_id(); uint8_t core_id = esp_cpu_get_core_id();
if (core_id == 0) { if (core_id == 0) {
@@ -486,6 +487,7 @@ static IRAM_ATTR void smp_core_do_retention(void)
; ;
} }
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE); atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
esp_cpu_branch_prediction_enable();
} }