diff --git a/arch/risc-v/src/common/espressif/Make.defs b/arch/risc-v/src/common/espressif/Make.defs index 5bf479843da..d2679aaf12c 100644 --- a/arch/risc-v/src/common/espressif/Make.defs +++ b/arch/risc-v/src/common/espressif/Make.defs @@ -95,7 +95,7 @@ endif ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty ifndef ESP_HAL_3RDPARTY_VERSION - ESP_HAL_3RDPARTY_VERSION = 09219a0103984369f56482f2a2fd92b26512e381 + ESP_HAL_3RDPARTY_VERSION = 54aca80daef2002b0169e67bcde36f19f59cf6cf endif ifndef ESP_HAL_3RDPARTY_URL diff --git a/arch/risc-v/src/common/espressif/esp_start.c b/arch/risc-v/src/common/espressif/esp_start.c index 1d84219a788..cbbeffe58e2 100644 --- a/arch/risc-v/src/common/espressif/esp_start.c +++ b/arch/risc-v/src/common/espressif/esp_start.c @@ -24,6 +24,7 @@ #include +#include #include #include @@ -90,15 +91,39 @@ EXTMEM_ICACHE_SHUT_DBUS_M) # define CHECKSUM_ALIGN 16 -# define IS_PADD(addr) (addr == 0) -# define IS_DRAM(addr) (addr >= SOC_DRAM_LOW && addr < SOC_DRAM_HIGH) -# define IS_IRAM(addr) (addr >= SOC_IRAM_LOW && addr < SOC_IRAM_HIGH) -# define IS_IROM(addr) (addr >= SOC_IROM_LOW && addr < SOC_IROM_HIGH) -# define IS_DROM(addr) (addr >= SOC_DROM_LOW && addr < SOC_DROM_HIGH) +# define IS_PADD(addr) ((addr) == 0) +# define IS_DRAM(addr) ((addr) >= SOC_DRAM_LOW && (addr) < SOC_DRAM_HIGH) +# define IS_IRAM(addr) ((addr) >= SOC_IRAM_LOW && (addr) < SOC_IRAM_HIGH) +# define IS_IROM(addr) ((addr) >= SOC_IROM_LOW && (addr) < SOC_IROM_HIGH) +# define IS_DROM(addr) ((addr) >= SOC_DROM_LOW && (addr) < SOC_DROM_HIGH) # define IS_SRAM(addr) (IS_IRAM(addr) || IS_DRAM(addr)) # define IS_MMAP(addr) (IS_IROM(addr) || IS_DROM(addr)) -# define IS_NONE(addr) (!IS_IROM(addr) && !IS_DROM(addr) \ - && !IS_IRAM(addr) && !IS_DRAM(addr) && !IS_PADD(addr)) +# ifdef SOC_RTC_FAST_MEM_SUPPORTED +# define IS_RTC_FAST_IRAM(addr) \ + ((addr) >= SOC_RTC_IRAM_LOW \ + && (addr) < SOC_RTC_IRAM_HIGH) +# define IS_RTC_FAST_DRAM(addr) \ + ((addr) >= SOC_RTC_DRAM_LOW \ + && (addr) < SOC_RTC_DRAM_HIGH) +# else +# define IS_RTC_FAST_IRAM(addr) false +# define IS_RTC_FAST_DRAM(addr) false +# endif +# ifdef SOC_RTC_SLOW_MEM_SUPPORTED +# define IS_RTC_SLOW_DRAM(addr) \ + ((addr) >= SOC_RTC_DATA_LOW \ + && (addr) < SOC_RTC_DATA_HIGH) +# else +# define IS_RTC_SLOW_DRAM(addr) false +# endif +# define IS_NONE(addr) (!IS_IROM(addr) \ + && !IS_DROM(addr) \ + && !IS_IRAM(addr) \ + && !IS_DRAM(addr) \ + && !IS_RTC_FAST_IRAM(addr) \ + && !IS_RTC_FAST_DRAM(addr) \ + && !IS_RTC_SLOW_DRAM(addr) \ + && !IS_PADD(addr)) # define IS_MAPPING(addr) IS_IROM(addr) || IS_DROM(addr) #endif @@ -262,15 +287,27 @@ static int map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr, break; } + if (IS_RTC_FAST_IRAM(segment_hdr.load_addr) || + IS_RTC_FAST_DRAM(segment_hdr.load_addr) || + IS_RTC_SLOW_DRAM(segment_hdr.load_addr)) + { + /* RTC segment is loaded by ROM bootloader */ + + ram_segments++; + } + ets_printf("%s: lma 0x%08x vma 0x%08lx len 0x%-6lx (%lu)\n", - IS_NONE(segment_hdr.load_addr) ? "???" : - IS_MMAP(segment_hdr.load_addr) ? - IS_IROM(segment_hdr.load_addr) ? "imap" : "dmap" : - IS_PADD(segment_hdr.load_addr) ? "padd" : - IS_DRAM(segment_hdr.load_addr) ? "dram" : "iram", - offset + sizeof(esp_image_segment_header_t), - segment_hdr.load_addr, segment_hdr.data_len, - segment_hdr.data_len); + IS_NONE(segment_hdr.load_addr) ? "???" : + IS_RTC_FAST_IRAM(segment_hdr.load_addr) || + IS_RTC_FAST_DRAM(segment_hdr.load_addr) || + IS_RTC_SLOW_DRAM(segment_hdr.load_addr) ? "rtc" : + IS_MMAP(segment_hdr.load_addr) ? + IS_IROM(segment_hdr.load_addr) ? "imap" : "dmap" : + IS_PADD(segment_hdr.load_addr) ? "padd" : + IS_DRAM(segment_hdr.load_addr) ? "dram" : "iram", + offset + sizeof(esp_image_segment_header_t), + segment_hdr.load_addr, segment_hdr.data_len, + segment_hdr.data_len); /* Fix drom and irom produced be the linker, as this * is later invalidated by the elf2image command. diff --git a/boards/risc-v/esp32c3/common/scripts/esp32c3_simple_boot_sections.ld b/boards/risc-v/esp32c3/common/scripts/esp32c3_simple_boot_sections.ld index c9266e26a33..e5a5bfd70a5 100644 --- a/boards/risc-v/esp32c3/common/scripts/esp32c3_simple_boot_sections.ld +++ b/boards/risc-v/esp32c3/common/scripts/esp32c3_simple_boot_sections.ld @@ -372,7 +372,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) } >rtc_iram_seg /* This section holds RTC data that should have fixed addresses. diff --git a/boards/risc-v/esp32c6/common/scripts/esp32c6_simple_boot_sections.ld b/boards/risc-v/esp32c6/common/scripts/esp32c6_simple_boot_sections.ld index fc903daf01f..98cdfa765bc 100644 --- a/boards/risc-v/esp32c6/common/scripts/esp32c6_simple_boot_sections.ld +++ b/boards/risc-v/esp32c6/common/scripts/esp32c6_simple_boot_sections.ld @@ -384,7 +384,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) } >rtc_iram_seg /* This section holds RTC data that should have fixed addresses. diff --git a/boards/risc-v/esp32h2/common/scripts/esp32h2_simple_boot_sections.ld b/boards/risc-v/esp32h2/common/scripts/esp32h2_simple_boot_sections.ld index 9c64b93d74d..910842b1336 100644 --- a/boards/risc-v/esp32h2/common/scripts/esp32h2_simple_boot_sections.ld +++ b/boards/risc-v/esp32h2/common/scripts/esp32h2_simple_boot_sections.ld @@ -384,7 +384,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) } >rtc_iram_seg /* This section holds RTC data that should have fixed addresses.