20
20
21
21
ENTRY (CONFIG_KERNEL_ENTRY )
22
22
23
- #if CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE != 0
24
- _HEAP_SIZE = CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE;
25
- #else
26
- _HEAP_SIZE = 32K;
27
- #endif
28
-
29
23
SECTIONS
30
24
{
31
25
32
26
#include <zephyr/linker/rel-sections.ld>
27
+
28
+ #ifdef CONFIG_LLEXT
29
+ #include <zephyr/linker/llext-sections.ld>
30
+ #endif
31
+
32
+ GROUP_START(ROMABLE_REGION)
33
+
33
34
SECTION_PROLOGUE(.text,,)
34
35
{
35
36
/* microblaze vectors from 0x0 to 0x50 */
@@ -55,7 +56,7 @@ SECTIONS
55
56
__text_region_end = .;
56
57
__text_region_size = __text_region_end - __text_region_start;
57
58
58
- SECTION_PROLOGUE (_EXCEPTION_SECTION_NAME,,)
59
+ SECTION_DATA_PROLOGUE (_EXCEPTION_SECTION_NAME,,)
59
60
{
60
61
KEEP(*(".exception.entry.*"))
61
62
*(".exception.other.*")
@@ -80,8 +81,11 @@ SECTIONS
80
81
__rodata_region_start = .;
81
82
82
83
#include <zephyr/linker/common-rom.ld>
84
+ /* Located in generated directory. This file is populated by calling
85
+ * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs.
86
+ */
87
+ #include <snippets-rom-sections.ld>
83
88
#include <zephyr/linker/thread-local-storage.ld>
84
- #include <zephyr/linker/cplusplus-rom.ld>
85
89
86
90
SECTION_PROLOGUE(.rodata,,)
87
91
{
@@ -91,14 +95,40 @@ SECTIONS
91
95
*(.rodata.*)
92
96
*(.gnu.linkonce.r.*)
93
97
98
+ /* Located in generated directory. This file is populated by the
99
+ * zephyr_linker_sources() Cmake function.
100
+ */
94
101
#include <snippets-rodata.ld>
95
102
96
103
} GROUP_LINK_IN(ROMABLE_REGION)
97
104
98
105
#include <zephyr/linker/cplusplus-rom.ld>
99
106
107
+ __rodata_end = .;
108
+ __rodata_region_end = .;
109
+ __rodata_region_size = __rodata_region_end - __rodata_region_start;
110
+
111
+ GROUP_END(ROMABLE_REGION)
112
+
113
+ GROUP_START(RAMABLE_REGION)
114
+
115
+ _image_ram_start = .;
116
+
100
117
#ifdef CONFIG_CPP
101
- .dtors : {
118
+ /* These exist to keep Vitis Microblaze toolchain happy */
119
+ SECTION_PROLOGUE(.ctors,,)
120
+ {
121
+ __CTOR_LIST__ = .;
122
+ ___CTORS_LIST___ = .;
123
+ KEEP (*crtbegin.o (.ctors))
124
+ KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
125
+ KEEP (*(SORT(.ctors.*)))
126
+ KEEP (*(.ctors))
127
+ __CTOR_END__ = .;
128
+ ___CTORS_END___ = .;
129
+ } GROUP_LINK_IN(RAMABLE_REGION)
130
+ SECTION_PROLOGUE(.dtors,,)
131
+ {
102
132
__DTOR_LIST__ = .;
103
133
___DTORS_LIST___ = .;
104
134
KEEP (*crtbegin.o (.dtors))
@@ -107,14 +137,10 @@ SECTIONS
107
137
KEEP (*(.dtors))
108
138
PROVIDE (__DTOR_END__ = .);
109
139
PROVIDE (___DTORS_END___ = .);
110
- } > app_ram
140
+ } GROUP_LINK_IN(RAMABLE_REGION)
111
141
#endif
112
142
113
- __rodata_end = .;
114
- __rodata_region_end = .;
115
- __rodata_region_size = __rodata_region_end - __rodata_region_start;
116
-
117
- SECTION_PROLOGUE(.sdata2,,)
143
+ SECTION_DATA_PROLOGUE(.sdata2,,)
118
144
{
119
145
. = ALIGN (4);
120
146
__sdata2_start = .;
@@ -126,8 +152,10 @@ SECTIONS
126
152
} GROUP_LINK_IN(RAMABLE_REGION)
127
153
128
154
#include <zephyr/linker/common-ram.ld>
155
+ #include <zephyr/linker/kobject-data.ld>
156
+ #include <zephyr/linker/cplusplus-ram.ld>
129
157
130
- SECTION_PROLOGUE (.data,,)
158
+ SECTION_DATA_PROLOGUE (.data,,)
131
159
{
132
160
. = ALIGN (4);
133
161
__data_start = .;
@@ -142,13 +170,14 @@ SECTIONS
142
170
#include <snippets-ram-sections.ld>
143
171
} GROUP_LINK_IN(RAMABLE_REGION)
144
172
173
+ /* Located in generated directory. This file is populated by the
174
+ * zephyr_linker_sources() Cmake function.
175
+ */
145
176
#include <snippets-data-sections.ld>
146
177
147
178
__data_end = .;
148
179
__data_size = __data_end - __data_start;
149
180
150
- #include <zephyr/linker/cplusplus-ram.ld>
151
-
152
181
SECTION_PROLOGUE(.got,,)
153
182
{
154
183
. = ALIGN (4);
@@ -173,7 +202,7 @@ SECTIONS
173
202
*(.jcr)
174
203
} GROUP_LINK_IN(RAMABLE_REGION)
175
204
176
- SECTION_PROLOGUE (.sdata,,)
205
+ SECTION_DATA_PROLOGUE (.sdata,,)
177
206
{
178
207
. = ALIGN (4);
179
208
__sdata_start = .;
@@ -198,7 +227,7 @@ SECTIONS
198
227
_gp = (__sbss_end + __sdata_start) / 2;
199
228
PROVIDE (gp = _gp);
200
229
201
- SECTION_PROLOGUE (.tdata,,)
230
+ SECTION_DATA_PROLOGUE (.tdata,,)
202
231
{
203
232
. = ALIGN (4);
204
233
__tdata_start = .;
@@ -243,14 +272,29 @@ SECTIONS
243
272
244
273
#include <snippets-sections.ld>
245
274
246
- #include <zephyr/linker/debug-sections.ld>
247
-
275
+ /* Vitis Microblaze toolchain may moan without these sections,
276
+ * but we won't give them any space. Zephyr creates its malloc arena
277
+ * after _end. These are in case someone tries to use Vitis GCC with
278
+ * its _HEAP_SIZE and _STACK_SIZE definitions. e.g. during migration
279
+ * I'm making the linker moan so that you now know better than to rely
280
+ * on those values in Zephyr world.
281
+ */
282
+ _HEAP_SIZE = DEFINED (_HEAP_SIZE) ? -_HEAP_SIZE : 0;
283
+ _STACK_SIZE = DEFINED (_STACK_SIZE) ? -_STACK_SIZE : 0;
248
284
SECTION_PROLOGUE(.heap (NOLOAD),,)
249
285
{
250
286
. += _HEAP_SIZE;
251
- . = ALIGN (4);
252
287
} GROUP_LINK_IN(RAMABLE_REGION)
253
288
254
- _end = .;
289
+ SECTION_PROLOGUE(.stack (NOLOAD),,)
290
+ {
291
+ . += _STACK_SIZE;
292
+ } GROUP_LINK_IN(RAMABLE_REGION)
293
+
294
+ #include <zephyr/linker/ram-end.ld>
295
+
296
+ GROUP_END(RAMABLE_REGION)
297
+
298
+ #include <zephyr/linker/debug-sections.ld>
255
299
256
300
}
0 commit comments