Using RTC memory

br0kenpixel
Posts: 2
Joined: Fri Dec 30, 2022 4:58 pm

Using RTC memory

Postby br0kenpixel » Sun Jan 22, 2023 12:29 pm

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.

jssfr2342
Posts: 1
Joined: Fri Apr 07, 2023 8:55 am

Re: Using RTC memory

Postby jssfr2342 » Fri Apr 07, 2023 8:57 am

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;

Who is online

Users browsing this forum: No registered users and 4 guests