diff options
author | ConfuSomu | 2021-04-01 21:58:53 -0400 |
---|---|---|
committer | ConfuSomu | 2021-04-01 21:58:53 -0400 |
commit | fa922617f6a07a7717285449aa634316f4e17652 (patch) | |
tree | dfed98f120d71a9d4af43b323a451d519164c4cf | |
parent | 75ce3a1f3c4bf01d2595f81bf2012fb7a8fa7f81 (diff) | |
download | pico-watch-fa922617f6a07a7717285449aa634316f4e17652.tar pico-watch-fa922617f6a07a7717285449aa634316f4e17652.tar.gz pico-watch-fa922617f6a07a7717285449aa634316f4e17652.zip |
Increase heap size
This should help remedy malloc (and new) failures. This is (naturaly) not
a replacement for checking if malloc/new has failed!
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 486b58e..bcb8b4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated Cmake Pico project file - cmake_minimum_required(VERSION 3.12) set(CMAKE_C_STANDARD 11) @@ -15,6 +13,14 @@ include(pico_sdk_import.cmake) project(pico-watch C CXX) add_compile_definitions(PICO_DEBUG_MALLOC PICO_DEBUG_MALLOC_LOW_WATER=1)# PICO_MALLOC_PANIC) +# Increase heap size, this should leave: +# sram_size = SRAM_END(=0x20042000) - SRAM_BASE(=0x20000000) = 0x42000 +# stack_size = 0x800 (default) +# heap_size = 0x5000 (changed) +# mem_left = sram_size - (stack_size + heap_size) = 0x3c800 +# If still having problems: see __malloc_current_mallinfo.arena variable in debugger. See also https://stackoverflow.com/a/12825223 for arena definition. +add_compile_definitions(PICO_HEAP_SIZE=0x5000) + # Initialise the Pico SDK pico_sdk_init() |