Simulator w/ release versions


I’ve run the simulator via CMake from this example GitHub - lvgl/lv_port_pc_eclipse: PC simulator project for LVGL embedded GUI Library. Recommended on Linux and Mac. and it looks great!

When using a release version in my project:

    GIT_TAG v8.2.0

I’ve noted that I don’t seems to have a src/dev folder. Indeed, if I select the 8.2 branch on GitHub it also does not contain this folder.

I tried the main branch, but some prototypes have changed and I’m not certain I want to find out how deep the rabbit hole goes. Besides, it feels bad to use a different version of LVGL in the simulator vs actual product.

So, I’m curious how to get the simulator dependencies at tag v8.2.0.

What MCU/Processor/Board and compiler are you using?

NRF52840 Zephyr 3.2.0 Zephyr GNU (all working perfectly, the question is in regards to the SDL2 simulator, so native build.)

What LVGL version are you using?


What do you want to achieve?


What have you tried so far?

I am compiling v8.2.0 library just fine. My issue is related to missing includes like

#include "src/dev/sdl/lv_sdl_window.h"
#include "src/dev/sdl/lv_sdl_mouse.h"
#include "src/dev/sdl/lv_sdl_mousewheel.h"
#include "src/dev/sdl/lv_sdl_keyboard.h"

And therefore missing functions like lv_sdl_window_create

Code to reproduce

Clone this repo: GitHub - lvgl/lv_port_pc_eclipse: PC simulator project for LVGL embedded GUI Library. Recommended on Linux and Mac.

Verify that it works as expected:

cmake -B build -G Ninja && cmake --build build && ./bin/main

Modify .gitmodules of this repo to checkout v8.2:

[submodule "lvgl"]
	path = lvgl
	url =
	branch = release/v8.2

Update the dependency:

git submodule update --remote

Verify that your lvgl folder is now missing src/dev (I’m not saying it’s not intentional, just trying to understand!)

Verify build failure for simulator on release branch:

cmake -B build -G Ninja && cmake --build build --clean-first && ./bin/main
[7/399] Building C object CMakeFiles/main.dir/mouse_cursor_icon.c.o
FAILED: CMakeFiles/main.dir/mouse_cursor_icon.c.o 
/usr/bin/cc -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -I/home/jp/repos/lv_port_pc_eclipse -I/usr/include/SDL2 -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl/examples -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl/demos -std=gnu11 -MD -MT CMakeFiles/main.dir/mouse_cursor_icon.c.o -MF CMakeFiles/main.dir/mouse_cursor_icon.c.o.d -o CMakeFiles/main.dir/mouse_cursor_icon.c.o -c /home/jp/repos/lv_port_pc_eclipse/mouse_cursor_icon.c
/home/jp/repos/lv_port_pc_eclipse/mouse_cursor_icon.c:49:16: error: ‘LV_COLOR_FORMAT_ARGB8888’ undeclared here (not in a function)
   49 | = LV_COLOR_FORMAT_ARGB8888,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
[24/399] Building C object CMakeFiles/main.dir/main.c.o
FAILED: CMakeFiles/main.dir/main.c.o 
/usr/bin/cc -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -I/home/jp/repos/lv_port_pc_eclipse -I/usr/include/SDL2 -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl/examples -isystem /home/jp/repos/lv_port_pc_eclipse/lvgl/demos -std=gnu11 -MD -MT CMakeFiles/main.dir/main.c.o -MF CMakeFiles/main.dir/main.c.o.d -o CMakeFiles/main.dir/main.c.o -c /home/jp/repos/lv_port_pc_eclipse/main.c
/home/jp/repos/lv_port_pc_eclipse/main.c:17:10: fatal error: lvgl/src/dev/sdl/lv_sdl_window.h: No such file or directory
   17 | #include "lvgl/src/dev/sdl/lv_sdl_window.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

1 Like

I have discovered GitHub - lvgl/lv_drivers: TFT and touch pad drivers for LVGL embedded GUI library, perhaps this provides a path forward for me?

I have this working now! Using the lv_drivers repo:

    GIT_TAG v8.2.0

    GIT_TAG 7b9dee1
target_compile_definitions(lv_drivers PRIVATE 

# ...more cmake stuff...

target_link_libraries(${PROJECT_NAME} PRIVATE 

I have not used LVGL before, so I copied some initialization code from elsewhere:

static lv_disp_t * hal_init(void) {
    static lv_disp_draw_buf_t disp_buf1;
    static lv_color_t buf1_1[SDL_HOR_RES * 100];
    lv_disp_draw_buf_init(&disp_buf1, buf1_1, NULL, SDL_HOR_RES * 100);

    /*Create a display*/
    static lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv); /*Basic initialization*/
    disp_drv.draw_buf = &disp_buf1;
    disp_drv.flush_cb = sdl_display_flush;
    disp_drv.hor_res = SDL_HOR_RES;
    disp_drv.ver_res = SDL_VER_RES;

    lv_disp_t * disp = lv_disp_drv_register(&disp_drv);
    lv_theme_t * th = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT);
    lv_disp_set_theme(disp, th);

    lv_group_t * g = lv_group_create();
    LV_LOG_USER("SDL driver set.");
    return disp;

Anyway, if this is a reasonable approach I wouldn’t mind doing a write up. If it’s not the correct approach I would like to learn more.

The simulator repo in question, GitHub - lvgl/lv_port_pc_eclipse: PC simulator project for LVGL embedded GUI Library. Recommended on Linux and Mac., provides separate branches corresponding to each release version. Therefore, if using LVGL release/8.2, one should also checkout the particular simulator port for release/8.2 FROM THE SIMULATOR REPO.

Incidentally, that branch more or less does what I did above using the lv_drivers repo.