File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ list(APPEND IMAGE_FILES
367367 displayapp/icons/battery/batteryicon.c
368368 )
369369list (APPEND SOURCE_FILES
370+ stdlib.c
370371 FreeRTOS/heap_4_infinitime.c
371372 BootloaderVersion.cpp
372373 logging/NrfLogger.cpp
@@ -496,6 +497,7 @@ list(APPEND SOURCE_FILES
496497 )
497498
498499list (APPEND RECOVERY_SOURCE_FILES
500+ stdlib.c
499501 FreeRTOS/heap_4_infinitime.c
500502
501503 BootloaderVersion.cpp
@@ -560,6 +562,7 @@ list(APPEND RECOVERY_SOURCE_FILES
560562 )
561563
562564list (APPEND RECOVERYLOADER_SOURCE_FILES
565+ stdlib.c
563566 FreeRTOS/heap_4_infinitime.c
564567
565568 # FreeRTOS
@@ -786,7 +789,7 @@ add_definitions(-DOS_CPUTIME_FREQ)
786789add_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 )
787790add_definitions (-DFREERTOS )
788791add_definitions (-D__STACK_SIZE=1024 )
789- add_definitions (-D__HEAP_SIZE=4096 )
792+ add_definitions (-D__HEAP_SIZE=0 )
790793add_definitions (-DMYNEWT_VAL_BLE_LL_RFMGMT_ENABLE_TIME=1500 )
791794
792795# Note: Only use this for debugging
Original file line number Diff line number Diff line change 6262#define configTICK_RATE_HZ 1024
6363#define configMAX_PRIORITIES (3)
6464#define configMINIMAL_STACK_SIZE (120)
65- #define configTOTAL_HEAP_SIZE (1024 * 17 )
65+ #define configTOTAL_HEAP_SIZE (1024 * 40 )
6666#define configMAX_TASK_NAME_LEN (4)
6767#define configUSE_16_BIT_TICKS 0
6868#define configIDLE_SHOULD_YIELD 1
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ typedef int16_t lv_coord_t;
7171 * The graphical objects and other related data are stored here. */
7272
7373/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
74- #define LV_MEM_CUSTOM 0
74+ #define LV_MEM_CUSTOM 1
7575#if LV_MEM_CUSTOM == 0
7676/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
7777#define LV_MEM_SIZE (14U * 1024U)
@@ -86,9 +86,9 @@ typedef int16_t lv_coord_t;
8686/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
8787#define LV_MEM_AUTO_DEFRAG 1
8888#else /*LV_MEM_CUSTOM*/
89- #define LV_MEM_CUSTOM_INCLUDE <stdlib .h> /*Header for the dynamic memory function*/
90- #define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
91- #define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
89+ #define LV_MEM_CUSTOM_INCLUDE <FreeRTOS .h> /*Header for the dynamic memory function*/
90+ #define LV_MEM_CUSTOM_ALLOC pvPortMalloc /*Wrapper to malloc*/
91+ #define LV_MEM_CUSTOM_FREE vPortFree /*Wrapper to free*/
9292#endif /*LV_MEM_CUSTOM*/
9393
9494/* Use the standard memcpy and memset instead of LVGL's own functions.
Original file line number Diff line number Diff line change 1+ #include <stdlib.h>
2+ #include <FreeRTOS.h>
3+
4+ // Override malloc() and free() to use the memory manager from FreeRTOS.
5+ // According to the documentation of libc, we also need to override
6+ // calloc and realloc.
7+ // See https://www.gnu.org/software/libc/manual/html_node/Replacing-malloc.html
8+
9+ void * malloc (size_t size ) {
10+ return pvPortMalloc (size );
11+ }
12+
13+ void free (void * ptr ) {
14+ vPortFree (ptr );
15+ }
16+
17+ void * calloc (size_t num , size_t size ) {
18+ (void )(num );
19+ (void )(size );
20+ // Not supported
21+ return NULL ;
22+ }
23+
24+ void * pvPortRealloc (void * ptr , size_t xWantedSize );
25+ void * realloc ( void * ptr , size_t newSize ) {
26+ return pvPortRealloc (ptr , newSize );
27+ }
You can’t perform that action at this time.
0 commit comments