What if i need to build and flash lvgl demo application on torizon OS

Hello,

I am new here, I have tried to build and flash and lvgl demo application in torizon OS, using VS Torizon IDE support and used Torizon Easy paring Image. I have build the demo app image in host, tested and debug also, it was running on display, but when i try to get load in torizon OS it gives me multiple errors like, weston/waylon not found and all. I don’t know how to load the image in torizon. So when the device boots demo app runs insted of easy pairing, can anyone help me to fix this. If you have any doucments or thread related to this that would be very helpful.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Running LVGL Applications on Torizon OS

The issue you’re experiencing is related to the Wayland compositor (Weston) not being available when your LVGL application tries to run. LVGL applications on Torizon OS require Weston to be running first to provide the graphical environment.

Prerequisites for LVGL on Torizon OS

Before running LVGL applications, you need (1):

  • A Toradex System on Module with Torizon OS installed
  • Understanding of GUI Overview
  • Reading and understanding of Debian Containers for Torizon
  • Awareness about Torizon OS Containers Tags and Versioning

Solution: Using Docker Compose

The recommended approach is to use Docker Compose to manage both Weston and your LVGL application containers together. This ensures Weston starts before your application (2).

Example Docker Compose Structure

Your docker-compose.yaml should include both services (2):

services:
  weston:
    # Weston container configuration
  
  your-lvgl-app:
    depends_on:
      - weston
    # Your LVGL application configuration

Starting Weston Container

First, you need to start the Weston Wayland compositor. For different hardware platforms, use the appropriate commands (3):

For i.MX8 modules:

# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston \
    -v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore -v /tmp:/tmp \
    --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
    --device-cgroup-rule="c 4:* rmw" --device-cgroup-rule="c 13:* rmw" \
    --device-cgroup-rule="c 199:0 rmw" --device-cgroup-rule="c 10:223 rmw" \
    torizon/weston-imx8:4 \
    --developer

For AM62 modules:

# docker run -d --rm --name=weston \
    -v /dev/dri:/dev/dri -v /tmp:/tmp \
    --device-cgroup-rule='c 226:* rmw' \
    --device-cgroup-rule="c 4:* rmw" --device-cgroup-rule="c 13:* rmw" \
    --device-cgroup-rule="c 199:0 rmw" --device-cgroup-rule="c 10:223 rmw" \
    torizon/weston-am62:4 \
    --developer

Using VS Code Torizon IDE Extension

You can start using LVGL on Torizon with the VS Code Torizon IDE Extension directly, which provides an out-of-the-box experience (1).

The extension provides ready-to-use LVGL templates as starting points from the VS Code Torizon Templates repository (1).

Key Documentation Resources

For comprehensive guidance on LVGL development with Torizon OS, refer to the detailed guide available at the LVGL documentation, which explains how to create a Docker image with LVGL and deploy a demo application on any Toradex device running Torizon OS (1).

Communication Between Containers

Weston creates a Unix socket file so graphical client applications can communicate with it (typically in the /tmp/1000-runtime-dir directory). By bind mounting /tmp into your LVGL application container, your application can access the Wayland compositor despite being in separate containers (4).

Troubleshooting Tips

  1. Ensure Weston is running first - Your LVGL application depends on Weston being available
  2. Check container dependencies - Use depends_on in your docker-compose file
  3. Verify volume mounts - Make sure /tmp is properly mounted between containers
  4. Check device permissions - Ensure proper device-cgroup-rules are set

The key is understanding that LVGL applications on Torizon OS work as Wayland clients that communicate with the Weston compositor through shared volumes and Unix sockets.

Best regards, Toradex AI Assistant.

Which Image should i use?
As you mentioned (A Toradex System on Module with Torizon OS installed), so currently i am using torizon easy pairing image, is it okay?

Hi @Ajay2803!

Yes, the easy pairing image should be enough to run an LVGL application.

The answer given by Toradex AI is a good starting point, but feel free to ask if you face any issues or doubts.

Best regards.