will do some projects based on LVGL:
basic for testing the lvgl lib in order to be used in the future for MCU as an UI
In this project
sys.h: 😹
configure:
#define SYSTEM_SUPPORT_OS 1
to configure if need run freertos or not, this will change the configurations in
lv_conf.h
timer.h
port.c
freeRTOSCfig.h sys.c
delay.c
usart.c
where there are some parts for supporting OS or not the maximum heap_size for the given board(stm32f1ze):
#define configTOTAL_HEAP_SIZE ((size_t)(40*1024))
SRAM support
configure the system to support external sram, this series is stm32f1, so it does not support lcd tft display controller(LTDC), so the configure in lv_conf.h only needs the head address of sram, it it is stm32f429, it needs the offset from ltdc
#define LV_MEM_ADR Bank1_SRAM3_ADDR(sram.c)
for the introduction ltdc+dma2d, ltdc+dma2d(GPU),difference beteween mcu lcd and rgb lcd there are 2 ways of using sram:
- put the memory at external sram that lvgl manages (not recommanded) in lv_conf.h only
#define LV_MEM_SIZE (200U * 1024U) **can be reduced to 100U or increased d to 300U, casue it uses external SRAM**
#define LV_MEM_ADR 0x68000000 //0 /*0: unused*/
- the buffer for drawing the pic is put in external SRAM (internal memory is not enough)(does not work)
#define LV_MEM_ADR 0 /*0: unused*/
static lv_color_t buf_1[MY_DISP_HOR_RES * MY_DISP_VER_RES] __attribute__((at(0x68000000))); //0x68000000 start add of sram
lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES);
malloc for memory management is not done yet
here use #define LV_MEM_CUSTOM 0, then the memory management is done by lvgl built-in alloc()
#define LV_USE_LOG 1 log event for debugging #define LV_LOG_PRINTF 1 serial print... also some assert funcs below
simulator blockcodes
built project compiler check:compiler:management->project->right clik->build option-> select a compiler(GNU)
settings->complier->selected compiler(GNU)->toolchain executables(MinGW)(this should contain the needed files for compiling)