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 9d4c615d93..a71dce5f74 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 87049498d0..6eca605229 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 d93020dd9d..561f3c958d 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 522befd967..c477ad543b 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 951ef2b75c..f28f57f25c 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 c61da8a5b5..d33cee9339 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 da36517943..25a6528a79 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 7506fd4397..bf2cbc4f0c 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 19a80ddb97..8d739fcd5e 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 470f0ddf0d..af06481df7 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 927545e781..a7555618a9 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 3eaea7a3fd..e7d5ad0ebf 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. */