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.
This commit is contained in:
Karl Palsson 2020-10-11 22:39:00 +00:00
parent 1acfa1c917
commit 54319107b0
2 changed files with 12 additions and 0 deletions

View File

@ -118,6 +118,12 @@ SECTIONS
. = ALIGN(4);
_etext = .;
/* ram, but not cleared on reset, eg boot/app comms */
.noinit (NOLOAD) : {
*(.noinit*)
} >ram
. = ALIGN(4);
.data : {
_data = .;
*(.data*) /* Read-write initialized data */

View File

@ -89,6 +89,12 @@ SECTIONS
. = ALIGN(4);
_etext = .;
/* ram, but not cleared on reset, eg boot/app comms */
.noinit (NOLOAD) : {
*(.noinit*)
} >ram
. = ALIGN(4);
.data : {
_data = .;
*(.data*) /* Read-write initialized data */