modules: lvgl: simplify sys_heap memory size configs

Changes the Kconfig symbols for the sys_heap based memory management option
and removes the notion of `BLOCKS` with a more concise single
`LV_Z_MEM_POOL_SIZE` option. Also adds `LV_MEM_CUSTOM` to the lv_conf.h,
since in any option the memory management is considered to be custom.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This commit is contained in:
Fabian Blatz 2023-09-26 15:26:07 +02:00 committed by Carles Cufí
commit c7f8033f2b
7 changed files with 11 additions and 28 deletions

View file

@ -31,27 +31,12 @@ choice LV_Z_MEMORY_POOL
endchoice endchoice
if LV_Z_MEM_POOL_SYS_HEAP config LV_Z_MEM_POOL_SIZE
int "Memory pool size"
config LV_Z_MEM_POOL_MIN_SIZE
int "Minimum memory pool block size"
default 16
help
Size of the smallest block in the memory pool in bytes
config LV_Z_MEM_POOL_MAX_SIZE
int "Maximum memory pool block size"
default 2048 default 2048
depends on LV_Z_MEM_POOL_SYS_HEAP
help help
Size of the largest block in the memory pool in bytes Size of the memory pool in bytes
config LV_Z_MEM_POOL_NUMBER_BLOCKS
int "Number of max size blocks in memory pool"
default 1
help
Number of maximum sized blocks in the memory pool.
endif
config LV_Z_VDB_SIZE config LV_Z_VDB_SIZE
int "Rendering buffer size" int "Rendering buffer size"

View file

@ -11,6 +11,7 @@
/* Memory manager settings */ /* Memory manager settings */
#define LV_MEMCPY_MEMSET_STD 1 #define LV_MEMCPY_MEMSET_STD 1
#define LV_MEM_CUSTOM 1
#if defined(CONFIG_LV_Z_MEM_POOL_HEAP_LIB_C) #if defined(CONFIG_LV_Z_MEM_POOL_HEAP_LIB_C)

View file

@ -10,9 +10,7 @@
#include <zephyr/init.h> #include <zephyr/init.h>
#include <zephyr/sys/sys_heap.h> #include <zephyr/sys/sys_heap.h>
#define HEAP_BYTES (CONFIG_LV_Z_MEM_POOL_MAX_SIZE * CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS) static char lvgl_heap_mem[CONFIG_LV_Z_MEM_POOL_SIZE] __aligned(8);
static char lvgl_heap_mem[HEAP_BYTES] __aligned(8);
static struct sys_heap lvgl_heap; static struct sys_heap lvgl_heap;
static struct k_spinlock lvgl_heap_lock; static struct k_spinlock lvgl_heap_lock;
@ -60,5 +58,5 @@ void lvgl_print_heap_info(bool dump_chunks)
void lvgl_heap_init(void) void lvgl_heap_init(void)
{ {
sys_heap_init(&lvgl_heap, &lvgl_heap_mem[0], HEAP_BYTES); sys_heap_init(&lvgl_heap, &lvgl_heap_mem[0], CONFIG_LV_Z_MEM_POOL_SIZE);
} }

View file

@ -3,7 +3,7 @@ CONFIG_LOG=y
CONFIG_SHELL=y CONFIG_SHELL=y
CONFIG_LVGL=y CONFIG_LVGL=y
CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8 CONFIG_LV_Z_MEM_POOL_SIZE=16384
CONFIG_LV_Z_SHELL=y CONFIG_LV_Z_SHELL=y
CONFIG_LV_USE_MONKEY=y CONFIG_LV_USE_MONKEY=y

View file

@ -1,4 +1,4 @@
CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8 CONFIG_LV_Z_MEM_POOL_SIZE=16384
CONFIG_LV_Z_SHELL=y CONFIG_LV_Z_SHELL=y
CONFIG_MAIN_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=2048

View file

@ -13,7 +13,7 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_LVGL=y CONFIG_LVGL=y
CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=8 CONFIG_LV_Z_MEM_POOL_SIZE=16384
CONFIG_LV_Z_USE_FILESYSTEM=y CONFIG_LV_Z_USE_FILESYSTEM=y
CONFIG_LV_MEM_CUSTOM=y CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_USE_LOG=y CONFIG_LV_USE_LOG=y

View file

@ -22,8 +22,7 @@ tests:
extra_configs: extra_configs:
- CONFIG_LV_Z_BUFFER_ALLOC_DYNAMIC=y - CONFIG_LV_Z_BUFFER_ALLOC_DYNAMIC=y
- CONFIG_LV_Z_MEM_POOL_SYS_HEAP=y - CONFIG_LV_Z_MEM_POOL_SYS_HEAP=y
- CONFIG_LV_Z_MEM_POOL_NUMBER_BLOCKS=3 - CONFIG_LV_Z_MEM_POOL_SIZE=98304
- CONFIG_LV_Z_MEM_POOL_MAX_SIZE=32768
libraries.gui.lvgl.16bit: libraries.gui.lvgl.16bit:
tags: tags:
- display - display