Skip to content

Commit 77a62d1

Browse files
billwatersiiijhedberg
authored andcommitted
linker: noint memory region location
- There are linker file directives that must come at the start of the noinit region. For example, the directive that allow that section to not exist in RAM before a certain address (. = MAX(ABSOLUTE(.), 0x34002000);). - Before this update, those could only be added to the end of that region. They will now have the option to be at the beginning or the end. Signed-off-by: Bill Waters <[email protected]>
1 parent e18cf0c commit 77a62d1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

arch/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,16 @@ config USERSPACE
316316
privileged mode or handling a system call; to ensure these are always
317317
caught, enable CONFIG_HW_STACK_PROTECTION.
318318

319+
config NOINIT_SNIPPET_FIRST
320+
bool "Place the no-init linker script snippet first"
321+
help
322+
By default the include/zephyr/linker/common-noinit.ld file inserts the
323+
snippets-noinit.ld file at the end of the section. There are times when
324+
the directives in the snippets-noinit.ld file apply to the other directives
325+
in this file. And in that case the include statement for the snippets-noinit.ld
326+
file needs to come at the start of the section. This configuration option
327+
allows that to happen.
328+
319329
config PRIVILEGED_STACK_SIZE
320330
int "Size of privileged stack"
321331
default 2048 if EMUL

include/zephyr/linker/common-noinit.ld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ SECTION_PROLOGUE(_NOINIT_SECTION_NAME,(NOLOAD),)
1111
* This section is used for non-initialized objects that
1212
* will not be cleared during the boot process.
1313
*/
14+
15+
/* Located in generated directory. This file is populated by the
16+
* zephyr_linker_sources() Cmake function.
17+
*/
18+
#ifdef CONFIG_NOINIT_SNIPPET_FIRST
19+
#include <snippets-noinit.ld>
20+
#endif
21+
1422
*(.noinit)
1523
*(".noinit.*")
1624
#ifdef CONFIG_USERSPACE
@@ -22,7 +30,9 @@ SECTION_PROLOGUE(_NOINIT_SECTION_NAME,(NOLOAD),)
2230
/* Located in generated directory. This file is populated by the
2331
* zephyr_linker_sources() Cmake function.
2432
*/
33+
#ifndef CONFIG_NOINIT_SNIPPET_FIRST
2534
#include <snippets-noinit.ld>
35+
#endif
2636

2737
} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
2838

0 commit comments

Comments
 (0)