Skip to content

Commit 192bb15

Browse files
committed
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 <[email protected]>
1 parent f002c78 commit 192bb15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ports/nrf/supervisor/port.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,23 +177,27 @@ void reset_cpu(void) {
177177
NVIC_SystemReset();
178178
}
179179

180+
// The uninitialized data section is placed directly after BSS, under the theory
181+
// that Circuit Python has a lot more .data and .bss than the bootloader. As a
182+
// result, this section is less likely to be tampered with by the bootloader.
183+
extern uint32_t _euninitialized;
184+
180185
uint32_t *port_heap_get_bottom(void) {
181-
return port_stack_get_limit();
186+
return &_euninitialized;
182187
}
183188

184189
uint32_t *port_heap_get_top(void) {
185190
return port_stack_get_top();
186191
}
187192

188193
uint32_t *port_stack_get_limit(void) {
189-
return &_ebss;
194+
return &_euninitialized;
190195
}
191196

192197
uint32_t *port_stack_get_top(void) {
193198
return &_estack;
194199
}
195200

196-
extern uint32_t _ebss;
197201
// Place the word to save just after our BSS section that gets blanked.
198202
void port_set_saved_word(uint32_t value) {
199203
_ebss = value;

0 commit comments

Comments
 (0)