开发板:TLT113-MiniEVM_V1.2
系统:Ubuntu 20.04
源码下载:
1.github上面通过git拉取lv_port_linux_frame_buffer,并切换到release/v8.2分支
2.在lv_port_linux_frame_buffer文件夹下拉取lvgl代码,并切换到release/v8.2分支
3.在lv_port_linux_frame_buffer文件夹下继续拉取lv_drivers,并切换到release/v8.2分支
4.在lv_port_linux_frame_buffer文件夹下继续拉取lv_demos
此时,文件层级关系如下图所示:
LVGL头文件修改:
由于lv_port_linux_frame_buffer文件夹下本身带有lv_conf.h和lv_drv_conf.h,直接在其基础上进行修改了
lv_conf.h修改:
颜色格式,由于开发板外接的HDMI-1080的屏,本处没有修改
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 32
为了查看帧率,使能了LV_USE_PERF_MONITOR
/*1: Show CPU usage and FPS count*/
#define LV_USE_PERF_MONITOR 1
#if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif
FONT USAGE中,使能用到的字体
/*==================
* FONT USAGE
*===================*/
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
*https://fonts.google.com/specimen/Montserrat*/
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 1
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
lvgl官方demo使能:
#define LV_USE_DEMO_WIDGETS 1
lv_drv_conf.h修改:
由于没有使用DRM/KMS方式,使用的是fb的方式,所以使能了fb:
/*-----------------------------------------
* Linux frame buffer device (/dev/fbx)
*-----------------------------------------*/
#ifndef USE_FBDEV
# define USE_FBDEV 1
#endif
#if USE_FBDEV
# define FBDEV_PATH "/dev/fb0"
#endif
开发板使用鼠标作为了输入设备,经查为event6:
故修改输入设备节点为event6
/*-------------------------------------------------
* Mouse or touchpad as evdev interface (for Linux based systems)
*------------------------------------------------*/
#ifndef USE_EVDEV
# define USE_EVDEV 1
#endif
#ifndef USE_BSD_EVDEV
# define USE_BSD_EVDEV 0
#endif
#if USE_EVDEV || USE_BSD_EVDEV
# define EVDEV_NAME "/dev/input/event6" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
main.c中修改了分辨率:
/*Initialize and register a display driver*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
disp_drv.hor_res = 1920;
disp_drv.ver_res = 1080;
lv_disp_drv_register(&disp_drv);
Makfile更改:
指定编译器:
CC = /home/hbb/T113/T113-i_v1.0/out/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc
由于工具链不支持如下编译选项,因此在CFLAGS注释掉如下内容:
#-Wshift-negative-value
CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -Wall -Wshadow -Wundef -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wstack-usage=2048 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare
开始编译:
在lv_port_linux_frame_buffer文件夹下,编译,完成后查看:
成功的话,出现demo文件
已经搭建好了ssh,使用scp传到开发板:
hbb@hbb-Code-01-Series-PF5NU1G:~/T113/lv_port_linux_frame_buffer$ scp demo [email protected]:/root
demo 100% 1028KB 10.9MB/s 00:00
在开发板上运行此demo:
鼠标在demo启动前插入没有问题,如果是在启动后再插入,出现无法操作的情况,putty倒是有插入的打印信息,先这样吧,下次再查查看是哪里没配置好。
最后跑了下benchmark例程,1080P下92帧,不确定正不正常。