From f002c784c0af2272b1fdd5430379bc7775d89743 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 18 May 2020 11:43:21 +0800 Subject: [PATCH] nrf: linker: add a new .uninitialized section This section immediately follows the .bss section, and is designed to contain uninitialized variables that should persist across reboots. The section is placed directly after .bss, under the theory that the size of Circuit Python's .bss + .data is bigger than the bootloader's .bss + .data, so there is less likely to be a conflict. Signed-off-by: Sean Cross --- ports/nrf/boards/common.template.ld | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ports/nrf/boards/common.template.ld b/ports/nrf/boards/common.template.ld index a2bbf0ec80..9a7df69a47 100644 --- a/ports/nrf/boards/common.template.ld +++ b/ports/nrf/boards/common.template.ld @@ -103,7 +103,7 @@ SECTIONS _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ } >RAM - /* Uninitialized data section */ + /* Zero-initialized data section */ .bss : { . = ALIGN(4); @@ -116,6 +116,19 @@ SECTIONS _ebss = .; /* define a global symbol at bss end; used by startup code and GC */ } >RAM + /* Uninitialized data section + Data placed into this section will remain unchanged across reboots. */ + .uninitialized (NOLOAD) : + { + . = ALIGN(4); + _suninitialized = .; /* define a global symbol at uninitialized start; currently unused */ + *(.uninitialized) + *(.uninitialized*) + + . = ALIGN(4); + _euninitialized = .; /* define a global symbol at uninitialized end; currently unused */ + } >RAM + /* this is to define the start of the heap, and make sure we have a minimum size */ .heap : {