I tried that and it did seem to do something, but the program does not compile yet.
This is what my platformio.ini
looks like:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = emulator_64bits
; Shared options
[env]
build_flags =
; Don't use lv_conf.h. Tweak params via platfom.ini.
-D LV_CONF_SKIP
-D LV_CONF_INCLUDE_SIMPLE
; Add more defines below to overide lvgl:/src/lv_conf_simple.h
lib_deps =
git+https://github.com/lvgl/lvgl.git
lib_archive = false
[env:emulator_64bits]
platform = native@^1.1.3
extra_scripts = support/sdl2_build_extra.py
build_flags =
${env.build_flags}
-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
-D LV_LOG_PRINTF=1
; Add recursive dirs for hal headers search
!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
-lSDL2
; SDL drivers options
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_DRV_NO_CONF
-D USE_MONITOR
-D MONITOR_ZOOM=2
-D USE_MOUSE
-D USE_MOUSEWHEEL
-D USE_KEYBOARD
lib_deps =
${env.lib_deps}
git+https://github.com/lvgl/lv_drivers.git
src_filter =
+<*>
+<../hal/sdl2>
[env:emulator_32bits]
extends = env:emulator_64bits
build_flags =
${env:emulator_64bits.build_flags}
-m32
[env:stm32f429_disco]
platform = ststm32@^8.0.0
board = disco_f429zi
framework = stm32cube
build_flags =
${env.build_flags}
-D LV_LOG_LEVEL=LV_LOG_LEVEL_NONE
; header's default is 25MHz, but board uses 8MHz crystal
-D HSE_VALUE=8000000
; Add recursive dirs for hal headers search
!python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/stm32f429_disco')]))"
lib_deps =
${env.lib_deps}
BSP-ili9341
BSP-stmpe811
src_filter =
+<*>
+<../hal/stm32f429_disco>
I only changed the lib_deps
fields in [env]
and [env:emulator_64bits]
.
This is the console output after attempting to build:
Compiling .pio/build/emulator_64bits/lib4c2/lv_drivers/win_drv.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:17:3: warning: #warning "MONITOR is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
17 | # warning "MONITOR is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:21:3: warning: #warning "KEYBOARD is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
21 | # warning "KEYBOARD is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:25:3: warning: #warning "MOUSE is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
25 | # warning "MOUSE is deprecated, use SDL instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:29:3: warning: #warning "MOUSEWHEEL is deprecated, use SDL instead that. See lv_drivers/sdl/sdl.c" [-Wcpp]
29 | # warning "MOUSEWHEEL is deprecated, use SDL instead that. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:53:10: error: #include expects "FILENAME" or <FILENAME>
53 | #include SDL_INCLUDE_PATH
| ^~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:68:5: error: unknown type name ‘SDL_Window’
68 | SDL_Window * window;
| ^~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:69:5: error: unknown type name ‘SDL_Renderer’
69 | SDL_Renderer * renderer;
| ^~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:70:5: error: unknown type name ‘SDL_Texture’
70 | SDL_Texture * texture;
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:84:34: error: unknown type name ‘SDL_Event’
84 | int quit_filter(void * userdata, SDL_Event * event);
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:88:27: error: unknown type name ‘SDL_Event’
88 | static void mouse_handler(SDL_Event * event);
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:89:32: error: unknown type name ‘SDL_Event’
89 | static void mousewheel_handler(SDL_Event * event);
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:90:37: error: unknown type name ‘SDL_Keycode’
90 | static uint32_t keycode_to_ctrl_key(SDL_Keycode sdl_key);
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:91:30: error: unknown type name ‘SDL_Event’
91 | static void keyboard_handler(SDL_Event * event);
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:61:30: error: ‘SDL_TEXTINPUTEVENT_TEXT_SIZE’ undeclared here (not in a function)
61 | #define KEYBOARD_BUFFER_SIZE SDL_TEXTINPUTEVENT_TEXT_SIZE
Compiling .pio/build/emulator_64bits/hal/sdl2/app_hal.o
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:117:17: note: in expansion of macro ‘KEYBOARD_BUFFER_SIZE’
117 | static char buf[KEYBOARD_BUFFER_SIZE];
| ^~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘sdl_init’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:130:5: warning: implicit declaration of function ‘SDL_Init’; did you mean ‘sdl_init’? [-Wimplicit-function-declaration]
130 | SDL_Init(SDL_INIT_VIDEO);
| ^~~~~~~~
| sdl_init
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:130:14: error: ‘SDL_INIT_VIDEO’ undeclared (first use in this function)
130 | SDL_Init(SDL_INIT_VIDEO);
| ^~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:130:14: note: each undeclared identifier is reported only once for each function it appears in
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:132:5: warning: implicit declaration of function ‘SDL_SetEventFilter’ [-Wimplicit-function-declaration]
132 | SDL_SetEventFilter(quit_filter, NULL);
| ^~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:132:24: error: ‘quit_filter’ undeclared (first use in this function)
132 | SDL_SetEventFilter(quit_filter, NULL);
| ^~~~~~~Compiling .pio/build/emulator_64bits/src/inter_medium_35.o
~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:145:5: warning: implicit declaration of function ‘SDL_StartTextInput’ [-Wimplicit-function-declaration]
145 | SDL_StartTextInput();
| ^~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:150:5: warning: implicit declaration of function ‘SDL_CreateThread’ [-Wimplicit-function-declaration]
150 | SDL_CreateThread(tick_thread, "tick", NULL);
| ^~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘sdl_event_handler’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:346:5: error: unknown type name ‘SDL_Event’
346 | SDL_Event event;
| ^~~~~~~~~
Compiling .pio/build/emulator_64bits/src/main.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:347:11: warning: implicit declaration of function ‘SDL_PollEvent’ [-Wimplicit-function-declaration]
347 | while(SDL_PollEvent(&event)) {
| ^~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:348:9: warning: implicit declaration of function ‘mouse_handler’ [-Wimplicit-function-declaration]
348 | mouse_handler(&event);
| ^~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:349:9: warning: implicit declaration of function ‘mousewheel_handler’ [-Wimplicit-function-declaration]
349 | mousewheel_handler(&event);
| ^~~~~~~~~~~~~~~~~~
Compiling .pio/build/emulator_64bits/src/test.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:350:9: warning: implicit declaration of function ‘keyboard_handler’ [-Wimplicit-function-declaration]
350 | keyboard_handler(&event);
| ^~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:352:20: error: request for member ‘type’ in something not a structure or union
352 | if((&event)->type == SDL_WINDOWEVENT) {
| ^~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:352:30: error: ‘SDL_WINDOWEVENT’ undeclared (first use in this function)
352 | if((&event)->type == SDL_WINDOWEVENT) {
| ^~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:353:28: error: request for member ‘window’ in something not a structure or union
353 | switch((&event)->window.event) {
| ^~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:354:24: error: missing binary operator before token "("
354 | #if SDL_VERSION_ATLEAST(2, 0, 5)
| ^
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:357:22: error: ‘SDL_WINDOWEVENT_EXPOSED’ undeclared (first use in this function)
357 | case SDL_WINDOWEVENT_EXPOSED:
| ^~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: At top level:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:399:34: error: unknown type name ‘SDL_Event’
399 | int quit_filter(void * userdata, SDL_Event * event)
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘monitor_sdl_clean_up’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:417:5: warning: implicit declaration of function ‘SDL_DestroyTexture’ [-Wimplicit-function-declaration]
417 | SDL_DestroyTexture(monitor.texture);
| ^~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:418:5: warning: implicit declaration of function ‘SDL_DestroyRenderer’ [-Wimplicit-function-declaration]
418 | SDL_DestroyRenderer(monitor.renderer);
| ^~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:419:5: warning: implicit declaration of function ‘SDL_DestroyWindow’ [-Wimplicit-function-declaration]
419 | SDL_DestroyWindow(monitor.window);
| ^~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:428:5: warning: implicit declaration of function ‘SDL_Quit’ [-Wimplicit-function-declaration]
428 | SDL_Quit();
| ^~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘window_create’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:439:17: warning: implicit declaration of function ‘SDL_CreateWindow’ [-Wimplicit-function-declaration]
439 | m->window = SDL_CreateWindow("TFT Simulator",
| ^~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:440:31: error: ‘SDL_WINDOWPOS_UNDEFINED’ undeclared (first use in this function)
440 | SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
| ^~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:37:33: error: ‘MONITOR_HOR_RES’ undeclared (first use in this function)
37 | # define SDL_HOR_RES MONITOR_HOR_RES
| ^~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:441:31: note: in expansion of macro ‘SDL_HOR_RES’
441 | SDL_HOR_RES * SDL_ZOOM, SDL_VER_RES * SDL_ZOOM, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:38:33: error: ‘MONITOR_VER_RES’ undeclared (first use in this function)
38 | # define SDL_VER_RES MONITOR_VER_RES
| ^~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:441:55: note: in expansion of macro ‘SDL_VER_RES’
441 | SDL_HOR_RES * SDL_ZOOM, SDL_VER_RES * SDL_ZOOM, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:443:19: warning: implicit declaration of function ‘SDL_CreateRenderer’ [-Wimplicit-function-declaration]
443 | m->renderer = SDL_CreateRenderer(m->window, -1, SDL_RENDERER_SOFTWARE);
| ^~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:443:53: error: ‘SDL_RENDERER_SOFTWARE’ undeclared (first use in this function)
443 | m->renderer = SDL_CreateRenderer(m->window, -1, SDL_RENDERER_SOFTWARE);
| ^~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:444:18: warning: implicit declaration of function ‘SDL_CreateTexture’ [-Wimplicit-function-declaration]
444 | m->texture = SDL_CreateTexture(m->renderer,
| ^~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:445:33: error: ‘SDL_PIXELFORMAT_ARGB8888’ undeclared (first use in this function)
445 | SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, SDL_HOR_RES, SDL_VER_RES);
| ^~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:445:59: error: ‘SDL_TEXTUREACCESS_STATIC’ undeclared (first use in this function)
445 | SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, SDL_HOR_RES, SDL_VER_RES);
| ^~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:446:5: warning: implicit declaration of function ‘SDL_SetTextureBlendMode’ [-Wimplicit-function-declaration]
446 | SDL_SetTextureBlendMode(m->texture, SDL_BLENDMODE_BLEND);
| ^~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:446:41: error: ‘SDL_BLENDMODE_BLEND’ undeclared (first use in this function)
446 | SDL_SetTextureBlendMode(m->texture, SDL_BLENDMODE_BLEND);
| ^~~~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘window_update’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:463:5: warning: implicit declaration of function ‘SDL_UpdateTexture’ [-Wimplicit-function-declaration]
463 | SDL_UpdateTexture(m->texture, NULL, m->tft_fb, SDL_HOR_RES * sizeof(uint32_t));
| ^~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:37:33: error: ‘MONITOR_HOR_RES’ undeclared (first use in this function)
37 | # define SDL_HOR_RES MONITOR_HOR_RES
| ^~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:463:52: note: in expansion of macro ‘SDL_HOR_RES’
463 | SDL_UpdateTexture(m->texture, NULL, m->tft_fb, SDL_HOR_RES * sizeof(uint32_t));
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:468:5: warning: implicit declaration of function ‘SDL_RenderClear’ [-Wimplicit-function-declaration]
468 | SDL_RenderClear(m->renderer);
| ^~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:477:5: warning: implicit declaration of function ‘SDL_RenderCopy’ [-Wimplicit-function-declaration]
477 | SDL_RenderCopy(m->renderer, m->texture, NULL, NULL);
| ^~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:478:5: warning: implicit declaration of function ‘SDL_RenderPresent’ [-Wimplicit-function-declaration]
478 | SDL_RenderPresent(m->renderer);
| ^~~~~~~~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: At top level:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:481:27: error: unknown type name ‘SDL_Event’
481 | static void mouse_handler(SDL_Event * event)
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:523:32: error: unknown type name ‘SDL_Event’
523 | static void mousewheel_handler(SDL_Event * event)
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:557:30: error: unknown type name ‘SDL_Event’
557 | static void keyboard_handler(SDL_Event * event)
| ^~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:592:37: error: unknown type name ‘SDL_Keycode’
592 | static uint32_t keycode_to_ctrl_key(SDL_Keycode sdl_key)
| ^~~~~~~~~~~
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c: In function ‘tick_thread’:
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:646:9: warning: implicit declaration of function ‘SDL_Delay’ [-Wimplicit-function-declaration]
646 | SDL_Delay(5);
| ^~~~~~~~~
*** [.pio/build/emulator_64bits/lib4c2/lv_drivers/sdl/sdl.o] Error 1
In file included from hal/sdl2/app_hal.c:5:
.pio/libdeps/emulator_64bits/lv_drivers/indev/mouse.h:26:2: warning: #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
26 | #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
In file included from hal/sdl2/app_hal.c:6:
.pio/libdeps/emulator_64bits/lv_drivers/indev/mousewheel.h:26:2: warning: #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
26 | #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
In file included from hal/sdl2/app_hal.c:7:
.pio/libdeps/emulator_64bits/lv_drivers/indev/keyboard.h:26:2: warning: #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c" [-Wcpp]
26 | #warning "Deprecated, use the SDL driver instead. See lv_drivers/sdl/sdl.c"
| ^~~~~~~
hal/sdl2/app_hal.c: In function ‘hal_setup’:
hal/sdl2/app_hal.c:40:12: error: unknown type name ‘lv_disp_buf_t’
40 | static lv_disp_buf_t disp_buf;
| ^~~~~~~~~~~~~
hal/sdl2/app_hal.c:41:27: error: ‘LV_HOR_RES_MAX’ undeclared (first use in this function); did you mean ‘LV_HOR_RES’?
41 | static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/
| ^~~~~~~~~~~~~~
| LV_HOR_RES
hal/sdl2/app_hal.c:41:27: note: each undeclared identifier is reported only once for each function it appears in
hal/sdl2/app_hal.c:42:5: warning: implicit declaration of function ‘lv_disp_buf_init’; did you mean ‘lv_disp_drv_init’? [-Wimplicit-function-declaration]
42 | lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
| ^~~~~~~~~~~~~~~~
| lv_disp_drv_init
hal/sdl2/app_hal.c:47:13: error: ‘lv_disp_drv_t’ {aka ‘struct _lv_disp_drv_t’} has no member named ‘buffer’
47 | disp_drv.buffer = &disp_buf;
| ^
*** [.pio/build/emulator_64bits/hal/sdl2/app_hal.o] Error 1
============================================================================= [FAILED] Took 4.26 seconds =============================================================================
Environment Status Duration
--------------- -------- ------------
emulator_64bits FAILED 00:00:04.256
======================================================================= 1 failed, 0 succeeded in 00:00:04.256 =======================================================================
The terminal process "platformio 'run', '--environment', 'emulator_64bits'" terminated with exit code: 1.
I agree with @bewing that a full how-to tutorial wouldbe very much appreciated.