File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -477,7 +477,7 @@ void gc_collect(void) {
477477
478478 // This naively collects all object references from an approximate stack
479479 // range.
480- gc_collect_root ((void * * )sp , ((uint32_t )& _estack - sp ) / sizeof (uint32_t ));
480+ gc_collect_root ((void * * )sp , ((uint32_t )port_stack_get_top () - sp ) / sizeof (uint32_t ));
481481 gc_collect_end ();
482482}
483483
Original file line number Diff line number Diff line change 2525 */
2626
2727#include "supervisor/memory.h"
28+ #include "supervisor/port.h"
2829
2930#include <stddef.h>
3031
@@ -36,12 +37,10 @@ static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT];
3637// We use uint32_t* to ensure word (4 byte) alignment.
3738uint32_t * low_address ;
3839uint32_t * high_address ;
39- extern uint32_t _ebss ;
40- extern uint32_t _estack ;
4140
4241void memory_init (void ) {
43- low_address = & _ebss ;
44- high_address = & _estack ;
42+ low_address = port_stack_get_limit () ;
43+ high_address = port_stack_get_top () ;
4544}
4645
4746void free_memory (supervisor_allocation * allocation ) {
Original file line number Diff line number Diff line change 2929#include "py/mpconfig.h"
3030#include "py/runtime.h"
3131#include "supervisor/cpu.h"
32+ #include "supervisor/port.h"
3233#include "supervisor/shared/safe_mode.h"
3334
3435extern uint32_t _estack ;
@@ -43,7 +44,7 @@ void allocate_stack(void) {
4344 mp_uint_t regs [10 ];
4445 mp_uint_t sp = cpu_get_regs_and_sp (regs );
4546
46- mp_uint_t c_size = (uint32_t ) & _estack - sp ;
47+ mp_uint_t c_size = (uint32_t ) port_stack_get_top () - sp ;
4748
4849 stack_alloc = allocate_memory (c_size + next_stack_size + EXCEPTION_STACK_SIZE , true);
4950 if (stack_alloc == NULL ) {
You can’t perform that action at this time.
0 commit comments