File tree 4 files changed +36
-6
lines changed
4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ list(APPEND IMAGE_FILES
367
367
displayapp/icons/battery/batteryicon.c
368
368
)
369
369
list (APPEND SOURCE_FILES
370
+ stdlib.c
370
371
FreeRTOS/heap_4_infinitime.c
371
372
BootloaderVersion.cpp
372
373
logging/NrfLogger.cpp
@@ -496,6 +497,7 @@ list(APPEND SOURCE_FILES
496
497
)
497
498
498
499
list (APPEND RECOVERY_SOURCE_FILES
500
+ stdlib.c
499
501
FreeRTOS/heap_4_infinitime.c
500
502
501
503
BootloaderVersion.cpp
@@ -560,6 +562,7 @@ list(APPEND RECOVERY_SOURCE_FILES
560
562
)
561
563
562
564
list (APPEND RECOVERYLOADER_SOURCE_FILES
565
+ stdlib.c
563
566
FreeRTOS/heap_4_infinitime.c
564
567
565
568
# FreeRTOS
@@ -786,7 +789,7 @@ add_definitions(-DOS_CPUTIME_FREQ)
786
789
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)
787
790
add_definitions (-DFREERTOS)
788
791
add_definitions (-D__STACK_SIZE=1024)
789
- add_definitions (-D__HEAP_SIZE=4096 )
792
+ add_definitions (-D__HEAP_SIZE=0 )
790
793
add_definitions (-DMYNEWT_VAL_BLE_LL_RFMGMT_ENABLE_TIME=1500)
791
794
792
795
# Note: Only use this for debugging
Original file line number Diff line number Diff line change 62
62
#define configTICK_RATE_HZ 1024
63
63
#define configMAX_PRIORITIES (3)
64
64
#define configMINIMAL_STACK_SIZE (120)
65
- #define configTOTAL_HEAP_SIZE (1024 * 17 )
65
+ #define configTOTAL_HEAP_SIZE (1024 * 40 )
66
66
#define configMAX_TASK_NAME_LEN (4)
67
67
#define configUSE_16_BIT_TICKS 0
68
68
#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;
71
71
* The graphical objects and other related data are stored here. */
72
72
73
73
/* 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
75
75
#if LV_MEM_CUSTOM == 0
76
76
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
77
77
#define LV_MEM_SIZE (14U * 1024U)
@@ -86,9 +86,9 @@ typedef int16_t lv_coord_t;
86
86
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
87
87
#define LV_MEM_AUTO_DEFRAG 1
88
88
#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*/
92
92
#endif /*LV_MEM_CUSTOM*/
93
93
94
94
/* 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