Code Monkey home page Code Monkey logo

lv_platformio's Introduction

Run LittlevGL via PlatformIO

CI

This demo should help you to organize your project with awesome PlatformIO IDE.

  1. It automates installing everything - just open folder with this project in vscode, and agree to install all it offers.
  2. It contains working LittlevGL demo, runnable on both are metal and PC.
  3. It has example, how to configure PlatomIO.

How to install & use demo

Install Visual Studio Code

https://code.visualstudio.com/ - follow instructions there, if you don't have vscode yet.

Install SDL drivers

Linux (Ubuntu, Debian, ...)

Use one of options below:

# 64 bits
sudo apt-get install libsdl2-dev
# 32 bits
sudo apt-get install gcc-multilib g++-multilib libsdl2-dev:i386

Note:

  • Use 32-bits build for more correct memory stat info.
  • If you have conflicts on libsdl2-dev:i386 install, remove 64-bits version and dependencies first.

MacOS

Use Homebrew:

brew install sdl2

Note: On MacOS you need to include (uncomment in provided example platformio.ini file) these lines in your platformio.ini file to import the drivers:

  ; SDL2 includes
  !find /opt/homebrew/Cellar/sdl2 -name "include" | sed "s/^/-I /"
  !find /opt/homebrew/Cellar/sdl2 -name "libSDL2.a" | xargs dirname | sed "s/^/-L /"

If you get the following error on M-chip Mac with VSCode, you can add -arch arm64 to build_flags in platformio.ini or just run pio run -e emulator_64bits -t execute in the system Python environment. (pio should be installed in system Python first).

ld: warning: ignoring file '/opt/homebrew/Cellar/sdl2/2.30.1/lib/libSDL2-2.0.0.dylib': found architecture 'arm64', required architecture 'x86_64'
ld: Undefined symbols:
  _SDL_CreateRenderer, referenced from:
      _window_create in sdl.o
...

Windows

Use MSYS2

pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2

Add the path to your Mingw-w64 bin folder to the Windows PATH environment variable (usually C:\msys64\mingw64\bin). See instruction, 4.

Install flasher drivers (optional)

If you plan to upload firmware & debug hardware, read notes in PlatformIO install docs.

Build/Run

  1. Clone this repository or download as zip.
  2. In vscode, open folder via File -> Open Folder... menu.
    • If you do it first time - agree, when it suggests to install PlatformIO plugin, and wait when PlatformIO then install build tools and package dependencies.

To build/execute, on PlafomIO tab expand desired env and click target:

Note, for emulator env upload also executes compiled binary.

lv_platformio's People

Contributors

45gfg9 avatar bjwschaap avatar e7h4n avatar embeddedt avatar kisvegabor avatar pkerspe avatar puzrin avatar richardclli avatar zmeiresearch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lv_platformio's Issues

Build fails due to missing lvgl.h

When i run platformio build, i get the following error:

