diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-04-17 16:23:28 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-05-15 15:36:16 -0700 |
| commit | 6aaab005c5f3a781fec229640c74bf44a601fc97 (patch) | |
| tree | d81d0c4d0387a15f8ea764ea31062d47527a4390 /supervisor/shared/stack.c | |
| parent | 0d8bca92e208e705150097d26db6a5390dc9eb9b (diff) | |
Initial ESP32S2 port.
Basic blinky works but doesn't check pins.
Diffstat (limited to 'supervisor/shared/stack.c')
| -rwxr-xr-x | supervisor/shared/stack.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index 2b7b1c03a..e7aa956b0 100755 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -41,22 +41,24 @@ supervisor_allocation* stack_alloc = NULL; #define EXCEPTION_STACK_SIZE 1024 void allocate_stack(void) { - mp_uint_t regs[10]; - mp_uint_t sp = cpu_get_regs_and_sp(regs); - mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; + if (port_fixed_stack() != NULL) { + stack_alloc = port_fixed_stack(); + current_stack_size = stack_alloc->length; + } else { + mp_uint_t regs[10]; + mp_uint_t sp = cpu_get_regs_and_sp(regs); - if (port_stack_get_top() != port_heap_get_top()) { - return; + mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp; + stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); + if (stack_alloc == NULL) { + stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true); + current_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; + } else { + current_stack_size = next_stack_size; + } } - stack_alloc = allocate_memory(c_size + next_stack_size + EXCEPTION_STACK_SIZE, true); - if (stack_alloc == NULL) { - stack_alloc = allocate_memory(c_size + CIRCUITPY_DEFAULT_STACK_SIZE + EXCEPTION_STACK_SIZE, true); - current_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE; - } else { - current_stack_size = next_stack_size; - } *stack_alloc->ptr = STACK_CANARY_VALUE; } |
