Skip to content

Commit 3b5f5dd

Browse files
committed
nrf: port: move saved word into .uninitialized section
Circuit Python supports saving a single word of data across reboots. Previously, this data was placed immediately following the .bss. However, this appeared to not work, as Circuit Python zeroes out the heap when it starts up, and the heap begins immediately after the .bss. Switch to using the new .uninitialized section in order to store this word across resets. Signed-off-by: Sean Cross <[email protected]>
1 parent 192bb15 commit 3b5f5dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ports/nrf/supervisor/port.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,14 @@ uint32_t *port_stack_get_top(void) {
198198
return &_estack;
199199
}
200200

201-
// Place the word to save just after our BSS section that gets blanked.
201+
// Place the word in the uninitialized section so it won't get overwritten.
202+
__attribute__((section(".uninitialized"))) uint32_t _saved_word;
202203
void port_set_saved_word(uint32_t value) {
203-
_ebss = value;
204+
_saved_word = value;
204205
}
205206

206207
uint32_t port_get_saved_word(void) {
207-
return _ebss;
208+
return _saved_word;
208209
}
209210

210211
uint64_t port_get_raw_ticks(uint8_t* subticks) {

0 commit comments

Comments
 (0)