From c12f9fb40396f8f4526db98893292c3ec8e4b4d1 Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Fri, 6 Dec 2024 15:32:44 +0100 Subject: [PATCH 1/2] Fix rodata reservation. --- components/esp_system/ld/esp32c2/sections.ld.in | 2 +- components/esp_system/ld/esp32c3/sections.ld.in | 7 ++++++- components/esp_system/ld/esp32c6/sections.ld.in | 7 ++++++- components/esp_system/ld/esp32c61/sections.ld.in | 8 +++++++- components/esp_system/ld/esp32h2/sections.ld.in | 7 ++++++- components/esp_system/ld/esp32p4/sections.ld.in | 8 +++++++- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/components/esp_system/ld/esp32c2/sections.ld.in b/components/esp_system/ld/esp32c2/sections.ld.in index 6f9eb5638cdd..17e064758bf5 100644 --- a/components/esp_system/ld/esp32c2/sections.ld.in +++ b/components/esp_system/ld/esp32c2/sections.ld.in @@ -297,7 +297,7 @@ SECTIONS * NOLOAD rodata may not be included in this section. */ . += _esp_rodata_section_padding; - _rodata_reserved_end = ADDR(.flash.tbss); + _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding; mapping[rodata_noload] } > default_rodata_seg diff --git a/components/esp_system/ld/esp32c3/sections.ld.in b/components/esp_system/ld/esp32c3/sections.ld.in index 2c617dfbec3d..f81d8b2a586d 100644 --- a/components/esp_system/ld/esp32c3/sections.ld.in +++ b/components/esp_system/ld/esp32c3/sections.ld.in @@ -414,8 +414,13 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ . += _esp_rodata_section_padding; - _rodata_reserved_end = ADDR(.flash.tbss); + _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding; mapping[rodata_noload] } > default_rodata_seg diff --git a/components/esp_system/ld/esp32c6/sections.ld.in b/components/esp_system/ld/esp32c6/sections.ld.in index 199b5c3aa245..daa74dc6de42 100644 --- a/components/esp_system/ld/esp32c6/sections.ld.in +++ b/components/esp_system/ld/esp32c6/sections.ld.in @@ -427,8 +427,13 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ . += _esp_rodata_section_padding; - _rodata_reserved_end = ADDR(.flash.tbss); + _rodata_reserved_end = ADDR(.flash.tbss) + _eps_rodata_section_padding; mapping[rodata_noload] } > default_rodata_seg diff --git a/components/esp_system/ld/esp32c61/sections.ld.in b/components/esp_system/ld/esp32c61/sections.ld.in index 54673f7a822a..740ac217942b 100644 --- a/components/esp_system/ld/esp32c61/sections.ld.in +++ b/components/esp_system/ld/esp32c61/sections.ld.in @@ -437,7 +437,13 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ - _rodata_reserved_end = ADDR(.flash.tbss); + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ + . += _esp_rodata_section_padding; + _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding; mapping[rodata_noload] } > default_rodata_seg diff --git a/components/esp_system/ld/esp32h2/sections.ld.in b/components/esp_system/ld/esp32h2/sections.ld.in index 199b5c3aa245..c34d47f03af9 100644 --- a/components/esp_system/ld/esp32h2/sections.ld.in +++ b/components/esp_system/ld/esp32h2/sections.ld.in @@ -427,8 +427,13 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ . += _esp_rodata_section_padding; - _rodata_reserved_end = ADDR(.flash.tbss); + _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding; mapping[rodata_noload] } > default_rodata_seg diff --git a/components/esp_system/ld/esp32p4/sections.ld.in b/components/esp_system/ld/esp32p4/sections.ld.in index ef288b49a955..7f7c3c4a426b 100644 --- a/components/esp_system/ld/esp32p4/sections.ld.in +++ b/components/esp_system/ld/esp32p4/sections.ld.in @@ -469,7 +469,13 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ - _rodata_reserved_end = ADDR(.flash.tbss); + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ + . += _esp_rodata_section_padding; + _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding; arrays[rodata_noload] mapping[rodata_noload] From 5d07f2bedd1762000af22f277e3902d9020a7e88 Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Fri, 6 Dec 2024 16:34:30 +0100 Subject: [PATCH 2/2] Feedback. --- components/esp_system/ld/esp32c2/sections.ld.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/esp_system/ld/esp32c2/sections.ld.in b/components/esp_system/ld/esp32c2/sections.ld.in index 17e064758bf5..22e2980b9e36 100644 --- a/components/esp_system/ld/esp32c2/sections.ld.in +++ b/components/esp_system/ld/esp32c2/sections.ld.in @@ -296,6 +296,11 @@ SECTIONS * driver to maintain the virtual address. * NOLOAD rodata may not be included in this section. */ + /** + * Toit: add padding. + * Not completely sure this is the correct way of doing this, but we need to + * reserve space for the Toit containers. + */ . += _esp_rodata_section_padding; _rodata_reserved_end = ADDR(.flash.tbss) + _esp_rodata_section_padding;