SDL2 Simulator configuration

(new to PlatformIO)

I’ve went thru the following:

What I am trying to do is run a simulator using SDL2 thru PlatformIO that way I can test LVGL stuff on-screen.

According to the pic here —> lv_platformio/pio_explorer.jpg at master · lvgl/lv_platformio · GitHub
I need to have env:emulator_64bits which I do not have and cannot find under pio home -->Boards. I am assuming its not as easy as copying the platformio.ini entry for the emulator_64bits from the same github link and pasting it into mine?

If there is something I can read, lmk what the link is. I’ve googled around and cant figure that out.

That’s how it should be done – there is no emulator_64bits board, but there is an [env:emulator_64bits] environment in the platformio.ini which uses platform = native and no board.

Is there something documented to explains how this is supposed to be configured? I appreciate the help but dont want to keep asking / taking up others time if there is a “RTFM” I can do.

I’ve modified the platformio.ini and of course, the compliation of my simple lvgl app fails. I updated platform = native, updated lib_deps to reference 8.3.4 and the build_src_filter also. The build for the esp32 works but simulator fails.

platform = native
extra_scripts = support/
build_flags = 
	!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
	-D LV_MEM_SIZE="(128U * 1024U)"
lib_deps = lvgl/lvgl@^8.3.4
build_src_filter = 

Do you want to run on Windows natively or via MSYS2/MinGW64 like the repo’s readme says?

There are no docs available for this project beyond what the project gives you on the README and the general platformio.ini and the Native Platform docs.

I’m running Linux, so I am assuming SDL2 is what will be used to facilitate this. What I’m expecting, which might be wrong is that a “window pops up and I can see my LVGL code run”.

Yeah exactly that’s what it is. I’m using a Ubuntu 22.10 virtual machine and following installation procedure and git clone-ing that repo, correcting the !python commands to !python3 in the platformio.ini, pio run -e emulator_64bits gives me

Linking .pio/build/emulator_64bits/program
====================[SUCCESS] Took 5.85 seconds ====================
Environment      Status    Duration
---------------  --------  ------------
emulator_64bits  SUCCESS   00:00:05.848
=====================1 succeeded in 00:00:05.848 =====================

Executing the program then gives me…

yea that works for me also, so I know I have everything installed behind the scenes (sdl2, gcc etc) correctly. But I’m more interested in how to make the simulator work for my newbie “hello world” type lvgl code.

I’ll play around with it. I have an esp32 with a built-in LCD coming in so I can upload the newbie code to it and see if it works. If it does, good. The simulator is a nice to have.

Upload the exact project you’re having problems with and I’ll look into it.

If you stick to the techniques shown in the reference repo you should be good.

I’ll upload the code below…have some questions also.

Is the simulator for not just LVGL but any project I want to build for an Arduino/ESP32/Teensy? Ie, if I use the TFT_eSPI library etc and want to see how it looks, I can use the simulator before uploading to the mcu? Thats really what I’m after. If that is possible, how to configure PlatformIO for things like that.

Another question I have is, when I’m building my code and for example, if I include LVGL lib, its in my libdeps. There is a lv_conf.h that needs to be updated. I am assuming in libdeps is where I update it. If it was in “lib”, I would update it there, correct?

Before the whole simulator thing… how did people code for displays? I mean, if they want a meter on the middle of the display, a little to the right…just code it, upload and if not right, update code, upload. Rinse and repeat?

Btw, I appreciate the assist.

#include <lvgl.h>

void setup() {

    lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label, "Hello World!");
    lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);

void loop() {

Is there a simple way to use the simulator without LVGL?

I have a simple project using TFT_eSPI. I don’t need LVGL but want to be able to use a simulator for visual testing.

So far I have tried to replicate the LVGL’s simulator project and have realised that there is a driver that LVGL has developed lv_drivers/sdl at master · lvgl/lv_drivers · GitHub , which seems to be missing for TFT_eSPI. If anyone knows if there is something similar I could use. May be even different graphics library than TFT_eSPI, but with SDL driver support.