How to run LGVL on iMX using framebuffer

Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to run LGVL on iMX using framebuffer

How to run LGVL on iMX using framebuffer

What is LGVL?

LVGL is a graphics library to run on devices with limited resources.

LVGL is fully open-source and has no external dependencies, works with any modern MCU or MPU, and can be used with any (RT)OS or bare metal setup.


What is Framebuffer?

The Linux framebuffer (fbdev) is a Linux subsystem used to show graphics on a display, typically manipulated on the system console


How to write on the frame buffer?

The device is listed on de device list typically "fb0" on iMX.



1. Stop the window manager (Weston in our BSP)

$ systemctl stop weston


2. Write random data on the frame buffer with the next command:

$ cat /dev/urandom > /dev/fb0 


You should see colored pixels on the screen


3. Restart the window manager.

$ systemctl start weston




Cross-compiling the application


1. On the host computer we will clone the LGVL repo:

$ git clone -b release/v8.2

$ cd lv_port_linux_frame_buffer

$ git submodule update --init --recursive 

2. Configure the screen resolution, rotation, and the touch input.


    2.1 The resolution is configured in lines 33 and 34 of the main.c

disp_drv.hor_res = 1080;

disp_drv.ver_res = 1920;


     2.2 Rotation configured is on lines 32 and 57 of main.c.

disp_drv.sw_rotate = 3;

lv_disp_set_rotation(NULL, LV_DISP_ROT_270);    

    2.3 The touch input is configured on line 450 of lv_drv_conf.h

# define EVDEV_NAME "/dev/input/event2" 


Note: In my case is on /dev/input/event2 to check the inputs use the command "evtest"


3. Compile the application using the command "make"


Note: To compile the application on your host computer you have to set the environment.


4. Share the file called "demo" with your board and execute it on the board with the command

$ ./demo 


Note: You have to stop the weston service to run the application.






Tested on iMX8MN EVK with BSP 6.1.36

Works on Multimedia and Full image.

No ratings
Version history
Last update:
‎04-26-2024 09:01 AM
Updated by: