Open SalmoF opened 1 year ago
Please be sure that LV_BUILD_EXAMPLES
is enabled in lv_conf.h
or the ini
file.
Yes, LV_BUILD_EXAMPLES
is enabled in lv_conf.h
and I have also tried to enable it in the main.cpp
file in the PlatformIO project. As I said on the first comment, if I move the lvgl
library folder in an arduino sketchbook, copy my main.cpp
in to a .ino
file and compile it in the Arduino IDE it compiles successfully. And the board runs both demos and exaples. So this problem is only present in PlatformIO.
EDIT: I now managed to reproduce this issue using the PlatformIO LVGL simulator. i get the following output:
Processing emulator_64bits (platform: native@^1.1.3)
---------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- lv_drivers @ 8.2.0
|-- lvgl @ 8.3.8
Building in release mode
Compiling .pio\build\emulator_64bits\src\main.o
Linking .pio\build\emulator_64bits\program.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .pio/build/emulator_64bits/src/main.o:main.c:(.text+0x18): undefined reference to `lv_example_btn_1'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\emulator_64bits\program.exe] Error 1
I added the LV_BUILD_EXAMPLES
in the .ini
file, and modified the lib_deps
with the following line lvgl=https://github.com/lvgl/lvgl/archive/refs/tags/v8.3.8.zip
so that the compiler loads version 8.3.8 of LVGL.
If i add this line +<../.pio/libdeps/emulator_64bits/lvgl/examples>
in the .ini
file of the emulator under build_src_filter
it compiles and runs.
Then I tried taking the folder lvgl-8.3.8
from my project and put it under the lib
folder of the PlatformIO simulator project.
I changed the build_src_filter
line that i've added before to +<../lib/lvgl-8.3.8/examples>
and worked again.
Doing the same on the .ini
in my project i get the following error:
In file included from .pio\libdeps\blackpill_f401cc\TFT_eSPI\TFT_eSPI.cpp:16:
.pio\libdeps\blackpill_f401cc\TFT_eSPI\TFT_eSPI.h:32:10: fatal error: SPI.h: No such file or directory
*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:SPI.h"
* Web > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************
32 | #include <SPI.h>
| ^~~~~~~
compilation terminated.
Compiling .pio\build\blackpill_f401cc\FrameworkArduino\WSerial.cpp.o
Compiling .pio\build\blackpill_f401cc\FrameworkArduino\WString.cpp.o
*** [.pio\build\blackpill_f401cc\libf81\TFT_eSPI\TFT_eSPI.cpp.o] Error 1
=========================== [FAILED] Took 10.95 seconds ===========================
I believe it's really specific to PIO somehow and can't help much with it. :slightly_frowning_face: I suggest asking it on PIO's forum: https://community.platformio.org/
I also ran into the same problem. The workaround I found is to rename the "examples" folder to something else then everything in it gets compiled. It seems something is filtering out "examples" in the PIO dependency checking process for the lvgl library. I also posted about this problem on PIO forum at https://community.platformio.org/t/undefined-reference-to-lv-example-x-x-on-platformio/34777/3.
I ran into same problem. The version what I use is "release/8.3".
Here is my solution. Add the "lv_example_x_x.c" and "lv_example_widgets.h" to the compilation as well. For example, the function "lv_example_btn_1.c" is located in source_of_lvgl/examples/widgets/btn. The .h of lv_example_btn_1 function is located in source_of_lvgl/examples/widgets/.
Perform all steps below and tick them with [x]
Describe the bug
after compiling the code targeting an Arduino board or similar (in my case i tried with a XIAO ESP32C3 and a Blackpill F401CC), if I enabled a demo on the main.cpp code runs as expected. When i enable an example I get the following compilation error:
I have tried different examples and the result is the same. I've made all of the adjustments needed on the
lv_config.h
and copied the examples and demos folder inlvgl/src/
folder. To use the latest release of lvgl (version 8.3.8) I added it in thelib
folder of my PlatformIO project, because the PlatformIO library registry goes up only to version 8.3.7 (at the time of writing). TFT_eSPI and Adafruit TouchScreen were added with lib_deps.My main.cpp is a modified version of the arduino lvgl example to use the Adafruit Touchscreen library.
To try if the problem was caused by my modifications , I copied the libraries in a folder that I set up as an Arduino Sketchbook and converted the main.cpp in to a .ino file and the code compiled. I was able to run both examples and demos.
I think is an issue of PlatformIO, but I have not found anything useful to my case.
To Reproduce
lib_deps
: .. TFT_eSPI .. Adafruit TouchScreen (only if using my version of the code)lib
folder of the project.main.cpp
I can't reproduce it on the Code::Blocks simulator.
HARDWARE USED
My modified version of the Arduino Example
Expected behavior
Succesful compilation, and the example runs on the LCD of the device
Screenshots or video
The Warning is caused by TFT_eSPI because I've not defined a TOUCH_CS pin