From bbfde331f15bb745428e9077f5a22d82ea2aa3fe Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Wed, 17 Jun 2026 18:04:13 +0800 Subject: [PATCH] fix(esp_hw_support): fix s31 sleep CPU retention state atomic declaration --- components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c | 2 +- .../esp_hw_support/lowpower/port/esp32s31/sleep_cpu_dynamic.c | 2 +- .../esp_hw_support/lowpower/port/esp32s31/sleep_cpu_retention.h | 2 +- .../esp_hw_support/lowpower/port/esp32s31/sleep_cpu_static.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c index be12e505cf2..1be5e037e9e 100644 --- a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c +++ b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c @@ -41,7 +41,7 @@ #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE -static DRAM_ATTR smp_retention_state_t s_smp_retention_state[portNUM_PROCESSORS]; +static DRAM_ATTR _Atomic(smp_retention_state_t) s_smp_retention_state[portNUM_PROCESSORS]; #endif static bool s_fpu_saved[portNUM_PROCESSORS]; diff --git a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_dynamic.c b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_dynamic.c index 87b4cfae52c..f72d769bc7b 100644 --- a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_dynamic.c +++ b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_dynamic.c @@ -52,7 +52,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id) } #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE -esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state) +esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state) { for (uint8_t core_id = 0; core_id < portNUM_PROCESSORS; ++core_id) { if (sleep_cpu_retention_ptr->retent.critical_frame[core_id] == NULL) { diff --git a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_retention.h b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_retention.h index 55f340c2f9e..043fc30b42d 100644 --- a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_retention.h +++ b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_retention.h @@ -47,7 +47,7 @@ typedef struct { } sleep_cpu_retention_t; #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE - esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state); + esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state); #else esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr); #endif diff --git a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_static.c b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_static.c index 317362fe6f9..d57db2661af 100644 --- a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_static.c +++ b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu_static.c @@ -74,7 +74,7 @@ static inline void * cpu_domain_clic_sleep_frame_alloc_and_init(uint8_t core_id) } #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE -esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, smp_retention_state_t *s_smp_retention_state) +esp_err_t esp_sleep_cpu_retention_init_impl(sleep_cpu_retention_t *sleep_cpu_retention_ptr, _Atomic(smp_retention_state_t) *s_smp_retention_state) { static DRAM_ATTR uint8_t rv_core_critical_regs[RV_SLEEP_CTX_FRMSZ * portNUM_PROCESSORS] __attribute__((aligned(4))); static DRAM_ATTR uint8_t rv_core_non_critical_regs[sizeof(RvCoreNonCriticalSleepFrame)* portNUM_PROCESSORS] __attribute__((aligned(4)));