RT-Thread Simulator to Build LVGL Development Debugging Environment

Blog | Nov.30.2023


● This project is working with RT-Thread v4.1.0, the latest LVGL graphics libraries can be supported through simple configuration, LVGL graphics libraries are added to the project as a package!

● LVGL is an excellent open-source and free GUI graphics library. It has a small memory footprint and is suitable for embedded devices.

Development Environment

When it comes to developing hardware products, the debugging process can be a bit of a hassle. With circuit board-based debugging, you need to constantly verify the page display effect by compiling and downloading the program, which can be quite time-consuming and inefficient.

But don’t worry, there are other ways to develop and debug your product! For instance, you can use LVGL’s official simulator for simulator-based development and debugging. This is a great way to save time and increase your development efficiency.

Another option is to use the RT-Thread simulator. This simulator is based on the RT-Thread operating system, which means you can develop your LVGL program on this simulator, verify it, and then change the compiler to download the debugger. This way, you can quickly verify it on the RT-Thread operating system hardware board!

Minimum RT-Thread System

● If you’re looking to build an RT-Thread minimal system, you can opt for the RT-Thread kernel and BSP simulator. This will help keep the size of your system relatively small, while also allowing you to use code search, project management, Git and other software version control tools.

● To get started, create a new project directory. Then, under the project directory, create a new rt-thread and simulator directory. This will help you keep your project organized and easy to manage.

● If you’ve recently changed directories, you may have noticed that RT-Thread menuconfig and scons builds are now reporting path errors. But don’t worry, this is a simple fix! All you need to do is update the paths in your configuration files to reflect the new directory structure. Once you’ve done that, you should be good to go!


● If you’re looking to use LVGL with RT-Thread, you’ll need to enable the LVGL package and pull the remote package to your local directory. This will allow you to use LVGL with RT-Thread and take advantage of all its features.

RT-Thread ENV tool: menuconfig -> RT-Thread online packages — -> -> multimedia packages — ->

● It’s important to note that simply turning on the LVGL package configuration will result in an error when compiling. This is because turning on the package configuration only enables the LVGL package, but doesn’t pull it locally.

● To fix this, you’ll need to use the RT-Thread ENV tool and run the command pkgs — update to pull the LVGL package locally. This will ensure that you can use LVGL with RT-Thread without any issues.

● Note that even though the LVGL package is available, you may still encounter compilation errors. This is because you need to turn on the [BSP_USING_LVGL] macro, which enables the RT-Thread Demo configuration for LVGL. Once you’ve turned on this macro, you should be able to use LVGL with RT-Thread without any issues.

● Once you’ve made changes to your menuconfig, you can save them and run the RT-Thread ENV tool again. This time, use the command scons — -target=vs to generate a Visual Studio project. I recommend using Visual Studio 2022 to open the project.vcproj file.

● Once you’ve compiled your project, it’s ready to be debugged and run. Happy coding!

Button Demo

● When it comes to learning new things, it’s always best to take things step-by-step. So, let’s start by running a simple button display demo.

● To add the demo of the button display, you’ll need to modify lv_user_gui_init in simulator\applications\lvgl\demo\lv_demo.c. This will help you get started with LVGL and give you a better understanding of how it works.

1void lv_user_gui_init(void)
3 /* display demo; you may replace with your LVGL application at here */
4 //extern void lv_demo_music(void).
5 //lv_demo_music().
6 extern void lv_example_btn_1(void).
7 lv_example_btn_1().

● Running effects:


● If you’re looking to create new demo files based on LVGL demos, you can do so by copying the relevant code, modifying it, and running it. This is a great way to get started with LVGL and learn more about how it works.

● One of the best things about the PC-based RT-Thread simulator is that it doesn’t require frequent downloads. This means that you can compile and run your code immediately after modifying it, which can greatly improve your efficiency when it comes to running, verifying, and debugging your code.

Let’s Connect!

Facebook | Twitter | Linkedin | YouTube