Merge branch 'feature/add_rtc_section' into 'master'

feat(esp8266): Add rtc segment and attribute support

See merge request sdk/ESP8266_RTOS_SDK!213
This commit is contained in:
Wu Jian Gang
2018-06-02 21:25:28 +08:00
3 changed files with 30 additions and 4 deletions

View File

@ -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__ */

View File

@ -62,6 +62,15 @@ SECTIONS
_dport0_data_end = ABSOLUTE(.);
} >dport0_0_seg :dport0_0_phdr
/* RTC memory holds user's data/rodata */
.rtc.data :
{
_rtc_data_start = ABSOLUTE(.);
*(.rtc.data)
*(.rtc.rodata)
_rtc_data_end = ABSOLUTE(.);
} > rtc_seg
.text : ALIGN(4)
{
_stext = .;

View File

@ -18,8 +18,17 @@
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40201010, len = 0xE0000
dport0_0_seg : org = 0x3FF00000, len = 0x10
/* All .data/.bss/heap are in this segment. */
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
/* Functions which are critical should be put in this segment. */
iram1_0_seg : org = 0x40100000, len = 0x8000
/* It is actually mapped to flash. */
irom0_0_seg : org = 0x40201010, len = 0xFF000 - 0x10
/* RTC memory, persists over deep sleep. */
rtc_seg : org = 0x60001200, len = 0x200
}