Processing stm32f429_disco (platform: ststm32; board: disco_f429zi; framework: stm32cube)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Warning! Library `{'requirements': '^6.0', 'name': 'LittlevGL'}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'requirements': '^6.0', 'name': 'LittlevGL'}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/disco_f429zi.html
PLATFORM: ST STM32 > ST 32F429IDISCOVERY
HARDWARE: STM32F429ZIT6 180MHz 256KB RAM (2MB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 31 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/stm32f429_disco/drivers/stm32f429_disco/driver.o
Compiling .pioenvs/stm32f429_disco/drivers/stm32f429_disco/stm32f4xx_it.o
Compiling .pioenvs/stm32f429_disco/drivers/stm32f429_disco/system_stm32f4xx.o
Compiling .pioenvs/stm32f429_disco/src/demo.o
In file included from src/demo.c:9:0:
src/demo.h:18:10: fatal error: lvgl.h: No such file or directory

**************************************************************
* Looking for lvgl.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:lvgl.h"
* Web  > https://platformio.org/lib/search?query=header:lvgl.h
*
**************************************************************

#include <lvgl.h>
^~~~~~~~
compilation terminated.
*** [.pioenvs/stm32f429_disco/src/demo.o] Error 1
drivers/stm32f429_disco/driver.c:3:10: fatal error: stm32f429_disco/stm32f429i_discovery.h: No such file or directory
#include "stm32f429_disco/stm32f429i_discovery.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
drivers/stm32f429_disco/stm32f4xx_it.c:21:10: fatal error: lvgl/lv_hal/lv_hal_tick.h: No such file or directory
#include "lvgl/lv_hal/lv_hal_tick.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/stm32f429_disco/drivers/stm32f429_disco/driver.o] Error 1
*** [.pioenvs/stm32f429_disco/drivers/stm32f429_disco/stm32f4xx_it.o] Error 1
drivers/stm32f429_disco/system_stm32f4xx.c:139:0: error: unterminated #if
#if BUILD_ENV_NAME == stm32f429_disco

drivers/stm32f429_disco/system_stm32f4xx.c:132:0: error: unterminated #if
#if BUILD_ENV_NAME == stm32f429_disco

drivers/stm32f429_disco/system_stm32f4xx.c:66:0: error: unterminated #if
#if BUILD_ENV_NAME == stm32f429_disco

*** [.pioenvs/stm32f429_disco/drivers/stm32f429_disco/system_stm32f4xx.o] Error 1
============================================================================ [ERROR] Took 1.86 seconds ============================================================================

==================================================================================== [SUMMARY] ====================================================================================
Environment native         	[ERROR]
Environment stm32f429_disco	[ERROR]
============================================================================ [ERROR] Took 3.34 seconds ============================================================================

Trying to install lvgl using platformio lib install lvgl yields the following output:

************************************************************************************************************************************************************************************
Obsolete PIO Core v3.6.7 is used (previous was 4.0.3)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/page/faq.html#multiple-pio-cores-in-a-system
************************************************************************************************************************************************************************************
Library Storage: /Users/jsphpl/clients/cheese/lv_platformio/.piolibdeps
LibraryManager: Installing id=6598
lvgl @ 6.0.2 is already installed

Can someone please point me into the right direction?

Thanks a lot!

Execute error on fresh install

I installed the pre-requisites and commented out the 32-bit line (I don't have the libs and 64-bit is just fine). Other than that, it's a clean install. Opened the folder in VSCode, ran Task... Execute (Native) and got the following error:

> Executing task: ./.pio/build/native/program <

/bin/bash: ./.pio/build/native/program: No such file or directory
The terminal process "/bin/bash '-c', './.pio/build/native/program'" failed to launch (exit code: 127).

Terminal will be reused by tasks, press any key to close it.

Any help appreciated!

Drop sdl2:i386 support?

Seems not critical, and causes too many problems - install of sdl2:i386 can not co-exists with x64.

Or need to autodetect intstalled lib somehow.

Add Windows SDL2 build support

Demo now supports sdl2 in Linux & Macos. Windows user can build bare metal env, but can't built emulator env. Unfortunately, i don't use Windows and have no time to add this feature. But i can help with PIO scripting and CI tests if anyone wish to care about Win.

Suggested plan is:

  • Clone this repo for standalone experiments, to not care about other OS-es support.
  • Create repo with SDL2 dlls & headers, to be used as dependency lib.
  • Add created repo as library to platform.ini (don't worry about other OS-es at this step)
  • Try to build & add search paths to build options if needed
  • If works - kick me, to help with PR prepare.

I also prepared template for CI testing.

a new language

hi,how can i add a new language such persian or arabic to this programm

MacOS:'SDL2/SDL.h' file not found

When I try to compile main.c, I encounter this problem.
The details are as follow

> Executing task: platformio run --environment emulator_64bits <

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
|-- <lvgl> 8.2.0
|-- <lv_drivers> 8.2.0
|   |-- <lvgl> 8.2.0
Building in release mode
Compiling .pio/build/emulator_64bits/lib44b/lv_drivers/sdl/sdl.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_2.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_2_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_3.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_3_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_4.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_icon_4_large.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/music/assets/img_lv_demo_music_list_border.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:53:10: fatal error: 'SDL2/SDL.h' file not found
#include SDL_INCLUDE_PATH
         ^~~~~~~~~~~~~~~~
<command line>:12:26: note: expanded from here
#define SDL_INCLUDE_PATH "SDL2/SDL.h"
                         ^~~~~~~~~~~~
1 error generated.
*** [.pio/build/emulator_64bits/lib44b/lv_drivers/sdl/sdl.o] Error 1
========================== [FAILED] Took 2.36 seconds ==========================

Environment      Status    Duration
---------------  --------  ------------
emulator_64bits  FAILED    00:00:02.365
==================== 1 failed, 0 succeeded in 00:00:02.365 ====================
终端进程“platformio 'run', '--environment', 'emulator_64bits'”已终止,退出代码: 1。

终端将被任务重用,按任意键关闭。

I Found Some Solution On This Website
https://stackoverflow.com/questions/10488775/sdl-h-no-such-file-or-directory-found-when-compiling
I think it's the solution to this SDL problem, but I still don't know how to fix it.
THX for your help!

Devboard drivers cleanup

@kisvegabor Seems /drivers/stm32f429_disco duplicates a lot of files, already available in PIO. When board defined in config, that include appropriate HAL drivers + board-specific BSP drivers. Could you remove c/h pairs one-by-one an check if app build still works on hardware?

Candidates to remove - everything with ST copyright info.

Simulator: Printf not working at runtime | Simulator starts twice

Hello,
im using the simulator with platformio and used this repo example.
When i upload the project the simulator starts. When i close it another windows opens. This is essential for the following problem

I want to debug the code with printf command. So i defined following in platform.ini file:

-D LV_USE_LOG=1
-D LV_LOG_PRINTF=1

Default log level is : -D LV_LOG_LEVEL=LV_LOG_LEVEL_WARN
During runtime i dont get an output. When i close the Simulator window, the print output is now seen on the output. The second windows open, but the print output from it is not seen after closing.

However, when i change the log level to -D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO the print output can now be seen during runtime. thi s isnt useful, because too much output is beeing listed.

I hope the problem is understandable. Is this a bug or is there a solution?

Macro errors when compiling fresh out of the box

On Ubuntu 19 not touching anything after git clone and running pio for native target in either terminal or vscode I get the following errors:

In file included from .pio/libdeps/native/lvgl_ID6598/lvgl.h:19,
from src/demo.h:18,
from src/demo.c:9:
.pio/libdeps/native/lvgl_ID6598/src/lv_misc/lv_log.h:29:28: error: expected declaration specifiers or ‘...’ before numeric constant
29 | #define LV_LOG_LEVEL_TRACE 0 /**< A lot of logs to give detailed information*/
:
:
ad lib

----- Version info --------------------------------------------------------------------------
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix

Problem building

Been trying to get this going for the better part of a a day. Instructed in the forum to post here. Link to the thread can be found here.

When I try to build, this is the output I'm presented with:

Verbose mode can be enabled via -v, --verbose option
PACKAGES:
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies…
Dependency Graph
|-- 6.0
|-- <littlevgl_sdl_drivers> 1.1
Compiling .pio/build/native/src/demo.o
Compiling .pio/build/native/src/img_bubble_pattern.o
Compiling .pio/build/native/src/main.o
Compiling .pio/build/native/lib72b/littlevgl_ID6228/lv_core/lv_disp.o
In file included from src/demo.c:9:
include/demo.h:18:10: fatal error: ‘lvgl.h’ file not found
#include <lvgl.h>
^~~~~~~~
1 error generated.
src/img_bubble_pattern.c:2:10: fatal error: ‘lvgl.h’ file not found
#include <lvgl.h>
^~~~~~~~
*** [.pio/build/native/src/demo.o] Error 1

I’ve tried running “Update project libraries” to no avail. The dependent libs(lvgl and the sdldrivers) are located in .pio/libdeps/native so I have no idea why the PIO build isn't picking them up, thought PIO was made to exactly solve this problem, that is not to manually have to manage you include paths and libs?

Build Error:No such file or directory

After my inspection, these files existed, but since there were no separators in the middle of the path that caused me not to find those files, how do I change them?

image

error: 'for' loop initial declaration used outside C99 mode

Hi, I'm trying to start with lvgl.
Following the README steps for Windows, at the execution in PlatformIO the output is the error

.pio\libdeps\emulator_64bits\lvgl\src\core\lv_obj.c: In function 'lv_obj_event':
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_obj.c:734: error: 'for' loop initial declaration used outside C99 mode
*** [.pio\build\emulator_64bits\lib0e3\lvgl\core\lv_obj.o] Error 1
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c: In function 'draw_buf_rotate_90':
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c:825: error: 'for' loop initial declaration used outside C99 mode
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c:829: error: 'for' loop initial declaration used outside C99 mode
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c: In function 'draw_buf_rotate_90_sqr':
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c:858: error: 'for' loop initial declaration used outside C99 mode
.pio\libdeps\emulator_64bits\lvgl\src\core\lv_refr.c:859: error: 'for' loop initial declaration used outside C99 mode
*** [.pio\build\emulator_64bits\lib0e3\lvgl\core\lv_refr.o] Error 1

Do I have to change some setting of PlatformIO?
Thanks

Space in native build target

Hi there.

Shouldn't it be [env:native] instead of [env:nativ e] in platformio.ini (?
If a space is used the executable is in ./.pio/build/nativ\ e/program and not in ./.pio/build/native/program.

FreeBSD

PlatformIO does not seem to work on FreeBSD? I have installed VSCode, installed PlatfomIO plugin with no error, but it does not seem to wok, results in error..

lvgl (core) for PlatformIO IDE fails to compile when installed - Several Issues to fix it

Important: issues that don't use this template will be ignored/closed.

Describe the bug
Installing lvgl (core) using the PlatformIO IDE fails to compile without errors. Failures are related to header files and directory references included during compile process.

A clear and concise description of what the bug is.
Problem lvgl/lvgl#1 - The installer places the library at C:\users[username].platformio\lib\lvgl_ID6598
That's Ok, but the root directory is no longer called lvgl, it is now called lvgl_ID6598. So any references in header files to lvgl/src/something is broken. Sorry, don't remember the files(s) I needed to fix this problem, but I think the fix for this was to remove the first level "lvgl/" from the include statement.
Problem lvgl/lvgl#2. - Most of the Header Files have an #include "../../../lv_conf.h" statement. This causes the compiler to look one level too high in the path. The fix is to change all header files to say
#include "../../lv_conf.h, removing one level of directory search. There are a lot of files to change.

To Reproduce
Do a clean Install under PlatformIO IDE and attempt to compile the library. You need to add the lib_deps = lvgl to the platformio.ini file to get it to see the new library.

Let me know if you need any other information or help with this problem.

Jerry

Support lvgl released V8.3.0?

Hi, I am new to lvgl/Platform IO and I use this project to have a try.It is very successful(8.2.0).
But I want to update lvgl to released 8.3.0 and continue to reuse this project again.Compiling was fine but executing was broken.I don't where goes wrong and no issues related to this similiar situation.
I want to figure it out but I'm not a professional developer.
This picture shows compile with 8.3.0 is ok.
image

Picture under is the broken captured.platformio.ini as well.
image

Update to 7.0.0 Please!

First of all, thanks for this marvelous software and congratulation in your news achievements!

I'm so exited to test out the 7.0.0 version.
But it will be Wonderfull if you could update this simulator!

Thanks in advance.

环境问题

image
怎么突然多了 许多奇奇怪怪的 有没有大佬 帮忙解决一下

Win11_PlatfomIO_Build_Issues

Hi,

First I have to say that the work being done with LVGL is amazing. I hope to contribute to it.

I'm having issues with the porting to PlatformIO, though.

Followed instalation as described on the main page. Also as described here https://code.visualstudio.com/docs/cpp/config-mingw#_prerequisites.

I checked #7 and #17 for possible fixes. But build fails

Any help is appreciated.

I get the following on the terminal:

Executing task: C:\Users\tigo_.platformio\penv\Scripts\platformio.exe run

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 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- lvgl @ 8.2.0
|-- lv_drivers @ 8.2.0
| |-- lvgl @ 8.2.0
Building in release mode
Compiling .pio\build\emulator_64bits\libcbf\lv_drivers\sdl\sdl.o
: fatal error: SDL2/SDL.h: No such file or directory
compilation terminated.
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\stress\assets\lv_font_montserrat_28_compr_az.o
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\stress\lv_demo_stress.o
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\widgets\assets\img_clothes.o
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\widgets\assets\img_demo_widgets_avatar.o
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\widgets\assets\img_lvgl_logo.o
Compiling .pio\build\emulator_64bits.pio\libdeps\emulator_64bits\lvgl\demos\widgets\lv_demo_widgets.o
Compiling .pio\build\emulator_64bits\hal\sdl2\app_hal.o
*** [.pio\build\emulator_64bits\libcbf\lv_drivers\sdl\sdl.o] Error 1
Compiling .pio\build\emulator_64bits\src\main.o
hal\sdl2\app_hal.c:3:10: fatal error: SDL2/SDL.h: No such file or directory
3 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
*** [.pio\build\emulator_64bits\hal\sdl2\app_hal.o] Error 1
============================================== [FAILED] Took 9.67 seconds ==============================================

Environment Status Duration


emulator_64bits FAILED 00:00:09.675
======================================== 1 failed, 0 succeeded in 00:00:09.675 ========================================

  • The terminal process "C:\Users\tigo_.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

Undefined reference to 'lv_example_x_x' on PlatformIO

Perform all steps below and tick them with [x]

  • Read the FAQ
  • Check the related part of the Documentation
  • Update lvgl to the latest version
  • Reproduce the issue in a Simulator

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:

c:/users/x/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/blackpill_f401cc/src/main.cpp.o: in function `setup':
main.cpp:(.text.setup+0xe8): undefined reference to `lv_example_btn_1'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\blackpill_f401cc\firmware.elf] Error 1

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 in lvgl/src/ folder.
To use the latest release of lvgl (version 8.3.8) I added it in the lib 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

  1. create a project on Platformio, add the following libraries using lib_deps :
    ..* TFT_eSPI
    ..* Adafruit TouchScreen (only if using my version of the code)
  2. get the lvgl v8.3.8 release from github, and coping the lvgl folder in the lib folder of the project.
  3. use the arduino lvgl example or use my modified version of it as main.cpp
  4. follow the documentation of LVGL with Arduino
  5. compile

I can't reproduce it on the Code::Blocks simulator.

HARDWARE USED
  • STM32F401CC Blackpill or XIAO ESP32C3
  • 2.4" Waveshare lcd module
  • 2.4" 4 wire resistive touch panel
My modified version of the Arduino Example
//#include <Arduino.h>
/*Using LVGL with Arduino requires some extra steps:
 *Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html  */

#include <lvgl.h>
#include <TFT_eSPI.h>
#include <TouchScreen.h>

/*To use the built-in examples and demos of LVGL uncomment the includes below respectively.
 *You also need to copy `lvgl/examples` to `lvgl/src/examples`. Similarly for the demos `lvgl/demos` to `lvgl/src/demos`.
 Note that the `lv_examples` library is for LVGL v7 and you shouldn't install it for this version (since LVGL v8)
 as the examples and demos are now part of the main LVGL library. */

#include <examples/lv_examples.h>
#include <demos/lv_demos.h>

#define TOUCH_YP PA0
#define TOUCH_XM PA1
#define TOUCH_YM PA2
#define TOUCH_XP PA3

#define MIN_PRESSURE 10
#define MAX_PRESSURE 1000

TouchScreen touchScreen = TouchScreen(TOUCH_XP, TOUCH_YP, TOUCH_XM, TOUCH_YM, 300);

/*Change to your screen resolution*/
static const uint16_t screenWidth  = 320;
static const uint16_t screenHeight = 240;

static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[ screenWidth * screenHeight / 10 ];

TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */

#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char * buf)
{
    Serial.printf(buf);
    Serial.flush();
}
#endif

/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p )
{
    uint32_t w = ( area->x2 - area->x1 + 1 );
    uint32_t h = ( area->y2 - area->y1 + 1 );

    tft.startWrite();
    tft.setAddrWindow( area->x1, area->y1, w, h );
    tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
    tft.endWrite();

    lv_disp_flush_ready( disp_drv );
}

/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_drv, lv_indev_data_t * data )
{
    TSPoint touchPoint = touchScreen.getPoint();

    if (touchPoint.z > MIN_PRESSURE && touchPoint.z < MAX_PRESSURE)
    {

        int lvglX = map(touchPoint.x, 0, 1023, -10, screenWidth*1.18);
        int lvglY = map(touchPoint.y, 0, 1023, -20, screenHeight*1.29);
        data->state = LV_INDEV_STATE_PR;
        data->point.x = lvglX;
        data->point.y = lvglY;
        Serial.print("X = "); Serial.print(touchPoint.x);
        Serial.print("\tY = "); Serial.print(touchPoint.y);
        Serial.print("\tPressure = "); Serial.println(touchPoint.z);
        Serial.print("mapped X = "); Serial.print(lvglX);
        Serial.print("\tmapped Y = "); Serial.println(lvglY);
    }
    else
    {
        data->state = LV_INDEV_STATE_REL;
    }
}

void setup()
{
    Serial.begin( 115200 ); /* prepare for possible serial debug */
    analogReadResolution(10); //needed for the resistive touch to work
    String LVGL_Arduino = "Hello Arduino! ";
    LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();

    Serial.println( LVGL_Arduino );
    Serial.println( "I am LVGL_Arduino" );

    lv_init();

#if LV_USE_LOG != 0
    lv_log_register_print_cb( my_print ); /* register print function for debugging */
#endif

    tft.begin();          /* TFT init */
    tft.setRotation( 3 ); /* Landscape orientation, flipped */

    /*Set the touchscreen calibration data,
     the actual data for your display can be acquired using
     the Generic -> Touch_calibrate example from the TFT_eSPI library*/
    // uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
    // tft.setTouch( calData );

    lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 );

    /*Initialize the display*/
    static lv_disp_drv_t disp_drv;
    lv_disp_drv_init( &disp_drv );
    /*Change the following line to your display resolution*/
    disp_drv.hor_res = screenWidth;
    disp_drv.ver_res = screenHeight;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.draw_buf = &draw_buf;
    lv_disp_drv_register( &disp_drv );

    /*Initialize the (dummy) input device driver*/
    static lv_indev_drv_t indev_drv;
    lv_indev_drv_init( &indev_drv );
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = my_touchpad_read;
    lv_indev_drv_register( &indev_drv );
  
    /* Create simple label */
    lv_obj_t *label = lv_label_create( lv_scr_act() );
    lv_label_set_text( label, "Hello Ardino and LVGL!");
    lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
 
    /* Try an example. See all the examples 
     * online: https://docs.lvgl.io/master/examples.html
     * source codes: https://github.com/lvgl/lvgl/tree/e7f88efa5853128bf871dde335c0ca8da9eb7731/examples */
     lv_example_btn_1();
   
     /*Or try out a demo. Don't forget to enable the demos in lv_conf.h. E.g. LV_USE_DEMOS_WIDGETS*/
    // lv_demo_widgets();               
    // lv_demo_benchmark();          
    // lv_demo_keypad_encoder();     
    // lv_demo_music();              
    // lv_demo_printer();
    // lv_demo_stress();
    
    Serial.println( "Setup done" );
}

void loop()
{
    lv_timer_handler(); /* let the GUI do its work */
    delay( 5 );
}

Expected behavior

Succesful compilation, and the example runs on the LCD of the device

Screenshots or video

hieracy
The Warning is caused by TFT_eSPI because I've not defined a TOUCH_CS pin

output

Emulator not working

The emulator won't run in VS Code on Ubuntu 20.04. All dependencies are installed, it throws an SDL BadValue error
System: Ubuntu 20.04 64-bit

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
|-- lvgl @ 8.2.0
|-- lv_drivers @ 8.2.0
|   |-- lvgl @ 8.2.0
Building in release mode
Configuring upload protocol...
Executing .pio/build/emulator_64bits/program
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  109
  Current serial number in output stream:  110

Repo description update

@kisvegabor seems need to remove BETA from repo's description & refresh text.

I'd suggest Demo of use LittlevGL with PlatformIO, or anything else of this kind.

.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:53:10: fatal error: 'SDL2/SDL.h' file not found

`
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/display/drm.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/display/fbdev.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/gtkdrv/gtkdrv.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/AD_touch.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/FT5406EE8.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/XPT2046.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/evdev.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/libinput.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/indev/xkb.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/sdl/sdl.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/sdl/sdl_gpu.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/wayland/wayland.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/win32drv/win32drv.o
Compiling .pio/build/emulator_64bits/liba79/lv_drivers/win_drv.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/img_benchmark_cogwheel_alpha16.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/img_benchmark_cogwheel_argb.o
.pio/libdeps/emulator_64bits/lv_drivers/sdl/sdl.c:53:10: fatal error: 'SDL2/SDL.h' file not found
#include SDL_INCLUDE_PATH
^~~~~~~~~~~~~~~~
:12:26: note: expanded from here
#define SDL_INCLUDE_PATH "SDL2/SDL.h"
^~~~~~~~~~~~
1 error generated.
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/img_benchmark_cogwheel_chroma_keyed.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/img_benchmark_cogwheel_indexed16.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/img_benchmark_cogwheel_rgb.o
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/lv_font_bechmark_montserrat_12_compr_az.c.o
*** [.pio/build/emulator_64bits/liba79/lv_drivers/sdl/sdl.o] Error 1
Compiling .pio/build/emulator_64bits/.pio/libdeps/emulator_64bits/lvgl/demos/benchmark/assets/lv_font_bechmark_montserrat_16_compr_az.c.o
=============================================== [FAILED] Took 2.28 seconds ===============================================

