diff options
| author | Sean Cross <sean@xobs.io> | 2020-05-18 11:46:38 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2020-05-18 11:52:25 +0800 |
| commit | 3b5f5ddaa6232a8d3ac868c703e8a511abe045e0 (patch) | |
| tree | 4e5b5bcc271942977cdba9363f44a8ffb54b7a72 | |
| parent | 192bb155fafb78b2f6073fdbfbbf41d8c44dc12e (diff) | |
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 <sean@xobs.io>
| -rw-r--r-- | ports/nrf/supervisor/port.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index a0c7be62b..3a76fa878 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -198,13 +198,14 @@ uint32_t *port_stack_get_top(void) { return &_estack; } -// Place the word to save just after our BSS section that gets blanked. +// Place the word in the uninitialized section so it won't get overwritten. +__attribute__((section(".uninitialized"))) uint32_t _saved_word; void port_set_saved_word(uint32_t value) { - _ebss = value; + _saved_word = value; } uint32_t port_get_saved_word(void) { - return _ebss; + return _saved_word; } uint64_t port_get_raw_ticks(uint8_t* subticks) { |
