aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2023-03-26 14:49:03 +0200
committerJF <JF002@users.noreply.github.com>2023-05-18 19:58:09 +0200
commit1911e2d9285cb5b0a6ecd3bf3de864783f2b0e3e (patch)
tree055bdd2a889c0492ee0807f8c140067b1ba34d40 /src/CMakeLists.txt
parent9e808a65ec38a3b6f465b6d6b2ec93160c942076 (diff)
Unify all heaps (stdlib + LVGL + FreeRTOS) into a single heap managed by FreeRTOS and heap_4_infinitime.c.
LVGL supports custom implementation of malloc() and free() so using pvPortMalloc() and vPortFree() is just a matter of setting the right variables. Other libraries (NimBLE, LittleFS) and InfiniTime code (new) call malloc() and free() from stdlib. InfiniTime now provides the file stdlib.c that provides a custom implementation for malloc(), free(), calloc() and realloc(). This ensures that all calls to the standard allocator are redirected to the FreeRTOS memory manager. Note that realloc() is needed by NimBLE.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f554dc68..1935f8fc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -367,6 +367,7 @@ list(APPEND IMAGE_FILES
displayapp/icons/battery/batteryicon.c
)
list(APPEND SOURCE_FILES
+ stdlib.c
FreeRTOS/heap_4_infinitime.c
BootloaderVersion.cpp
logging/NrfLogger.cpp
@@ -496,6 +497,7 @@ list(APPEND SOURCE_FILES
)
list(APPEND RECOVERY_SOURCE_FILES
+ stdlib.c
FreeRTOS/heap_4_infinitime.c
BootloaderVersion.cpp
@@ -560,6 +562,7 @@ list(APPEND RECOVERY_SOURCE_FILES
)
list(APPEND RECOVERYLOADER_SOURCE_FILES
+ stdlib.c
FreeRTOS/heap_4_infinitime.c
# FreeRTOS
@@ -786,7 +789,7 @@ add_definitions(-DOS_CPUTIME_FREQ)
add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040)
add_definitions(-DFREERTOS)
add_definitions(-D__STACK_SIZE=1024)
-add_definitions(-D__HEAP_SIZE=4096)
+add_definitions(-D__HEAP_SIZE=0)
add_definitions(-DMYNEWT_VAL_BLE_LL_RFMGMT_ENABLE_TIME=1500)
# Note: Only use this for debugging