diff options
| author | Sean Cross <sean@xobs.io> | 2020-05-18 11:45:35 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2020-05-18 11:52:20 +0800 |
| commit | 192bb155fafb78b2f6073fdbfbbf41d8c44dc12e (patch) | |
| tree | 86d1db38fa8fa5a17fdc1c09f37a72366e6c82cc | |
| parent | f002c784c0af2272b1fdd5430379bc7775d89743 (diff) | |
nrf: port: move the heap after .uninitialized
Previously, it was placed following .bss. However, now that there is a
new section after .bss, the heap must be moved forward.
Signed-off-by: Sean Cross <sean@xobs.io>
| -rw-r--r-- | ports/nrf/supervisor/port.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 539a9cf90..a0c7be62b 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -177,8 +177,13 @@ void reset_cpu(void) { NVIC_SystemReset(); } +// The uninitialized data section is placed directly after BSS, under the theory +// that Circuit Python has a lot more .data and .bss than the bootloader. As a +// result, this section is less likely to be tampered with by the bootloader. +extern uint32_t _euninitialized; + uint32_t *port_heap_get_bottom(void) { - return port_stack_get_limit(); + return &_euninitialized; } uint32_t *port_heap_get_top(void) { @@ -186,14 +191,13 @@ uint32_t *port_heap_get_top(void) { } uint32_t *port_stack_get_limit(void) { - return &_ebss; + return &_euninitialized; } uint32_t *port_stack_get_top(void) { return &_estack; } -extern uint32_t _ebss; // Place the word to save just after our BSS section that gets blanked. void port_set_saved_word(uint32_t value) { _ebss = value; |
