diff --git a/boards/qemu/x86/qemu_x86_tiny.ld b/boards/qemu/x86/qemu_x86_tiny.ld index c3188c6e891..548e5fbdcb0 100644 --- a/boards/qemu/x86/qemu_x86_tiny.ld +++ b/boards/qemu/x86/qemu_x86_tiny.ld @@ -420,6 +420,10 @@ SECTIONS lnkr_pinned_rodata_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(pinned.rodata,,) @@ -649,6 +653,10 @@ SECTIONS #ifndef CONFIG_LINKER_USE_PINNED_SECTION #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include #endif diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index ade63dcded7..43750f93d2d 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1182,6 +1182,7 @@ endfunction(zephyr_check_compiler_flag_hardcoded) # ROM_START Inside the first output section of the image. This option is # currently only available on ARM Cortex-M, ARM Cortex-R, # x86, ARC, openisa_rv32m1, and RISC-V. +# ROM_SECTIONS Inside the ROMABLE_REGION GROUP, not initialized. # RAM_SECTIONS Inside the RAMABLE_REGION GROUP, not initialized. # DATA_SECTIONS Inside the RAMABLE_REGION GROUP, initialized. # RAMFUNC_SECTION Inside the RAMFUNC RAMABLE_REGION GROUP, not initialized. @@ -1210,8 +1211,8 @@ endfunction(zephyr_check_compiler_flag_hardcoded) # _mysection_end = .; # _mysection_size = ABSOLUTE(_mysection_end - _mysection_start); # -# When placing into SECTIONS, RAM_SECTIONS or DATA_SECTIONS, the files must -# instead define their own output sections to achieve the same thing: +# When placing into SECTIONS, ROM_SECTIONS, RAM_SECTIONS or DATA_SECTIONS, the +# files must instead define their own output sections to achieve the same thing: # SECTION_PROLOGUE(.mysection,,) # { # _mysection_start = .; @@ -1231,6 +1232,7 @@ function(zephyr_linker_sources location) # the global linker.ld. set(snippet_base "${__build_dir}/include/generated") set(sections_path "${snippet_base}/snippets-sections.ld") + set(rom_sections_path "${snippet_base}/snippets-rom-sections.ld") set(ram_sections_path "${snippet_base}/snippets-ram-sections.ld") set(data_sections_path "${snippet_base}/snippets-data-sections.ld") set(rom_start_path "${snippet_base}/snippets-rom-start.ld") @@ -1250,6 +1252,7 @@ function(zephyr_linker_sources location) get_property(cleared GLOBAL PROPERTY snippet_files_cleared) if (NOT DEFINED cleared) file(WRITE ${sections_path} "") + file(WRITE ${rom_sections_path} "") file(WRITE ${ram_sections_path} "") file(WRITE ${data_sections_path} "") file(WRITE ${rom_start_path} "") @@ -1269,6 +1272,8 @@ function(zephyr_linker_sources location) # Choose destination file, based on the argument. if ("${location}" STREQUAL "SECTIONS") set(snippet_path "${sections_path}") + elseif("${location}" STREQUAL "ROM_SECTIONS") + set(snippet_path "${rom_sections_path}") elseif("${location}" STREQUAL "RAM_SECTIONS") set(snippet_path "${ram_sections_path}") elseif("${location}" STREQUAL "DATA_SECTIONS") diff --git a/include/zephyr/arch/arc/v2/linker.ld b/include/zephyr/arch/arc/v2/linker.ld index c65aa5a6484..c5676991336 100644 --- a/include/zephyr/arch/arc/v2/linker.ld +++ b/include/zephyr/arch/arc/v2/linker.ld @@ -106,6 +106,10 @@ SECTIONS { __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #ifdef __MWDT_LINKER_CMD__ SECTION_DATA_PROLOGUE(tdata,,) { diff --git a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld index cffe2f3856e..f50aadbdfde 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -197,6 +197,10 @@ SECTIONS } GROUP_LINK_IN(ROMABLE_REGION) #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include #include diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 094e4a5303f..fb26e91cf61 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -202,6 +202,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index b360e4417bb..f0d241b9e5b 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -170,6 +170,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/include/zephyr/arch/mips/linker.ld b/include/zephyr/arch/mips/linker.ld index f7479c23e36..caea28e22db 100644 --- a/include/zephyr/arch/mips/linker.ld +++ b/include/zephyr/arch/mips/linker.ld @@ -79,6 +79,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/include/zephyr/arch/nios2/linker.ld b/include/zephyr/arch/nios2/linker.ld index d65805ba7cf..d269bb479a7 100644 --- a/include/zephyr/arch/nios2/linker.ld +++ b/include/zephyr/arch/nios2/linker.ld @@ -143,6 +143,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) { diff --git a/include/zephyr/arch/posix/linker.ld b/include/zephyr/arch/posix/linker.ld index d1f679f6a23..9a0cb1756e1 100644 --- a/include/zephyr/arch/posix/linker.ld +++ b/include/zephyr/arch/posix/linker.ld @@ -34,6 +34,10 @@ SECTION_PROLOGUE(rom_start,,) } GROUP_LINK_IN(ROMABLE_REGION) #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) { diff --git a/include/zephyr/arch/riscv/common/linker.ld b/include/zephyr/arch/riscv/common/linker.ld index 5b996bc48d5..213af16ddc1 100644 --- a/include/zephyr/arch/riscv/common/linker.ld +++ b/include/zephyr/arch/riscv/common/linker.ld @@ -190,6 +190,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/include/zephyr/arch/sparc/linker.ld b/include/zephyr/arch/sparc/linker.ld index ccf333d4863..c609f5130fb 100644 --- a/include/zephyr/arch/sparc/linker.ld +++ b/include/zephyr/arch/sparc/linker.ld @@ -46,6 +46,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/include/zephyr/arch/x86/ia32/linker.ld b/include/zephyr/arch/x86/ia32/linker.ld index 5994379eeef..57101bca820 100644 --- a/include/zephyr/arch/x86/ia32/linker.ld +++ b/include/zephyr/arch/x86/ia32/linker.ld @@ -215,6 +215,10 @@ SECTIONS lnkr_pinned_rodata_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(pinned.rodata,,) @@ -350,6 +354,10 @@ SECTIONS #ifndef CONFIG_LINKER_USE_PINNED_SECTION #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include #endif diff --git a/include/zephyr/arch/x86/intel64/linker.ld b/include/zephyr/arch/x86/intel64/linker.ld index 1bc014570c6..9506b301486 100644 --- a/include/zephyr/arch/x86/intel64/linker.ld +++ b/include/zephyr/arch/x86/intel64/linker.ld @@ -105,6 +105,10 @@ SECTIONS __rodata_region_start = .; #include + /* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ + #include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/soc/andestech/ae350/linker.ld b/soc/andestech/ae350/linker.ld index 9419856a499..ff8da59aebc 100644 --- a/soc/andestech/ae350/linker.ld +++ b/soc/andestech/ae350/linker.ld @@ -156,6 +156,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/soc/cdns/dc233c/include/xtensa-dc233c.ld b/soc/cdns/dc233c/include/xtensa-dc233c.ld index 6ca62979633..fee4ace0282 100644 --- a/soc/cdns/dc233c/include/xtensa-dc233c.ld +++ b/soc/cdns/dc233c/include/xtensa-dc233c.ld @@ -235,6 +235,10 @@ SECTIONS } >RAMABLE_REGION #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include diff --git a/soc/cdns/xtensa_sample_controller/include/xtensa-sample-controller.ld b/soc/cdns/xtensa_sample_controller/include/xtensa-sample-controller.ld index bd93a0861b4..630905c8bc0 100644 --- a/soc/cdns/xtensa_sample_controller/include/xtensa-sample-controller.ld +++ b/soc/cdns/xtensa_sample_controller/include/xtensa-sample-controller.ld @@ -445,6 +445,10 @@ SECTIONS } >RAM :sram0_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .rodata : ALIGN(4) { diff --git a/soc/intel/intel_adsp/ace/ace-link.ld b/soc/intel/intel_adsp/ace/ace-link.ld index f6205a5c77c..a2298b189bb 100644 --- a/soc/intel/intel_adsp/ace/ace-link.ld +++ b/soc/intel/intel_adsp/ace/ace-link.ld @@ -378,6 +378,11 @@ SECTIONS { __common_rom_region_start = SEGSTART_CACHED; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include + __rodata_region_end = .; __common_rom_region_end = .; __rodata_region_end = .; diff --git a/soc/intel/intel_adsp/cavs/include/xtensa-cavs-linker.ld b/soc/intel/intel_adsp/cavs/include/xtensa-cavs-linker.ld index 03109061fc6..97e536a632c 100644 --- a/soc/intel/intel_adsp/cavs/include/xtensa-cavs-linker.ld +++ b/soc/intel/intel_adsp/cavs/include/xtensa-cavs-linker.ld @@ -323,6 +323,10 @@ SECTIONS { #define RAMABLE_REGION RAM #define ROMABLE_REGION RAM #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : { KEEP(*(".fw_ready")); diff --git a/soc/ite/ec/it8xxx2/linker.ld b/soc/ite/ec/it8xxx2/linker.ld index 8143d789d20..a40c97dc3f2 100644 --- a/soc/ite/ec/it8xxx2/linker.ld +++ b/soc/ite/ec/it8xxx2/linker.ld @@ -201,6 +201,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/soc/nxp/imx/imx8/adsp/linker.ld b/soc/nxp/imx/imx8/adsp/linker.ld index caaaf8e60d1..4843d50e57f 100644 --- a/soc/nxp/imx/imx8/adsp/linker.ld +++ b/soc/nxp/imx/imx8/adsp/linker.ld @@ -365,6 +365,10 @@ SECTIONS } >sdram0 :sdram0_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : ALIGN(4) { diff --git a/soc/nxp/imx/imx8m/adsp/linker.ld b/soc/nxp/imx/imx8m/adsp/linker.ld index 6ca8e72982e..35fc7d35251 100644 --- a/soc/nxp/imx/imx8m/adsp/linker.ld +++ b/soc/nxp/imx/imx8m/adsp/linker.ld @@ -371,6 +371,10 @@ SECTIONS } >sdram0 :sdram0_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : ALIGN(4) { diff --git a/soc/nxp/imx/imx8ulp/adsp/linker.ld b/soc/nxp/imx/imx8ulp/adsp/linker.ld index 96bd687917f..f832d9c45da 100644 --- a/soc/nxp/imx/imx8ulp/adsp/linker.ld +++ b/soc/nxp/imx/imx8ulp/adsp/linker.ld @@ -365,6 +365,10 @@ SECTIONS } >sdram0 :sdram0_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : ALIGN(4) { diff --git a/soc/nxp/imx/imx8x/adsp/linker.ld b/soc/nxp/imx/imx8x/adsp/linker.ld index caaaf8e60d1..4843d50e57f 100644 --- a/soc/nxp/imx/imx8x/adsp/linker.ld +++ b/soc/nxp/imx/imx8x/adsp/linker.ld @@ -365,6 +365,10 @@ SECTIONS } >sdram0 :sdram0_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : ALIGN(4) { diff --git a/soc/nxp/imx/imx9/a55/linker.ld b/soc/nxp/imx/imx9/a55/linker.ld index 3c8f5ba6e74..f373c6feec2 100644 --- a/soc/nxp/imx/imx9/a55/linker.ld +++ b/soc/nxp/imx/imx9/a55/linker.ld @@ -161,6 +161,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) diff --git a/soc/nxp/imxrt/imxrt5xx/f1/linker.ld b/soc/nxp/imxrt/imxrt5xx/f1/linker.ld index de1e8984653..0a3058b6d9b 100644 --- a/soc/nxp/imxrt/imxrt5xx/f1/linker.ld +++ b/soc/nxp/imxrt/imxrt5xx/f1/linker.ld @@ -326,6 +326,10 @@ SECTIONS } >iram_text_start :iram_text_start_phdr #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include .fw_ready : ALIGN(4) { diff --git a/soc/openisa/rv32m1/linker.ld b/soc/openisa/rv32m1/linker.ld index b81a77868a9..dbd19fcb805 100644 --- a/soc/openisa/rv32m1/linker.ld +++ b/soc/openisa/rv32m1/linker.ld @@ -125,6 +125,10 @@ SECTIONS __rodata_region_start = .; #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include #include SECTION_PROLOGUE(_RODATA_SECTION_NAME,,)