MM32F5260 overview
The MM32F5260 is an MCU based on an Arm v8-M Star-MC1 core (Cortex-M33 compatible). It can run at up to 120 MHz and integrates a floating point unit (FPU), digital signal processing unit (DSP), a MindSwitch interconnect matrix, configurable logic unit (CLU), a CORDIC trigonometric acceleration unit, and other algorithm acceleration modules. It also provides a rich set of peripheral modules and ample I/O ports.
About LVGL
LVGL (Light and Versatile Graphics Library) is an open source graphical user interface library designed for embedded systems. It is written in C and is lightweight, portable, flexible, and easy to use. LVGL provides a wide range of GUI elements and flexible layout options to help developers create interactive user interfaces for embedded devices.
LVGL hardware and software requirements
Most modern controllers capable of driving a display can run LVGL. Minimum recommended requirements include:
- 16, 32, or 64 bit microcontroller or processor
- Recommended clock: 16 MHz or higher
- Flash/ROM: minimum 64 kB (recommended 180 kB)
- RAM:
- Static RAM usage: ~2 kB, depending on features and object types used
- Stack: > 2 kB (8 kB recommended)
- Dynamic data (heap): > 4 kB (32 kB recommended if using many objects)
- C99 or newer compiler
Obtaining source code
Obtain the LibSamples_MM32F5260 sample project from the MindMotion website and download the MM32F5260 libraries and examples from the available tools and software section.
This tutorial uses LVGL v8.1.0 as the GUI stack.
Porting overview
Copy LVGL source into the project
Using the LibSamples_MM32F5260 sample project as a base, create a path such as ~3rdPartySoftwarePortingLVGL in the project root. Extract the lvgl-v8.1.0 package and copy it into that path. Create a Demos folder under that path and then create an LVGL_Basic sample project folder inside Demos.
Copy lv_conf_template.h into the LVGL_Basic project folder and rename it to lv_conf.h.
From the package examples/porting folder, copy the lv_port_disp_template.c and lv_port_disp_template.h files into the LVGL_Basic project folder and remove the __template suffix from their filenames.
FSMC and LCD initialization
In platform.c and platform.h implement FSMC-related initialization, including clock configuration, pin setup, and FSMC initialization.
Create lcd.c and lcd.h to implement LCD driver initialization and basic runtime parameter configuration, plus fundamental drawing functions such as clearing a window, filling a window, and setting a pixel.
Create lcd_port.c to implement the FSMC-based LCD driver interface and functions for writing commands and data to the LCD.
Adding files to the Keil project
Add LVGL to the project's include paths so the compiler can find the headers.
Add all .c files from the lvgl_v8 src directory into the Keil project.


Code adaptation
Add the porting interface files to the project and make the following adaptations:
- Edit lv_conf.h: enable the configuration file contents and enable display of frame rate and memory usage.
- Edit lv_port_disp.c: enable the LVGL configuration.
- Modify lv_port_disp_init(): choose the image buffer method and set the screen pixel dimensions.
- Modify disp_init(): adapt screen initialization and call the screen init function.
- Modify disp_flush(): adapt to the screen fill function interface.
- Implement lvgl_basic.c: include required headers, call LVGL initialization, provide a SysTick interrupt service routine as the LVGL time base, and call LVGL_Basic_Sample() from main.c.
#include "platform.h"
#include "main.h"
#include "lvgl.h"
#include "lv_port_disp.h"
static const char * btnm_map[] = {"0", "1", "2", "3", "4", "\n","5", "6", "7", "8", "9", "\n","Action1", "Action2",""};
void lv_example(void);
void LVGL_Basic_Sample(void){
lv_init();
lv_port_disp_init();
lv_example();
while (1)
{
lv_task_handler();
}
}
void lv_example(void){
/* create a label. */
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_set_width(label, 150);
lv_obj_set_pos(label, 10, 10);
lv_label_set_text(label, "MindMotion MindMotion");
/* create a btn matrix. */
lv_obj_t * btnm1 = lv_btnmatrix_create(lv_scr_act());
lv_btnmatrix_set_map(btnm1, btnm_map);
lv_btnmatrix_set_btn_width(btnm1, 10, 2); /*Make "Action1" twice as wide as "Action2"*/
lv_obj_align(btnm1, LV_ALIGN_CENTER, 0, 0);
}
LVGL_Basic sample
The LVGL_Basic sample demonstrates basic GUI elements such as buttons, labels, and text areas. It shows how to create and manipulate these elements on the screen.

Reference samples
LVGL_Benchmark
This sample tests and evaluates the rendering performance of the MM32F5260 by rapidly creating and deleting a large number of objects.

LVGL_Stress
This sample stresses the system by using many different GUI elements and complex layouts simultaneously to verify stability under high load.
LVGL_Widgets
This sample demonstrates the widgets supported by LVGL, including charts, sliders, checkboxes, and drop-down lists, to help developers learn how to build more complex user interfaces.
Summary
This article outlines the MM32F5260 features and the basic steps to port and run LVGL on the platform. Using the LibSamples package can help developers quickly start LVGL development on MM32F5260.
ALLPCB