@@ -346,56 +346,6 @@ SECTIONS
346346
347347 __data_region_end = .;
348348
349- #ifndef CONFIG_USERSPACE
350- SECTION_DATA_PROLOGUE (_BSS_SECTION_NAME,(NOLOAD),)
351- {
352- /*
353- * For performance, BSS section is assumed to be 4 byte aligned and
354- * a multiple of 4 bytes
355- */
356- . = ALIGN (4 );
357- __bss_start = .;
358- __kernel_ram_start = .;
359-
360- *(.bss )
361- *(" .bss.*" )
362- *(COMMON)
363- *(" .kernel_bss.*" )
364-
365- #ifdef CONFIG_CODE_DATA_RELOCATION
366- #include < linker_sram_bss_relocate.ld>
367- #endif
368-
369- /*
370- * As memory is cleared in words only, it is simpler to ensure the BSS
371- * section ends on a 4 byte boundary. This wastes a maximum of 3 bytes.
372- */
373- __bss_end = ALIGN (4 );
374- } GROUP_DATA_LINK_IN (RAMABLE_REGION, RAMABLE_REGION)
375-
376- SECTION_PROLOGUE (_NOINIT_SECTION_NAME,(NOLOAD),)
377- {
378- /*
379- * This section is used for non-initialized objects that
380- * will not be cleared during the boot process.
381- */
382- *(.noinit )
383- *(" .noinit.*" )
384- *(" .kernel_noinit.*" )
385-
386- /* Located in generated directory. This file is populated by the
387- * zephyr_linker_sources() Cmake function.
388- */
389- #include < snippets-noinit.ld>
390-
391- } GROUP_NOLOAD_LINK_IN (RAMABLE_REGION, RAMABLE_REGION)
392- #endif /* CONFIG_USERSPACE */
393-
394- /* Define linker symbols */
395-
396- __kernel_ram_end = RAM_ADDR + RAM_SIZE;
397- __kernel_ram_size = __kernel_ram_end - __kernel_ram_start;
398-
399349#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay)
400350GROUP_START (ITCM)
401351
@@ -463,10 +413,6 @@ GROUP_END(DTCM)
463413 */
464414#include < snippets-sections.ld>
465415
466- #include < zephyr/linker/ram-end.ld>
467-
468- GROUP_END (RAMABLE_REGION)
469-
470416#include < zephyr/linker/debug-sections.ld>
471417
472418 /DISCARD/ : { *(.note .GNU -stack) }
@@ -503,4 +449,58 @@ SECTION_PROLOGUE(.last_section,,)
503449 * calculate this value here. */
504450_flash_used = LOADADDR (.last_section ) + SIZEOF (.last_section ) - __rom_region_start;
505451
452+ #ifndef CONFIG_USERSPACE
453+ SECTION_DATA_PROLOGUE (_BSS_SECTION_NAME,(NOLOAD),)
454+ {
455+ /*
456+ * For performance, BSS section is assumed to be 4 byte aligned and
457+ * a multiple of 4 bytes
458+ */
459+ . = ALIGN (4 );
460+ __bss_start = .;
461+ __kernel_ram_start = .;
462+
463+ *(.bss )
464+ *(" .bss.*" )
465+ *(COMMON)
466+ *(" .kernel_bss.*" )
467+
468+ #ifdef CONFIG_CODE_DATA_RELOCATION
469+ #include < linker_sram_bss_relocate.ld>
470+ #endif
471+
472+ /*
473+ * As memory is cleared in words only, it is simpler to ensure the BSS
474+ * section ends on a 4 byte boundary. This wastes a maximum of 3 bytes.
475+ */
476+ __bss_end = ALIGN (4 );
477+ } GROUP_DATA_LINK_IN (RAMABLE_REGION, RAMABLE_REGION)
478+
479+ SECTION_PROLOGUE (_NOINIT_SECTION_NAME,(NOLOAD),)
480+ {
481+ /*
482+ * This section is used for non-initialized objects that
483+ * will not be cleared during the boot process.
484+ */
485+ *(.noinit )
486+ *(" .noinit.*" )
487+ *(" .kernel_noinit.*" )
488+
489+ /* Located in generated directory. This file is populated by the
490+ * zephyr_linker_sources() Cmake function.
491+ */
492+ #include < snippets-noinit.ld>
493+
494+ } GROUP_NOLOAD_LINK_IN (RAMABLE_REGION, RAMABLE_REGION)
495+ #endif /* CONFIG_USERSPACE */
496+
497+ /* Define linker symbols */
498+
499+ __kernel_ram_end = RAM_ADDR + RAM_SIZE;
500+ __kernel_ram_size = __kernel_ram_end - __kernel_ram_start;
501+
502+ #include < zephyr/linker/ram-end.ld>
503+
504+ GROUP_END (RAMABLE_REGION)
505+
506506 }
0 commit comments