From f4aedfd0177bd4b63762e532b2fca87ac50904e0 Mon Sep 17 00:00:00 2001 From: fuzhibo Date: Thu, 10 Dec 2020 14:45:41 +0800 Subject: [PATCH] fix: RTC_FAST_MEM always power on if used for heap --- components/esp_system/sleep_modes.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/esp_system/sleep_modes.c b/components/esp_system/sleep_modes.c index a708667f23..62a1518a92 100644 --- a/components/esp_system/sleep_modes.c +++ b/components/esp_system/sleep_modes.c @@ -858,14 +858,17 @@ static uint32_t get_power_down_flags(void) } #endif - // RTC_FAST_MEM is needed for deep sleep stub. - // If RTC_FAST_MEM is Auto, keep it powered on, so that deep sleep stub - // can run. - // In the new chip revision, deep sleep stub will be optional, - // and this can be changed. +#if !CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP && !CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP && !CONFIG_ESP32S3_ALLOW_RTC_FAST_MEM_AS_HEAP + /* RTC_FAST_MEM is needed for deep sleep stub. + If RTC_FAST_MEM is Auto, keep it powered on, so that deep sleep stub can run. + In the new chip revision, deep sleep stub will be optional, and this can be changed. */ if (s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] == ESP_PD_OPTION_AUTO) { s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] = ESP_PD_OPTION_ON; } +#else + /* If RTC_FAST_MEM is used for heap, force RTC_FAST_MEM to be powered on. */ + s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] = ESP_PD_OPTION_ON; +#endif // RTC_PERIPH is needed for EXT0 wakeup and GPIO wakeup. // If RTC_PERIPH is auto, and EXT0/GPIO aren't enabled, power down RTC_PERIPH.