Browse Source

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.
pull/1274/head
Karl Palsson 4 years ago
parent
commit
54319107b0
  1. 6
      ld/linker.ld.S
  2. 6
      lib/cortex-m-generic.ld

6
ld/linker.ld.S

@ -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 */

6
lib/cortex-m-generic.ld

@ -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 */

Loading…
Cancel
Save