diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 62a8a43bf1..90fd80d0af 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -256,7 +256,8 @@ static bool s_light_sleep_wakeup = false; static portMUX_TYPE spinlock_rtc_deep_sleep = portMUX_INITIALIZER_UNLOCKED; static const char *TAG = "sleep"; -static RTC_FAST_ATTR bool s_adc_tsen_enabled = false; +/* APP core of esp32 can't access to RTC FAST MEMORY, do not define it with RTC_FAST_ATTR */ +static RTC_SLOW_ATTR bool s_adc_tsen_enabled = false; //in this mode, 2uA is saved, but RTC memory can't use at high temperature, and RTCIO can't be used as INPUT. static bool s_ultra_low_enabled = false; @@ -357,12 +358,12 @@ esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void) } #if CONFIG_IDF_TARGET_ESP32 -/* APP core of esp32 can't access to RTC FAST MEMORY, do not define it with RTC_IRAM_ATTR */ -void +/* APP core of esp32 can't access to RTC FAST MEMORY, link to RTC SLOW MEMORY instead*/ +RTC_SLOW_ATTR #else -void RTC_IRAM_ATTR +RTC_IRAM_ATTR #endif -esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) +void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) { #if SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY wake_stub_fn_handler = new_stub; @@ -371,7 +372,14 @@ esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) #endif } -void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) + +#if CONFIG_IDF_TARGET_ESP32 +/* APP core of esp32 can't access to RTC FAST MEMORY, link to RTC SLOW MEMORY instead*/ +RTC_SLOW_ATTR +#else +RTC_IRAM_ATTR +#endif +void esp_default_wake_deep_sleep(void) { /* Clear MMU for CPU 0 */ #if CONFIG_IDF_TARGET_ESP32 @@ -2208,11 +2216,11 @@ static uint32_t get_power_down_flags(void) #if CONFIG_IDF_TARGET_ESP32 /* APP core of esp32 can't access to RTC FAST MEMORY, do not define it with RTC_IRAM_ATTR */ -void +RTC_SLOW_ATTR #else -void RTC_IRAM_ATTR +RTC_IRAM_ATTR #endif -esp_deep_sleep_disable_rom_logging(void) +void esp_deep_sleep_disable_rom_logging(void) { rtc_suppress_rom_log(); } diff --git a/examples/system/deep_sleep/main/deep_sleep_example_main.c b/examples/system/deep_sleep/main/deep_sleep_example_main.c index d46a5c1ac2..ae3579956b 100644 --- a/examples/system/deep_sleep/main/deep_sleep_example_main.c +++ b/examples/system/deep_sleep/main/deep_sleep_example_main.c @@ -18,11 +18,7 @@ #include "nvs.h" #include "deep_sleep_example.h" -#if SOC_RTC_FAST_MEM_SUPPORTED -static RTC_DATA_ATTR struct timeval sleep_enter_time; -#else -static struct timeval sleep_enter_time; -#endif +RTC_SLOW_ATTR static struct timeval sleep_enter_time; static void deep_sleep_task(void *args) {