diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-05-19 12:53:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-19 12:53:23 -0700 |
| commit | 916ca9f8a635d20c299326a955d4ca51dae055e1 (patch) | |
| tree | ea5eebd3cb0e014830bc7bc8784dee0aa09459b9 /supervisor/shared/stack.c | |
| parent | bdc5a6b7c08ee98541a536c234eedddb006af296 (diff) | |
| parent | acf4b1bedeabe18a7b4b969e7156217ae6bde10a (diff) | |
Merge pull request #2910 from tannewt/esp32s2
Add initial ESP32S2 support
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; } |
