Posted by tosh 3/29/2025
https://www.nxp.com/design/design-center/software/developmen...
https://lupyuen.github.io/pinephone-lvgl-zig/
I just recently returned to Zig, and started porting the build file (zig cc calls) to latest Zig (build.zig), but struggling to compile the C LVGL to WASM I suspect because LVGL has a few dependencies on standard C bits n bobs, and I cant find a way to reference the C header files needed.
Anyway, just to say that I found the simplicity of LVGL a breath of fresh air. When I first looked at the PinePhone I was struggling to work out how to access the Mali GPU, thinking I'd be doing UI via OpenGL ES. But seeing how well LVGL and the simple frame-buffer approach works, I abandoned that approach all together. Thanks lupyuen!
It is also nice having the UI in WASM for iterative development without the slow deploy to phone hardware.
I was also able to simply extend an LVGL widget to show a 32bit register contents for debugging my SoC work. A huge time saver.
So a big thanks to the LVGL team on the library, and especially the detailed documentation and examples.
If you want to build something, step 1 is always: empower the developer.
It can be a bit difficult to get going on a specific platform, but once you have it going, it's smooth sailing.
How does it interact with the screen then?
Instead of a full GPU, some microcontrollers may have a special "Blitter" engine...for instance NXP has a "Pixel Pipeline-Processor" (PXP) engine which is just-enough hardware for scaling, rotating, alpha-blending, and copying pixels, and it is for instance possible to configure lvgl to use the PXP to handle such grunt work while leaving the rest of lvgl rendering to software.
Out of curiosity I'm looking at the most recent demo video LVGL posted, which benchmarked an ESP32-S2, and it's getting between 50ms-100ms for various tests like rotating multiple bitmaps and such.[1] So seems like the "100ms" number I pulled was quite apprirate for what LVGL can do on on a popular modern microcontroller.
(Also note for any readers: when I typed "1fps", that wasn't a typo for "10 fps". An embedded application would be wanting to do something else for that ~90% remaining CPU time each second that is not spent software-rendering the GUI.)
See for examples ILI9341 or SSD1306 displays[1] or integrated boards with (often) an ESP32 microcontroller and a display attached[2].
[1] displays: https://www.google.com/search?q=SSD1306+OR+ILI9341+display&u...
[2] integrated: https://www.aliexpress.us/w/wholesale-ESP32-LVGL.html?spm=a2...
[1] https://docs.lvgl.io/master/details/integration/renderers/in... [2] https://docs.lvgl.io/master/details/main-modules/draw.html#d... [3] https://github.com/lvgl/lvgl/issues/6763#issuecomment-262319...
This is a very low level embedded GUI library when you have a screen where you just set pixel colors or can draw some primitives like lines.
This is not something you would use to program a GUI program running in a real desktop OS.
But you still could in a framebuffer (actual on linux or emulated). This makes a lvgl GUI a cross platform experience from embedded to web to desktop...you could just make one GUI for your thermostat's physical display which could also be the same GUI you use when accessing it over the network via an emscripten webpage.
As you wrote these aren't made for desktop apps, but you can use desktop apps to help with UI development using these libraries.
For LVGL there's SquareLine Studio[2], I used it a few years ago and it was helpful. For TouchGFX there's TouchGFXDesigner[3], I haven't used it myself and it seems to run only on Windows.
[2] https://www.st.com/en/development-tools/touchgfxdesigner.htm...
Indeed. In addition to that, I think that library is less than ideal for chips with an integrated 3D graphics hardware, like ARM Mali. Except applications with very low-resolution screens way below 1 megapixel, in which case CPU software rendering should be fine.
You can run it under sdl in a regular windowing desktop environment too, but as stated, that's really not what it's best suited for. It's really meant for the small embedded stuff, for which I personally think it's excellent.
I also thought they were trying to make it capable of talking advantage of some of the accelerated graphics capabilities on some of the small/embedded boards (nxp maybe?), but it's been a while since I was paying attention and I'd have to dig through the GitHub issues/posts again.
There are a few of those like Dear ImGui that are pretty mature and time-tested