Page 1 of 1

Using RTC memory

Posted: Sun Jan 22, 2023 12:29 pm
by br0kenpixel
Hi. I'd like to store some data (about 100 bytes) on my ESP32 which I'd like to access after waking up from a deep sleep.
Are there any functions to do this in a Rust project? I know there's an `RTC_DATA_ATTR` attribute you can use in C/C++ projects but is there a way to do this in Rust? Since this data will be updated before every sleep, using flash memory is not the best choice, as it has a limited amount of write cycles.

Re: Using RTC memory

Posted: Fri Apr 07, 2023 8:57 am
by jssfr2342
Working example for a u32 (value is persisted across deep sleep resets for instance):

Code: Select all

#[link_section = ".rtc.data"]
static mut MY_FANCY_VARIABLE: u32 = 0;