aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2021-04-01 21:58:53 -0400
committerConfuSomu2021-04-01 21:58:53 -0400
commitfa922617f6a07a7717285449aa634316f4e17652 (patch)
treedfed98f120d71a9d4af43b323a451d519164c4cf
parent75ce3a1f3c4bf01d2595f81bf2012fb7a8fa7f81 (diff)
downloadpico-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.txt10
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()
'#n168'>168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302