From 97a2d9552efc083e9f2a2e311d79eb8d3876b3f8 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Fri, 12 Mar 2021 17:30:21 +0800 Subject: [PATCH] newlib: persist rtc clk corrections --- components/newlib/port/esp_time_impl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/newlib/port/esp_time_impl.c b/components/newlib/port/esp_time_impl.c index d13d3db402..bb3bc77bb3 100644 --- a/components/newlib/port/esp_time_impl.c +++ b/components/newlib/port/esp_time_impl.c @@ -16,6 +16,7 @@ #include #include +#include "esp_attr.h" #include "esp_system.h" #include "soc/rtc.h" @@ -60,7 +61,7 @@ static uint64_t s_boot_time; // when RTC is used to persist time, two RTC_STORE static _lock_t s_boot_time_lock; static _lock_t s_esp_rtc_time_lock; -static uint64_t s_esp_rtc_time_us, s_rtc_last_ticks; +static RTC_DATA_ATTR uint64_t s_esp_rtc_time_us = 0, s_rtc_last_ticks = 0; #if defined( CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER ) || defined( CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER ) uint64_t esp_time_impl_get_time_since_boot(void)