From e7ff0b8a31a7f36cc1b3dfb7e5fd7b8805ff85ce Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 4 Jul 2024 10:19:26 +0100 Subject: [PATCH] rp2/memmap_mp.ld: Lower the minimum GC heap to 32K. Reduce mimimum heap requirement. This value allows more room for large, static buffers in user C modules (such as graphics buffers or otherwise) which might be allocated outside of MicroPython's heap to guarantee alignment or avoid fragmentation. Signed-off-by: Phil Howard --- ports/rp2/memmap_mp.ld | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/rp2/memmap_mp.ld b/ports/rp2/memmap_mp.ld index 0ed9509b8..a5799cd88 100644 --- a/ports/rp2/memmap_mp.ld +++ b/ports/rp2/memmap_mp.ld @@ -256,9 +256,13 @@ SECTIONS __StackBottom = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop); - /* Check GC heap is at least 128 KB */ - /* On a RP2040 using all SRAM this should always be the case. */ - ASSERT((__GcHeapEnd - __GcHeapStart) > 128*1024, "GcHeap is too small") + /* Check GC heap is at least 32 KB */ + /* This is quarter the minimum RAM suggested for full-featured MicroPython. + * This value accounts for large static buffers included in user C or C++ + * modules, which might significantly reduce the available heap but also + * lower demand for memory at runtime. + */ + ASSERT((__GcHeapEnd - __GcHeapStart) > 32*1024, "GcHeap is too small") ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") /* todo assert on extra code */