Environment Status Duration


emulator_64bits FAILED 00:00:02.280
========================================== 1 failed, 0 succeeded in 00:00:02.280 ==========================================

  • The terminal process "platformio 'run', '--environment', 'emulator_64bits'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.
    `

Mac - duplicate symbols

After following instructions in the readme and making no changes to lv_conf or platformio.ini, I encounter the following when pressing execute for 64bit (apologies if i am missing something obvious, i am noob):

Screen Shot 2022-10-18 at 3 52 02 PM

Any help is greatly appreciated!

set background color of SDL main window

I try to use below code to change the default white background color to black, but nothing happend.

  lv_disp_set_bg_color(NULL, lv_color_black());
  lv_disp_set_bg_opa(NULL, LV_OPA_COVER);

Is there a bug of code, or limitation of simulator about it?

TYIA.

Impossible to compile + stdint.h missing

Hello,
I've installed on my Windows 11 machine all of the stuff required (vscode / msys2 / mingw / sdl / platform io / repository cloning).
Once I try compile for the 64 bit emulator (or 32 bit one), GCC return with the following compilation error : "Too many arguments".
So I've replaced the line -D LV_MEM_SIZE="(128U * 1024U)" by -D LV_MEM_SIZE=(128U * 1024U) and it allowed the compilation to go further.
But now I get another error in almost every lvgl files : stdint.h: No such file or directory and stdbool.h: No such file or directory which is kind of strange since it's a C/C++ standard lib.
Thank you in advance.

Still issues with finding the lv_conf.h

First I've copied the library locally, that works fine. But I would like it to easily be updated and distributed. So I tried working with the Platformio Library:

lib_deps =
[email protected]

According to the documentation I've added the lv_conf.h to the src folder and added these lines in the ini file:

build_flags =
-D LV_LVG_H_INCLUDE_SIMPLE
; -I src Required to find lv_conf.h
-I src

But I still get the error:
.pio\libdeps\nextGen\lvgl_ID6598\src\lv_core\lv_obj.h:19:30: fatal error: ../../../lv_conf.h: No such file or directory compilation terminated.

Any suggestions?

Thanks!
David

Can't find sys/times.h during vscode building in windows 7

Below is the building output:

Executing task: E:\Cadence\SPB_Data.platformio\penv\Scripts\platformio.exe run <

Processing native (platform: native)

Verbose mode can be enabled via -v, --verbose option
PACKAGES:
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- 6.0.2
|-- <lv_drivers> 6.0.2
| |-- 6.0.2
Compiling .pio\build\native\drivers\sdl2\driver.o
Compiling .pio\build\native\src\demo.o
Compiling .pio\build\native\src\img_bubble_pattern.o
Compiling .pio\build\native\src\main.o
Compiling .pio\build\native\src\syscalls.o
Compiling .pio\build\native\lib34d\lvgl_ID6598\lv_core\lv_disp.o
src\syscalls.c:56:10: fatal error: sys/times.h: No such file or directory
#include <sys/times.h>
^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\native\src\syscalls.o] Error 1

Transform "Run" task to custom target

On development we need to "build & run" sim in one click. This was done via vscode task, but works poor with new version of vscode plugin (v2+).

Possible resolutions:


Also update docs - things shoult be done via explorer tab now.

Support lvgl released V9.0.0?

I have tried to use lvgl v9.0.0 by lv_platformio,
however it occurs some errors as the following

image

How to solve them?
Thank you.

Improve platformio demo/tutorial

In continuation of #667

Goals

Simplify quick-start for beginers and promote modern best practices

  1. Allow setup as simple as possible (1-click preferred).
  2. Allow quick start with interface prototyping without hardware.
  3. Provide good example of project structure.

Suggestion

  1. Create demo/template with platformio (improve existing)
    • When project opened in vscode, it will install as much as possible automatically for current OS (platformio itself, compilers, flashers, lib dependencies, ...).
  2. Support most demanded pio platforms:
  3. Suggest good project structure, to minimize platform-specific code.

For discuss

  • Should demo be RTOS-based to minimize difference between platforms (delays, timers, internal communications)?
  • What platforms should be supported?
    • native - mandatory
    • stm32/esp32 - both optional, just to prove code is working and suggested project structure is convenient.
  • Is it possible to use CubeMX for stm32 specific code setup/update? IMHO it's convenient for beginners and has nice GUI. But it's horrible for integration, because contains main() in generated code.
  • Display content?
    • transparent overlay for debug messages (convenient)
    • "settings" menu with +/- incremented params (popular demand)
    • animated graph (just for fun)
  • anything else missed?

Add STM32F429-discovery support

Summary from #1 (as asked in #1 (comment)).

It would be nice add STM32F429-discovery support or remove build target to avoid users confusion. Adding support is preferable.

What we have now

  1. Skeleton to easy extend demo with new targets and keep common files free of cryptic guards:
  2. Discussion how to activate LCD drivers (were build errors):
  3. Something outdated in stale branch https://github.com/littlevgl/lv_platformio/tree/stm - i don't know if it has something reuseable, so not deleted yet.

What would be nice to get

Minimal case:

  • HAL-based code, runnable on STM32F429-discovery, with display & touch support.

Maxmal case:

  • Previous + third target, mbed-based (instead of HAL). Reasons - people like to use mbed and create many drivers for it.

Notes:

problem building: "register 'sp' unsuitable for global register variables on this target" (and other errors)

Machine: MacOS Mojave 10.14.6 Visual Studio Code Version: 1.38.1

Build output:

> Executing task: platformio run <

Processing native (platform: native)
--------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PACKAGES: 
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <lvgl> 6.0.2
|-- <lv_drivers> 6.0.2
|   |-- <lvgl> 6.0.2
Compiling .pio/build/native/src/syscalls.o
Compiling .pio/build/native/lib4f4/lvgl_ID6598/lv_draw/lv_draw.o
Compiling .pio/build/native/lib4f4/lvgl_ID6598/lv_draw/lv_draw_arc.o
Compiling .pio/build/native/lib4f4/lvgl_ID6598/lv_draw/lv_draw_basic.o
src/syscalls.c:65:31: error: register 'sp' unsuitable for global register variables on this target
register char * stack_ptr asm("sp");
                              ^
src/syscalls.c:116:1: error: unknown type name 'caddr_t'
caddr_t _sbrk(int incr)
^
src/syscalls.c:131:11: error: use of undeclared identifier 'caddr_t'
                return (caddr_t) -1;
                        ^
src/syscalls.c:136:10: error: use of undeclared identifier 'caddr_t'
        return (caddr_t) prev_heap_end;
                ^
4 errors generated.
*** [.pio/build/native/src/syscalls.o] Error 1
============================= [FAILED] Took 4.31 seconds =============================

Environment      Status    Duration
---------------  --------  ------------
native           FAILED    00:00:04.307
stm32f429_disco  IGNORED
======================= 1 failed, 0 succeeded in 00:00:04.307 =======================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

¯_(ツ)_/¯

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.