From c78fb1602e9a279f2f3623e30ec0f90c3b7df357 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Thu, 9 Mar 2023 16:34:01 +0800 Subject: [PATCH] feature: add wake up time cost info to deep_sleep_wake_stub example --- components/esp_hw_support/sleep_modes.c | 8 +++++++- .../deep_sleep_wake_stub/main/rtc_wake_stub_example.c | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 4327d9d5b2..9f8b25b3c2 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -1416,7 +1416,13 @@ static uint32_t get_power_down_flags(void) return pd_flags; } -void esp_deep_sleep_disable_rom_logging(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 +#else +void RTC_IRAM_ATTR +#endif +esp_deep_sleep_disable_rom_logging(void) { rtc_suppress_rom_log(); } diff --git a/examples/system/deep_sleep_wake_stub/main/rtc_wake_stub_example.c b/examples/system/deep_sleep_wake_stub/main/rtc_wake_stub_example.c index dd337a7f57..ce7d0ad33a 100644 --- a/examples/system/deep_sleep_wake_stub/main/rtc_wake_stub_example.c +++ b/examples/system/deep_sleep_wake_stub/main/rtc_wake_stub_example.c @@ -34,6 +34,9 @@ static const uint32_t s_max_count = 20; // wakeup_cause stored in RTC memory static uint32_t wakeup_cause; +// wakeup_time from CPU start to wake stub +static uint32_t wakeup_time; + // wake up stub function stored in RTC memory void wake_stub_example(void) { @@ -45,7 +48,7 @@ void wake_stub_example(void) // Increment the counter. s_count++; // Print the counter value and wakeup cause. - ESP_RTC_LOGI("wake stub: wakeup count is %d, wakeup cause is %d", s_count, wakeup_cause); + ESP_RTC_LOGI("wake stub: wakeup count is %d, wakeup cause is %d, wakeup cost %ld us", s_count, wakeup_cause, wakeup_time); if (s_count >= s_max_count) { // Reset s_count