Table of contents
- download MounRiver
- Development Board Introduction
- environment creation
- LVGL porting
- Compile and run
- Link.ld configuration
1. Download MounRiver
Download from the official website, and then just go to the next step without thinking about MounRiver Studio
Don't look at the length, the transplant tutorial is not difficult at all, there are many pictures, for the convenience of everyone to follow
2. Development board introduction
The development board used this time is the "Chido CH32V307 Development Board" detailed introduction link
Based on CH32V307VCT6, RISC-V core
3. Environment creation
Avoid too long, directly refer to this link
Read the link above and then read the following
Since the default MEMORY
template does not match the fields of the "Chitu CH32V307 Development Board" , pay special attention to this. This is not urgent, just take a look at it. It will be mentioned below:
4. LVGL porting
1. Document preparation
To transplant LVGL, you must download LVGL. In the root directory of the MRS project, use Terminal to execute
git clone https://github.com/lvgl/lvgl.git -b release/v8.2
Then download the official one LCD库函数
and come to the Gitee warehouse
Download these two files,led.c
led.h
After downloading, put it in your own User
directory
2. Configuration file
lv_conf_example.h
Change tolv_conf.h
enable it
3. LVGL_port file
lv_port_disp_template.c
Change tolv_port_disp.c
lv_port_disp_template.h
Change tolv_port_disp.h
enter lv_port_disp.h
, add
#include "lcd.h"
#define MY_DISP_HOR_RES LCD_H
#define MY_DISP_VER_RES LCD_W
enter lv_port_disp.c
, revise
In this file, modify, three forms, select the first transplant here, and comment out the remaining two
In disp_flush
the function , add the plotting function, which is located inled.c
lcd_draw_point_color(x, y, color_p->full);
4. Test with lv_example
returnmain.c
Delete all, then modify as follows
#include "debug.h"
#include "lvgl.h"
#include "lcd.h"
#include "lv_port_disp.h"
#include "lv_examples.h"
int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
Delay_Init();
USART_Printf_Init(115200);
printf("SystemClk:%d\r\n",SystemCoreClock);
lcd_init();
LCD_SetBrightness(40);
lv_init();
lv_port_disp_init();
lv_example_meter_1();
while(1)
{
lv_tick_inc(1);
lv_task_handler();
Delay_Ms(1);
}
}
! Interlude! ! !
It's all ported here — didn't think about it and almost missed it?
Yes! We need to specify the file path! ! !
Right-click your project, click Properties , add the selected place, (no way, it can’t be copied)
5. Compile and run
One step short? No No No, you know it after compiling, if no error is reported, congratulations! Reported an error? don't panic
Look at the error reported, the error in the header file can be changed directly to the corresponding file
If there is a .BSS
segment error, look at the sixth
6. Modify link.ld
Compile and run, just download.
End of this article ----
reference:
Little VGL (LVGL) graphics library ported to CH32V307 microcontroller (2)