1+ /*
2+ * Copyright (c) 2025, Microchip Technology Inc.
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
16/*
27 * Generic Zephyr Linker Script
3- *.
4- * Note: For some of the input sections such as init levels and
5- * data sections and kernel objects needs to be added via
6- * linker script fragment files, At this point, only have added those
7- * input sections required and kept minimal because when adding
8- * linker script linker fragment files, it affects the syntax of
9- * XC-DSC Linker.
108 */
119
1210#include < zephyr/linker/sections.h>
2725#define ROMABLE_REGION program
2826#define RAMABLE_REGION data
2927
30- OUTPUT_ARCH ( " 33AK128MC106 " )
28+
3129CRT0_STARTUP (reset0.S.obj)
3230CRT1_STARTUP(reset1.S.obj)
3331CRT_STARTMODE(crt_start_mode_normal)
34-
3532MEMORY
3633{
3734 /* Memory map from the original target-specific script */
4037 /* Used by and documented in include/linker/intlist.ld */
4138 IDT_LIST (wx) : ORIGIN = 0xFFFFFFFF , LENGTH = 0
4239}
43-
4440SECTIONS
4541{
4642 /* Start of the ROM-based sections */
@@ -55,7 +51,6 @@ SECTIONS
5551 * table and debug information.
5652 */
5753 #include < snippets-rom-start.ld>
58-
5954 } GROUP_LINK_IN (ROMABLE_REGION)
6055
6156 /*
@@ -67,25 +62,41 @@ SECTIONS
6762 SECTION_PROLOGUE (._TEXT_SECTION_NAME ,,)
6863 {
6964 __text_region_start = .;
65+ #include < zephyr/linker/kobject-text.ld>
7066 *(.init );
7167 *(.text );
7268 *(.text *);
7369 *(.user_init );
7470 KEEP (*(.handle ));
7571 KEEP (*(.isr *));
7672 *(.lib *);
77- ___rodata_region_start = .;
78- *(.rodata ) *(.rodata .*)
79- ___rodata_region_end = .;
80- *(.rodata ) /* Read-Only Data */
81- ___static_thread_data_list_start = .;
82- KEEP (*(SORT (.static_thread_data *)))
83- ___static_thread_data_list_end = .;
73+ __text_region_end = .;
8474 . = ALIGN (4 );
8575 } GROUP_LINK_IN (ROMABLE_REGION)
86- __text_region_end = .;
87- ITERABLE_SECTION_ROM_NUMERIC (service, Z_LINK_ITERABLE_SUBALIGN)
76+
77+ ___rodata_region_start = .;
78+ #include < zephyr/linker/common-rom.ld>
79+
80+ /* Located in generated directory. This file is populated by calling
81+ * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs.
82+ */
83+ #include < snippets-rom-sections.ld>
84+ #include < zephyr/linker/thread-local-storage.ld>
85+
86+ SECTION_PROLOGUE (.rodata ,,)
87+ {
88+ *(.rodata )
89+ *(.rodata .*)
90+ /* Located in generated directory. This file is populated by the
91+ * zephyr_linker_sources() Cmake function.
92+ */
93+ #include < snippets-rodata.ld>
94+ #include < zephyr/linker/kobject-rom.ld>
95+ } GROUP_LINK_IN (ROMABLE_REGION)
96+
8897 . = ALIGN (4 );
98+ ___rodata_region_end = .;
99+ #include < zephyr/linker/cplusplus-rom.ld>
89100 GROUP_END (ROMABLE_REGION)
90101
91102 /* Start of the RAM-based sections */
@@ -108,27 +119,32 @@ SECTIONS
108119 __data_region_start = .;
109120 *(.data )
110121 *(" .data.*" )
111- __device_list_start = .;
112- KEEP (*(SORT (.z_device *)))
113- __device_list_end = .;
114- /* Initialization levels: Early -> Application */
115- ___init_EARLY_start = .;
116- KEEP (*(SORT (.init_EARLY *)))
117- ___init_PRE_KERNEL_1_start = .;
118- KEEP (*(SORT (.init_PRE_KERNEL_1 *)))
119- ___init_PRE_KERNEL_2_start = .;
120- KEEP (*(SORT (.init_PRE_KERNEL_2 *)))
121- ___init_POST_KERNEL_start = .;
122- KEEP (*(SORT (.init_POST_KERNEL *)))
123- ___init_APPLICATION_start = .;
124- KEEP (*(SORT (.init_APPLICATION *)))
125- ___init_SMP_start = .;
126- KEEP (*(SORT (.init_SMP *)))
127- ___init_end = .;
128- __data_region_start = .;
122+ *(" .kernel.*" )
129123
124+ /* Located in generated directory. This file is populated by the
125+ * zephyr_linker_sources() Cmake function.
126+ */
127+ #include < snippets-rwdata.ld>
128+ __data_region_end = .;
130129 } GROUP_DATA_LINK_IN (RAMABLE_REGION, ROMABLE_REGION)
131130
131+ #include < zephyr/linker/common-ram.ld>
132+
133+ #include < zephyr/linker/kobject-data.ld>
134+
135+ #include < zephyr/linker/cplusplus-ram.ld>
136+
137+ /* Located in generated directory. This file is populated by the
138+ * zephyr_linker_sources() Cmake function.
139+ */
140+ #include < snippets-data-sections.ld>
141+
142+ /* Located in generated directory. This file is populated by the
143+ * zephyr_linker_sources() Cmake function.
144+ */
145+ #include < snippets-sections.ld>
146+
147+ #include < zephyr/linker/debug-sections.ld>
132148
133149 /*
134150 * This section handles uninitialized data (BSS). It occupies space
@@ -145,7 +161,9 @@ SECTIONS
145161 ___bss_end = .;
146162 } GROUP_LINK_IN (RAMABLE_REGION)
147163
164+
148165 GROUP_END (RAMABLE_REGION)
166+
149167}
150168
151169/*
0 commit comments