summaryrefslogtreecommitdiff
path: root/supervisor/shared/stack.c
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-01-31 12:21:46 -0500
committerLucian Copeland <hierophect@gmail.com>2020-01-31 12:21:46 -0500
commitd8016bd52bb2feefab0c01038d5085c1d9116433 (patch)
treefb4f30d2a658102f86e746987959877b7213508b /supervisor/shared/stack.c
parent947c2243bdc88fed001723939ed6f91851236e8d (diff)
parentd378bebaa387b2dbfa688ee2924385a5b7176b11 (diff)
Merge branch 'master' into stm32-loader-linkers
Diffstat (limited to 'supervisor/shared/stack.c')
-rwxr-xr-xsupervisor/shared/stack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c
index dcecf2067..2b7b1c03a 100755
--- a/supervisor/shared/stack.c
+++ b/supervisor/shared/stack.c
@@ -46,6 +46,10 @@ void allocate_stack(void) {
mp_uint_t c_size = (uint32_t) port_stack_get_top() - sp;
+ if (port_stack_get_top() != port_heap_get_top()) {
+ return;
+ }
+
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);
@@ -71,6 +75,9 @@ void stack_init(void) {
}
void stack_resize(void) {
+ if (stack_alloc == NULL) {
+ return;
+ }
if (next_stack_size == current_stack_size) {
*stack_alloc->ptr = STACK_CANARY_VALUE;
return;