From a763ed1e07cd965ae75343c8f41f54f4324a405a Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Tue, 27 Aug 2024 17:39:54 -0300 Subject: [PATCH] espressif: Fix build with RTC This commit ensures that RTC data is properly allocated in the RTC segment in the linker. This fixes the reported problem about using the legacy bootloader and RTC. --- .../esp32c3-legacy/common/scripts/legacy_sections.ld | 2 ++ .../esp32c3-legacy/common/scripts/mcuboot_sections.ld | 2 ++ .../esp32c3/common/scripts/esp32c3_legacy_sections.ld | 2 ++ .../esp32c6/common/scripts/esp32c6_legacy_sections.ld | 2 ++ .../esp32h2/common/scripts/esp32h2_legacy_sections.ld | 2 ++ boards/xtensa/esp32/common/scripts/legacy_sections.ld | 2 ++ boards/xtensa/esp32/common/scripts/mcuboot_sections.ld | 2 ++ .../esp32/common/scripts/simple_boot_sections.ld | 2 ++ .../xtensa/esp32s2/common/scripts/mcuboot_sections.ld | 2 ++ .../esp32s2/common/scripts/simple_boot_sections.ld | 2 ++ .../xtensa/esp32s3/common/scripts/legacy_sections.ld | 10 ++++++++++ .../xtensa/esp32s3/common/scripts/mcuboot_sections.ld | 2 ++ 12 files changed, 32 insertions(+) diff --git a/boards/risc-v/esp32c3-legacy/common/scripts/legacy_sections.ld b/boards/risc-v/esp32c3-legacy/common/scripts/legacy_sections.ld index 9d4c615d93fc2..a71dce5f742a3 100644 --- a/boards/risc-v/esp32c3-legacy/common/scripts/legacy_sections.ld +++ b/boards/risc-v/esp32c3-legacy/common/scripts/legacy_sections.ld @@ -245,7 +245,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/risc-v/esp32c3-legacy/common/scripts/mcuboot_sections.ld b/boards/risc-v/esp32c3-legacy/common/scripts/mcuboot_sections.ld index 87049498d076a..6eca605229444 100644 --- a/boards/risc-v/esp32c3-legacy/common/scripts/mcuboot_sections.ld +++ b/boards/risc-v/esp32c3-legacy/common/scripts/mcuboot_sections.ld @@ -294,7 +294,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/risc-v/esp32c3/common/scripts/esp32c3_legacy_sections.ld b/boards/risc-v/esp32c3/common/scripts/esp32c3_legacy_sections.ld index d93020dd9d07f..561f3c958d8eb 100644 --- a/boards/risc-v/esp32c3/common/scripts/esp32c3_legacy_sections.ld +++ b/boards/risc-v/esp32c3/common/scripts/esp32c3_legacy_sections.ld @@ -265,7 +265,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_legacy_sections.ld b/boards/risc-v/esp32c6/common/scripts/esp32c6_legacy_sections.ld index 522befd967d21..c477ad543b40b 100644 --- a/boards/risc-v/esp32c6/common/scripts/esp32c6_legacy_sections.ld +++ b/boards/risc-v/esp32c6/common/scripts/esp32c6_legacy_sections.ld @@ -261,7 +261,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) } >lp_ram_seg /* This section holds RTC data that should have fixed addresses. diff --git a/boards/risc-v/esp32h2/common/scripts/esp32h2_legacy_sections.ld b/boards/risc-v/esp32h2/common/scripts/esp32h2_legacy_sections.ld index 951ef2b75c41e..f28f57f25cbef 100644 --- a/boards/risc-v/esp32h2/common/scripts/esp32h2_legacy_sections.ld +++ b/boards/risc-v/esp32h2/common/scripts/esp32h2_legacy_sections.ld @@ -261,7 +261,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) } >lp_ram_seg /* This section holds RTC data that should have fixed addresses. diff --git a/boards/xtensa/esp32/common/scripts/legacy_sections.ld b/boards/xtensa/esp32/common/scripts/legacy_sections.ld index c61da8a5b5549..d33cee9339b50 100644 --- a/boards/xtensa/esp32/common/scripts/legacy_sections.ld +++ b/boards/xtensa/esp32/common/scripts/legacy_sections.ld @@ -359,7 +359,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32/common/scripts/mcuboot_sections.ld b/boards/xtensa/esp32/common/scripts/mcuboot_sections.ld index da36517943f71..25a6528a79e2e 100644 --- a/boards/xtensa/esp32/common/scripts/mcuboot_sections.ld +++ b/boards/xtensa/esp32/common/scripts/mcuboot_sections.ld @@ -313,7 +313,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32/common/scripts/simple_boot_sections.ld b/boards/xtensa/esp32/common/scripts/simple_boot_sections.ld index 7506fd4397d2f..bf2cbc4f0c66a 100644 --- a/boards/xtensa/esp32/common/scripts/simple_boot_sections.ld +++ b/boards/xtensa/esp32/common/scripts/simple_boot_sections.ld @@ -537,7 +537,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32s2/common/scripts/mcuboot_sections.ld b/boards/xtensa/esp32s2/common/scripts/mcuboot_sections.ld index 19a80ddb9727f..8d739fcd5e76f 100644 --- a/boards/xtensa/esp32s2/common/scripts/mcuboot_sections.ld +++ b/boards/xtensa/esp32s2/common/scripts/mcuboot_sections.ld @@ -337,7 +337,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32s2/common/scripts/simple_boot_sections.ld b/boards/xtensa/esp32s2/common/scripts/simple_boot_sections.ld index 470f0ddf0dea3..af06481df72af 100644 --- a/boards/xtensa/esp32s2/common/scripts/simple_boot_sections.ld +++ b/boards/xtensa/esp32s2/common/scripts/simple_boot_sections.ld @@ -418,7 +418,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld index 927545e78115c..a7555618a9a0a 100644 --- a/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld +++ b/boards/xtensa/esp32s3/common/scripts/legacy_sections.ld @@ -386,10 +386,20 @@ SECTIONS _iram_end = ABSOLUTE(.); } >iram0_0_seg + /* RTC BSS section. */ + + .rtc.bss (NOLOAD) : + { + *(.rtc.bss) + } >rtc_slow_seg + .rtc.data : { + . = ALIGN(4); *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */ diff --git a/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld b/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld index 3eaea7a3fde2e..e7d5ad0ebf0ba 100644 --- a/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld +++ b/boards/xtensa/esp32s3/common/scripts/mcuboot_sections.ld @@ -465,7 +465,9 @@ SECTIONS .rtc.data : { *(.rtc.data) + *(.rtc.data.*) *(.rtc.rodata) + *(.rtc.rodata.*) /* Whatever is left from the RTC memory is used as a special heap. */