From 8454aefc256445d55a603de568d453f826a60cc4 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 21 Aug 2024 18:18:20 +0700 Subject: [PATCH] fix(esp_system): avoid placing sections between ASSERT_SECTIONS_GAP checks --- .../esp_system/ld/esp32c5/sections.ld.in | 78 +++++++++---------- .../esp_system/ld/esp32c61/sections.ld.in | 78 +++++++++---------- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/components/esp_system/ld/esp32c5/sections.ld.in b/components/esp_system/ld/esp32c5/sections.ld.in index 9e91ed9e7e..5b2ce27ed2 100644 --- a/components/esp_system/ld/esp32c5/sections.ld.in +++ b/components/esp_system/ld/esp32c5/sections.ld.in @@ -382,45 +382,6 @@ SECTIONS } > default_rodata_seg ASSERT_SECTIONS_GAP(.flash.rodata, SECTION_AFTER_FLASH_RODATA) - /* External RAM */ - /** - * This section is required to skip flash sections, because `extern_ram_seg` - * and `drom_seg` / `irom_seg` are on the same bus when app build use flash sections - */ - .ext_ram.dummy (NOLOAD): - { - . = ORIGIN(extern_ram_seg); - . = . + (_rodata_reserved_end - _flash_rodata_dummy_start); - . = ALIGN (_esp_mmu_page_size); - } > extern_ram_seg - -#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - /* This section holds .ext_ram.bss data, and will be put in PSRAM */ - .ext_ram.bss (NOLOAD) : - { - _ext_ram_bss_start = ABSOLUTE(.); - - mapping[extern_ram] - - ALIGNED_SYMBOL(4, _ext_ram_bss_end) - } > extern_ram_seg -#endif //CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - -#if CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY - /** - * This section holds data that won't be initialised when startup. - * This section locates in External RAM region. - */ - .ext_ram_noinit (NOLOAD) : - { - _ext_ram_noinit_start = ABSOLUTE(.); - - *(.ext_ram_noinit*) - - ALIGNED_SYMBOL(4, _ext_ram_noinit_end) - } > extern_ram_seg -#endif //CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY - #if EH_FRAME_LINKING_ENABLED .eh_frame_hdr : { @@ -495,6 +456,45 @@ SECTIONS ALIGNED_SYMBOL(16, _heap_start) } > sram_seg + /* External RAM */ + /** + * This section is required to skip flash sections, because `extern_ram_seg` + * and `drom_seg` / `irom_seg` are on the same bus when app build use flash sections + */ + .ext_ram.dummy (NOLOAD): + { + . = ORIGIN(extern_ram_seg); + . = . + (_rodata_reserved_end - _flash_rodata_dummy_start); + . = ALIGN (_esp_mmu_page_size); + } > extern_ram_seg + +#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY + /* This section holds .ext_ram.bss data, and will be put in PSRAM */ + .ext_ram.bss (NOLOAD) : + { + _ext_ram_bss_start = ABSOLUTE(.); + + mapping[extern_ram] + + ALIGNED_SYMBOL(4, _ext_ram_bss_end) + } > extern_ram_seg +#endif //CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY + +#if CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY + /** + * This section holds data that won't be initialised when startup. + * This section locates in External RAM region. + */ + .ext_ram_noinit (NOLOAD) : + { + _ext_ram_noinit_start = ABSOLUTE(.); + + *(.ext_ram_noinit*) + + ALIGNED_SYMBOL(4, _ext_ram_noinit_end) + } > extern_ram_seg +#endif //CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY + #include "elf_misc.ld.in" } diff --git a/components/esp_system/ld/esp32c61/sections.ld.in b/components/esp_system/ld/esp32c61/sections.ld.in index f1e6972431..91023d3855 100644 --- a/components/esp_system/ld/esp32c61/sections.ld.in +++ b/components/esp_system/ld/esp32c61/sections.ld.in @@ -240,45 +240,6 @@ SECTIONS } > default_rodata_seg ASSERT_SECTIONS_GAP(.flash.rodata, SECTION_AFTER_FLASH_RODATA) - /* External RAM */ - /** - * This section is required to skip flash sections, because `extern_ram_seg` - * and `drom_seg` / `irom_seg` are on the same bus when app build use flash sections - */ - .ext_ram.dummy (NOLOAD): - { - . = ORIGIN(extern_ram_seg); - . = . + (_rodata_reserved_end - _flash_rodata_dummy_start); - . = ALIGN (_esp_mmu_page_size); - } > extern_ram_seg - -#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - /* This section holds .ext_ram.bss data, and will be put in PSRAM */ - .ext_ram.bss (NOLOAD) : - { - _ext_ram_bss_start = ABSOLUTE(.); - - mapping[extern_ram] - - ALIGNED_SYMBOL(4, _ext_ram_bss_end) - } > extern_ram_seg -#endif //CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - -#if CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY - /** - * This section holds data that won't be initialized when startup. - * This section locates in External RAM region. - */ - .ext_ram_noinit (NOLOAD) : - { - _ext_ram_noinit_start = ABSOLUTE(.); - - *(.ext_ram_noinit*) - - ALIGNED_SYMBOL(4, _ext_ram_noinit_end) - } > extern_ram_seg -#endif //CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY - #if EH_FRAME_LINKING_ENABLED .eh_frame_hdr : { @@ -353,6 +314,45 @@ SECTIONS ALIGNED_SYMBOL(16, _heap_start) } > sram_seg + /* External RAM */ + /** + * This section is required to skip flash sections, because `extern_ram_seg` + * and `drom_seg` / `irom_seg` are on the same bus when app build use flash sections + */ + .ext_ram.dummy (NOLOAD): + { + . = ORIGIN(extern_ram_seg); + . = . + (_rodata_reserved_end - _flash_rodata_dummy_start); + . = ALIGN (_esp_mmu_page_size); + } > extern_ram_seg + +#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY + /* This section holds .ext_ram.bss data, and will be put in PSRAM */ + .ext_ram.bss (NOLOAD) : + { + _ext_ram_bss_start = ABSOLUTE(.); + + mapping[extern_ram] + + ALIGNED_SYMBOL(4, _ext_ram_bss_end) + } > extern_ram_seg +#endif //CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY + +#if CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY + /** + * This section holds data that won't be initialized when startup. + * This section locates in External RAM region. + */ + .ext_ram_noinit (NOLOAD) : + { + _ext_ram_noinit_start = ABSOLUTE(.); + + *(.ext_ram_noinit*) + + ALIGNED_SYMBOL(4, _ext_ram_noinit_end) + } > extern_ram_seg +#endif //CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY + #include "elf_misc.ld.in" }