diff --git a/CHANGELOG.md b/CHANGELOG.md index c01991cc6..a1a7ca14b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Examples should now work with the `defmt` feature (#810) - Fixed a race condition causing SpiDma to stop working unexpectedly (#869) - Fixed async uart serial, and updated the embassy_serial examples (#871). +- Fix ESP32-S3 direct-boot (#873) ### Removed diff --git a/esp32s3-hal/ld/db-esp32s3.x b/esp32s3-hal/ld/db-esp32s3.x index 5860b7bca..12db13bfc 100644 --- a/esp32s3-hal/ld/db-esp32s3.x +++ b/esp32s3-hal/ld/db-esp32s3.x @@ -75,13 +75,13 @@ SECTIONS { .pre_header (NOLOAD) : AT(0) { . = . + 0x400; - } + } > irom_seg - .header ORIGIN(ROTEXT) : AT(0x400) + .header ORIGIN(ROTEXT) + 0x400 : AT(0x400) { LONG(0xaedb041d) LONG(0xaedb041d) - } + } > irom_seg .text ORIGIN(ROTEXT) + 0x408 : AT(0x408) { @@ -94,19 +94,20 @@ SECTIONS { . = ALIGN (4); _text_end = ABSOLUTE(.); _etext = .; - } + } > REGION_TEXT _text_size = _etext - _stext; - .rodata ORIGIN(RODATA) + 0x408 + _text_size : + .rodata ORIGIN(RODATA) + 0x408 + _text_size : AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header)) { - _rodata_start = ABSOLUTE(.); . = ALIGN (4); + _rodata_start = ABSOLUTE(.); *(.rodata .rodata.*) . = ALIGN (4); _rodata_end = ABSOLUTE(.); - } + } > REGION_RODATA - .rwtext ORIGIN(RWTEXT) + 0x408 + _text_size + SIZEOF(.rodata) : + .rwtext ORIGIN(RWTEXT) + 0x408 + _text_size + SIZEOF(.rodata) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata)) { _irwtext = ORIGIN(RODATA) + 0x408 + _text_size + SIZEOF(.rodata); _srwtext = .; @@ -152,19 +153,21 @@ SECTIONS { . = ALIGN (4); _erwtext = .; - } + } > REGION_RWTEXT .data ORIGIN(RWDATA) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext)) { _data_start = ABSOLUTE(.); . = ALIGN (4); *(.data .data.*) . = ALIGN (4); _data_end = ABSOLUTE(.); - } + } > REGION_DATA + /* LMA of .data */ - _sidata = _erwtext - ORIGIN(RWTEXT) + ORIGIN(RODATA); + _sidata = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext); .bss (NOLOAD) : ALIGN(4) { @@ -173,93 +176,102 @@ SECTIONS { *(.bss .bss.* COMMON) . = ALIGN (4); _bss_end = ABSOLUTE(.); - } > RWDATA + } > REGION_BSS .noinit (NOLOAD) : ALIGN(4) { . = ALIGN(4); *(.noinit .noinit.*) . = ALIGN (4); - } > RWDATA + } > REGION_BSS /* must be last segment using RWDATA */ .stack_end (NOLOAD) : ALIGN(4) { . = ALIGN (4); _stack_end = ABSOLUTE(.); - } > RWDATA + } > REGION_STACK .rtc_fast.text ORIGIN(rtc_fast_seg) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.noinit)) { . = ALIGN(4); _rtc_fast_text_start = ABSOLUTE(.); *(.rtc_fast.literal .rtc_fast.text .rtc_fast.literal.* .rtc_fast.text.*) . = ALIGN(4); _rtc_fast_text_end = ABSOLUTE(.); - } - _irtc_fast_text = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext); - + } > REGION_RTC_FAST + _irtc_fast_text = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.noinit); + .rtc_fast.data ORIGIN(rtc_fast_seg) + SIZEOF(.rtc_fast.text) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.noinit) + SIZEOF(.rtc_fast.text) ) { . = ALIGN(4); _rtc_fast_data_start = ABSOLUTE(.); *(.rtc_fast.data .rtc_fast.data.*) . = ALIGN(4); _rtc_fast_data_end = ABSOLUTE(.); - } - _irtc_fast_data = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.rtc_fast.text); + } > REGION_RTC_FAST + _irtc_fast_data = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.noinit) + SIZEOF(.rtc_fast.text); - .rtc_fast.bss ORIGIN(rtc_fast_seg) + SIZEOF(.rtc_fast.text) (NOLOAD) : + .rtc_fast.bss ORIGIN(rtc_fast_seg) + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) (NOLOAD) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + SIZEOF(.data) + SIZEOF(.bss) + SIZEOF(.noinit) + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data)) { . = ALIGN(4); _rtc_fast_bss_start = ABSOLUTE(.); *(.rtc_fast.bss .rtc_fast.bss.*) . = ALIGN (4); _rtc_fast_bss_end = ABSOLUTE(.); - } + } > REGION_RTC_FAST - .rtc_fast.noinit ORIGIN(rtc_fast_seg) + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.bss) (NOLOAD) : + .rtc_fast.noinit ORIGIN(rtc_fast_seg) + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss) (NOLOAD) : { . = ALIGN(4); *(.rtc_fast.noinit .rtc_fast.noinit.*) . = ALIGN (4); - } + } > REGION_RTC_FAST .rtc_slow.text ORIGIN(rtc_slow_seg) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss)) { . = ALIGN(4); _rtc_slow_text_start = ABSOLUTE(.); *(.rtc_slow.literal .rtc_slow.text .rtc_slow.literal.* .rtc_slow.text.*) . = ALIGN(4); _rtc_slow_text_end = ABSOLUTE(.); - } + } > REGION_RTC_SLOW _irtc_slow_text = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + - SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.bss); + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss); .rtc_slow.data ORIGIN(rtc_slow_seg) + SIZEOF(.rtc_slow.text) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss) + SIZEOF(.rtc_slow.text)) { . = ALIGN(4); _rtc_slow_data_start = ABSOLUTE(.); *(.rtc_slow.data .rtc_slow.data.*) . = ALIGN(4); _rtc_slow_data_end = ABSOLUTE(.); - } + } > REGION_RTC_SLOW _irtc_slow_data = ORIGIN(RODATA) + _text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + - SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.bss) + SIZEOF(.rtc_slow.text); + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss) + SIZEOF(.rtc_slow.text); .rtc_slow.bss ORIGIN(rtc_slow_seg) + SIZEOF(.rtc_slow.text) + SIZEOF(.rtc_slow.data) (NOLOAD) : + AT(_text_size + SIZEOF(.header) + SIZEOF(.pre_header) + SIZEOF(.rodata) + SIZEOF(.rwtext) + + SIZEOF(.rtc_fast.text) + SIZEOF(.rtc_fast.data) + SIZEOF(.rtc_fast.bss) + SIZEOF(.rtc_slow.text) + SIZEOF(.rtc_slow.data)) { . = ALIGN(4); _rtc_slow_bss_start = ABSOLUTE(.); *(.rtc_slow.bss .rtc_slow.bss.*) . = ALIGN (4); _rtc_slow_bss_end = ABSOLUTE(.); - } + } > REGION_RTC_SLOW .rtc_slow.noinit ORIGIN(rtc_slow_seg) + SIZEOF(.rtc_slow.text) + SIZEOF(.rtc_slow.data) + SIZEOF(.rtc_slow.bss) (NOLOAD) : { . = ALIGN(4); *(.rtc_slow.noinit .rtc_slow.noinit.*) . = ALIGN (4); - } + } > REGION_RTC_SLOW } diff --git a/esp32s3-hal/ld/db-memory.x b/esp32s3-hal/ld/db-memory.x index b8c65a763..11c992021 100644 --- a/esp32s3-hal/ld/db-memory.x +++ b/esp32s3-hal/ld/db-memory.x @@ -29,3 +29,14 @@ MEMORY /* RTC slow memory (data accessible). Persists over deep sleep. */ rtc_slow_seg(RW) : ORIGIN = 0x50000000, len = 8k } + +REGION_ALIAS("REGION_TEXT", irom_seg); +REGION_ALIAS("REGION_RODATA", drom_seg); + +REGION_ALIAS("REGION_DATA", dram_seg); +REGION_ALIAS("REGION_BSS", dram_seg); +REGION_ALIAS("REGION_STACK", dram_seg); + +REGION_ALIAS("REGION_RWTEXT", iram_seg); +REGION_ALIAS("REGION_RTC_FAST", rtc_fast_seg); +REGION_ALIAS("REGION_RTC_SLOW", rtc_slow_seg);