[RISCV][Tutorial] Transplant LVGL8.2 to CH32V407

Table of contents

  1. download MounRiver
  2. Development Board Introduction
  3. environment creation
  4. LVGL porting
    1. document preparation
    2. LVGL profile
    3. LVGL port file
    4. lv_example test
    5. episode
  5. Compile and run
  6. 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

image-20220422142555334

3. Environment creation


Avoid too long, directly refer to this link

Read the link above and then read the following

Since the default MEMORYtemplate 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:
image-20220422142736301

image-20220422143013863

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

image-20220422150502037

After downloading, put it in your own Userdirectory

image-20220422150558827

2. Configuration file

lv_conf_example.hChange tolv_conf.h

image-20220422144213314

enable it

image-20220422144302192

3. LVGL_port file

lv_port_disp_template.c Change tolv_port_disp.c

lv_port_disp_template.h Change tolv_port_disp.h

image-20220422144550296

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

image-20220422145214705

In this file, modify, three forms, select the first transplant here, and comment out the remaining two

image-20220422145247527

In disp_flushthe function , add the plotting function, which is located inled.c

 lcd_draw_point_color(x, y, color_p->full);

image-20220422145722440

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)

image-20220422151030171

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 .BSSsegment error, look at the sixth

img

6. Modify link.ld


image-20220422143013863

Compile and run, just download.

End of this article ----

reference:

Little VGL (LVGL) graphics library ported to CH32V307 microcontroller (2)

Guess you like

Origin blog.csdn.net/qq_38844263/article/details/124348064