From a47d6d6e14d4cd5d135606cf839c47340eaddfdc Mon Sep 17 00:00:00 2001 From: Mike Bell Date: Wed, 24 Mar 2021 14:26:54 +0000 Subject: [PATCH] Allow heap end to be equal to stack limit (#266) --- src/rp2_common/pico_runtime/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c index 796284e..2340ba7 100644 --- a/src/rp2_common/pico_runtime/runtime.c +++ b/src/rp2_common/pico_runtime/runtime.c @@ -175,9 +175,9 @@ void *_sbrk(int incr) { prev_heap_end = heap_end; char *next_heap_end = heap_end + incr; - if (__builtin_expect(next_heap_end >= (&__StackLimit), false)) { + if (__builtin_expect(next_heap_end > (&__StackLimit), false)) { #if PICO_USE_OPTIMISTIC_SBRK - if (next_heap_end == &__StackLimit) { + if (heap_end == &__StackLimit) { // errno = ENOMEM; return (char *) -1; }