Skip to content

Commit 0fbc8bf

Browse files
karlpBOJIT
authored andcommitted
ld: support ".noinit*" uninitialized ram section
Add support for a section(s) ".noinit*" that will be allocated in ram, but not cleared or initialized. This can be used for passing variables between a bootloader and an app for instance, or even just between restarts of your application. Without any assigned usages of the section, there is zero change in ram usage. The align does nothing when the prior section was already aligned.
1 parent 122e126 commit 0fbc8bf

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

ld/linker.ld.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ SECTIONS
118118
. = ALIGN(4);
119119
_etext = .;
120120

121+
/* ram, but not cleared on reset, eg boot/app comms */
122+
.noinit (NOLOAD) : {
123+
*(.noinit*)
124+
} >ram
125+
. = ALIGN(4);
126+
121127
.data : {
122128
_data = .;
123129
*(.data*) /* Read-write initialized data */

lib/cortex-m-generic.ld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ SECTIONS
8989
. = ALIGN(4);
9090
_etext = .;
9191

92+
/* ram, but not cleared on reset, eg boot/app comms */
93+
.noinit (NOLOAD) : {
94+
*(.noinit*)
95+
} >ram
96+
. = ALIGN(4);
97+
9298
.data : {
9399
_data = .;
94100
*(.data*) /* Read-write initialized data */

0 commit comments

Comments
 (0)