From 3629617c521d43f676c1b80d6458292bbc96c9ad Mon Sep 17 00:00:00 2001 From: Wu Jian Gang Date: Fri, 1 Jun 2018 15:30:58 +0800 Subject: [PATCH] feat(esp8266): Add rtc related attribute --- components/esp8266/include/esp_attr.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/esp8266/include/esp_attr.h b/components/esp8266/include/esp_attr.h index 65c51015..61d73236 100644 --- a/components/esp8266/include/esp_attr.h +++ b/components/esp8266/include/esp_attr.h @@ -38,4 +38,12 @@ // Use as ets_printf(DRAM_STR("Hello world!\n")); #define DRAM_STR(str) (__extension__({static const DRAM_ATTR char __c[] = (str); (const char *)&__c;})) +// Forces data into RTC memory. +// Any variable marked with this attribute will keep its value +// during a deep sleep / wake cycle. +#define RTC_DATA_ATTR __attribute__((section(".rtc.data"))) + +// Forces read-only data into RTC memory. +#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata"))) + #endif /* __ESP_ATTR_H__ */