Skip to content

Commit d035502

Browse files
sylvioalvescfriedt
authored andcommitted
soc: espressif: load RTC region into loader process
Only RTC DRAM area is currently being loaded during segment loader. It means that RTC_IRAM and RTC_DATA is missing, causing issues when sleep-modes are needed. This also re-format the segments logging output to meet with MCUBoot/Simple boot cases. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 1504833 commit d035502

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

soc/espressif/common/loader.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,17 @@
6363
#define IS_IROM(o) (o.load_addr >= SOC_IROM_LOW && o.load_addr < SOC_IROM_HIGH)
6464
#define IS_DROM(o) (o.load_addr >= SOC_DROM_LOW && o.load_addr < SOC_DROM_HIGH)
6565
#ifdef SOC_RTC_MEM_SUPPORTED
66-
#define IS_RTC(o) (o.load_addr >= SOC_RTC_DRAM_LOW && o.load_addr < SOC_RTC_DRAM_HIGH)
66+
#define IS_RTC_DRAM(o) (o.load_addr >= SOC_RTC_DRAM_LOW && o.load_addr < SOC_RTC_DRAM_HIGH)
67+
#define IS_RTC_IRAM(o) (o.load_addr >= SOC_RTC_IRAM_LOW && o.load_addr < SOC_RTC_IRAM_HIGH)
68+
#define IS_RTC_DATA(o) (o.load_addr >= SOC_RTC_DATA_LOW && o.load_addr < SOC_RTC_DATA_HIGH)
6769
#else
68-
#define IS_RTC(o) 0
70+
#define IS_RTC_DRAM(o) 0
71+
#define IS_RTC_IRAM(o) 0
72+
#define IS_RTC_DATA(o) 0
6973
#endif
7074
#define IS_SRAM(o) (IS_IRAM(o) || IS_DRAM(o))
7175
#define IS_MMAP(o) (IS_IROM(o) || IS_DROM(o))
76+
#define IS_RTC(o) (IS_RTC_DRAM(o) || IS_RTC_IRAM(o) || IS_RTC_DATA(o))
7277
#define IS_LAST(o) \
7378
(!IS_IROM(o) && !IS_DROM(o) && !IS_IRAM(o) && !IS_DRAM(o) && !IS_PADD(o) && !IS_RTC(o))
7479

@@ -132,14 +137,14 @@ void map_rom_segments(int core, struct rom_segments *map)
132137
break;
133138
}
134139

135-
ESP_EARLY_LOGI(TAG, "%s: lma 0x%08x vma 0x%08x len 0x%-6x (%u)",
136-
IS_LAST(segment_hdr) ? "???" :
137-
IS_MMAP(segment_hdr) ?
138-
IS_IROM(segment_hdr) ? "IMAP" : "DMAP" :
139-
IS_DRAM(segment_hdr) ? "DRAM" :
140-
IS_RTC(segment_hdr) ? "RTC" : "IRAM",
141-
offset + sizeof(esp_image_segment_header_t),
142-
segment_hdr.load_addr, segment_hdr.data_len, segment_hdr.data_len);
140+
ESP_EARLY_LOGI(TAG, "%s\t: lma=%08xh vma=%08xh size=%05xh (%6d)",
141+
IS_LAST(segment_hdr) ? "???"
142+
: IS_DRAM(segment_hdr) ? "DRAM"
143+
: IS_RTC_IRAM(segment_hdr) ? "RTC_IRAM"
144+
: IS_RTC_DRAM(segment_hdr) ? "RTC_DRAM"
145+
: IS_RTC_DATA(segment_hdr) ? "RTC_DATA" : "IRAM",
146+
offset + sizeof(esp_image_segment_header_t), segment_hdr.load_addr,
147+
segment_hdr.data_len, segment_hdr.data_len);
143148

144149
/* Fix drom and irom produced be the linker, as it could
145150
* be invalidated by the elf2image and flash load offset
@@ -168,7 +173,6 @@ void map_rom_segments(int core, struct rom_segments *map)
168173
abort();
169174
}
170175

171-
ESP_EARLY_LOGI(TAG, "Image with %d segments", segments - 1);
172176
#endif /* !CONFIG_BOOTLOADER_MCUBOOT */
173177

174178
#if CONFIG_SOC_SERIES_ESP32
@@ -302,9 +306,9 @@ void __start(void)
302306
map_rom_segments(0, &map);
303307

304308
/* Show map segments continue using same log format as during MCUboot phase */
305-
ESP_EARLY_LOGI(TAG, "%s segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map", "IROM",
309+
ESP_EARLY_LOGI(TAG, "%s\t: lma=%08xh vma=%08xh size=%05Xh (%6d) map", "IROM",
306310
map.irom_flash_offset, map.irom_map_addr, map.irom_size, map.irom_size);
307-
ESP_EARLY_LOGI(TAG, "%s segment: paddr=%08xh, vaddr=%08xh, size=%05Xh (%6d) map", "DROM",
311+
ESP_EARLY_LOGI(TAG, "%s\t: lma=%08xh vma=%08xh size=%05Xh (%6d) map", "DROM",
308312
map.drom_flash_offset, map.drom_map_addr, map.drom_size, map.drom_size);
309313
esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
310314

0 commit comments

Comments
 (0)