|
26 | 26 | #endif |
27 | 27 | #define RAMABLE_REGION RAM |
28 | 28 |
|
29 | | -/* section alignment directive, valid only if not running in XIP mode */ |
30 | | -#ifndef CONFIG_XIP |
31 | | - #define SECTION_ALIGN ALIGN(_region_min_align) |
32 | | -#else |
33 | | - #define SECTION_ALIGN |
34 | | -#endif |
35 | | - |
36 | 29 | #if !defined(CONFIG_XIP) && (CONFIG_FLASH_SIZE == 0) |
37 | 30 | #define ROM_ADDR RAM_ADDR |
38 | 31 | #else |
@@ -80,6 +73,8 @@ _region_min_align = 4; |
80 | 73 | . = ALIGN(_region_min_align) |
81 | 74 | #endif |
82 | 75 |
|
| 76 | +#define BSS_ALIGN ALIGN(_region_min_align) |
| 77 | + |
83 | 78 | MEMORY |
84 | 79 | { |
85 | 80 | FLASH (rx) : ORIGIN = ROM_ADDR, LENGTH = ROM_SIZE |
@@ -266,10 +261,35 @@ SECTIONS |
266 | 261 | _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); |
267 | 262 | #endif /* CONFIG_USERSPACE */ |
268 | 263 |
|
269 | | - . = ALIGN(_region_min_align); |
270 | | - __kernel_ram_start = .; |
| 264 | + SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN) |
| 265 | + { |
| 266 | + /* |
| 267 | + * For performance, BSS section is assumed to be 4 byte aligned and |
| 268 | + * a multiple of 4 bytes |
| 269 | + */ |
| 270 | + . = ALIGN(4); |
| 271 | + __bss_start = .; |
| 272 | + __kernel_ram_start = .; |
271 | 273 |
|
272 | | - SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,SECTION_ALIGN) |
| 274 | + *(.bss) |
| 275 | + *(".bss.*") |
| 276 | + *(COMMON) |
| 277 | + *(".kernel_bss.*") |
| 278 | + |
| 279 | +#ifdef CONFIG_CODE_DATA_RELOCATION |
| 280 | +#include <linker_sram_bss_relocate.ld> |
| 281 | +#endif |
| 282 | + |
| 283 | + /* |
| 284 | + * As memory is cleared in words only, it is simpler to ensure the BSS |
| 285 | + * section ends on a 4 byte boundary. This wastes a maximum of 3 bytes. |
| 286 | + */ |
| 287 | + __bss_end = ALIGN(4); |
| 288 | + } GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) |
| 289 | + |
| 290 | +#include <zephyr/linker/common-noinit.ld> |
| 291 | + |
| 292 | + SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) |
273 | 293 | { |
274 | 294 | __data_region_start = .; |
275 | 295 | __data_start = .; |
@@ -303,29 +323,7 @@ SECTIONS |
303 | 323 | #include <snippets-data-sections.ld> |
304 | 324 |
|
305 | 325 | __data_region_end = .; |
306 | | - . = ALIGN(_region_min_align); |
307 | | - |
308 | | - SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), SECTION_ALIGN) |
309 | | - { |
310 | | - __bss_start = .; |
311 | | - |
312 | | - *(.bss) |
313 | | - *(".bss.*") |
314 | | - *(COMMON) |
315 | | - *(".kernel_bss.*") |
316 | 326 |
|
317 | | -#ifdef CONFIG_CODE_DATA_RELOCATION |
318 | | -#include <linker_sram_bss_relocate.ld> |
319 | | -#endif |
320 | | - |
321 | | - /* |
322 | | - * As memory is cleared in words only, it is simpler to ensure the BSS |
323 | | - * section ends on a 4 byte boundary. This wastes a maximum of 3 bytes. |
324 | | - */ |
325 | | - __bss_end = ALIGN(4); |
326 | | - } GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) |
327 | | - |
328 | | -#include <zephyr/linker/common-noinit.ld> |
329 | 327 |
|
330 | 328 | /* Define linker symbols */ |
331 | 329 |
|
|
0 commit comments