I’m new to PlatformIO. My current project which doesnt use LVGL compiles for the Mega and ESP32 no issues.
I tried a simple LVGL “hello world” type app and it compiles/uploads to the ESP32 but I cannot get the Simulator working. Same code doesnt compile.
hello world code below followed by the platformio.ini. I figured I would copy the entry from the GitHub - lvgl/lv_platformio: PlatformIO project example for LVGL, specifically the one for emulator_64bits. I did change the lvgl to be vers 8.3.4 which compiles w/o emulator selected. The demo code below fails on the emulator.
#include <lvgl.h>
void setup() {
lv_init();
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "testing crap");
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}
void loop() {
lv_task_handler();
}
platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = lvgl/lvgl@^8.3.4
[env:emulator_64bits]
platform = native
extra_scripts = support/sdl2_build_extra.py
build_flags =
${env.build_flags}
-D LV_LOG_PRINTF=1
!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
-lSDL2
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_DRV_NO_CONF
-D USE_SDL
-D SDL_HOR_RES=480
-D SDL_VER_RES=320
-D SDL_ZOOM=1
-D SDL_INCLUDE_PATH="\"SDL2/SDL.h\""
-D LV_MEM_CUSTOM=1
-D LV_MEM_SIZE="(128U * 1024U)"
lib_deps = lvgl/lvgl@^8.3.4
build_src_filter =
+<*>
+<../hal/sdl2>
Error when compiling using emulator_64bits env:
Linking .pio/build/emulator_64bits/program
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
*** [.pio/build/emulator_64bits/program] Error 1
- I guess the question is, has anyone used PIO IDE with the simulator? Is it as simple as copy the platformio.ini entry and have at it?
- Before the simulator, how did you guys write LVGL screens and know where to place stuff?