当前位置: 首页 > news >正文

Tina-Linux -- 4. LVGL 8.3移植

引用

  • 移植lvgl 8.3.11到野火i.mx6ull开发板
  • Mangopi MQ-R:T113-s3编译Tina Linux系统(三)独立编译Qt5

准备源码

下载源码

  • 创建 lvgl 文件夹

~:mkdir lvgl

  • 下载8.2版本的linux_frame_buffer文件,因为这个文件没有8.3的和8.2通用

~/T113/lvgl: git clone -b release/v8.2 [https://github.com/lvgl/lv_port_linux_frame_buffer.git](https://github.com/lvgl/lv_port_linux_frame_buffer.git)

  • 下载8.3版本的lvgl文件,默认就是最新的

git clone -b release/v8.3 https://github.com/lvgl/lvgl.git

  • 下载驱动文件

git clone -b release/v8.3 https://github.com/lvgl/lv_drivers.git

  • 下面是下载好的源码压缩包百度链接
链接:https://pan.baidu.com/s/1FKNSOfEdVv2zXH8xNRuXZA?pwd=pprk 
提取码:pprk

修改源码

搭建 lvgl_demo 工程

  • 创建 lvgl_8.3_demo 文件夹
  • 拷贝 lvgl 源码到文件夹
  • 拷贝 lvgl 驱动到文件夹
  • 拷贝 fram_buffer 中的 main.c Makefile 文件到文件夹
  • 拷贝 lvgl 文件夹下的 lv_conf_template.h 到文件夹
  • 拷贝 lv_drivers lv_drv_conf_template.h 到文件夹

~: mkdir lvgl_8.3_demo
~: cp lvgl ./lvgl_8.3_demo/
~: cp lv_driver ./lvgl_8.3_demo/
~: cp lv_port_linux_frame_buffer/main.c  ./lvgl_8.3_demo/
~: cp lv_port_linux_frame_buffer/Makefile  ./lvgl_8.3_demo/
~: cp lvgl/lv_conf_template.h lvgl_8.3_demo/lv_conf.h
~: cp lv_drivers/lv_drv_conf_template.h lvg_8.3_demo/lv_drv_conf.h

修改文件

lv_conf.h

修改项
  • 第 15 行,打开配置使能
  • 第 26 行修改
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 32
  • 第 52 行,修改 #define LV_MEM_SIZE (2*1024U * 1024U) /*[bytes]*/
  • 第 81,84 行,修改``
/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 10      /*[ms]*//*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 10     /*[ms]*//*Use a custom tick source that tells the elapsed time in milliseconds.*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
#define LV_TICK_CUSTOM_INCLUDE "stdint.h"         /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (custom_tick_get())    /*Expression evaluating to current system time in ms*/
/*If using lvgl as ESP32 component*/
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
#endif   /*LV_TICK_CUSTOM*/
  • 第 282 行修改 #define LV_USE_PERF_MONITOR 1
  • 第 752 行修改#define LV_USE_DEMO_WIDGETS 1
完整代码
/*** @file lv_conf.h* Configuration file for v8.3.11*//** Copy this file as `lv_conf.h`* 1. simply next to the `lvgl` folder* 2. or any other places and*    - define `LV_CONF_INCLUDE_SIMPLE`*    - add the path as include path*//* clang-format off */
#if 1 /*Set it to "1" to enable content*/#ifndef LV_CONF_H
#define LV_CONF_H#include <stdint.h>/*====================COLOR SETTINGS*====================*//*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
#define LV_COLOR_DEPTH 32/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0/*Enable features to draw on transparent background.*It's required if opa, and transform_* style properties are used.*Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/
#define LV_COLOR_SCREEN_TRANSP 0/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
#define LV_COLOR_MIX_ROUND_OFS 0/*Images pixels with this color will not be drawn if they are chroma keyed)*/
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00)         /*pure green*//*=========================MEMORY SETTINGS*=========================*//*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (2*1024U * 1024U)          /*[bytes]*//*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0     /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
#undef LV_MEM_POOL_INCLUDE
#undef LV_MEM_POOL_ALLOC
#endif#else       /*LV_MEM_CUSTOM*/
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h>   /*Header for the dynamic memory function*/
#define LV_MEM_CUSTOM_ALLOC   malloc
#define LV_MEM_CUSTOM_FREE    free
#define LV_MEM_CUSTOM_REALLOC realloc
#endif     /*LV_MEM_CUSTOM*//*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.*You will see an error log message if there wasn't enough buffers. */
#define LV_MEM_BUF_MAX_NUM 16/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
#define LV_MEMCPY_MEMSET_STD 0/*====================HAL SETTINGS*====================*//*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 10      /*[ms]*//*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 10     /*[ms]*//*Use a custom tick source that tells the elapsed time in milliseconds.*It removes the need to manually update the tick with `lv_tick_inc()`)*/
#define LV_TICK_CUSTOM 1
#if LV_TICK_CUSTOM
#define LV_TICK_CUSTOM_INCLUDE "stdint.h"         /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (custom_tick_get())    /*Expression evaluating to current system time in ms*/
/*If using lvgl as ESP32 component*/
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
#endif   /*LV_TICK_CUSTOM*//*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.*(Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI_DEF 130     /*[px/inch]*//*=======================* FEATURE CONFIGURATION*=======================*//*-------------* Drawing*-----------*//*Enable complex draw engine.*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
#define LV_DRAW_COMPLEX 1
#if LV_DRAW_COMPLEX != 0/*Allow buffering some shadow calculation.*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0/* Set number of maximally cached circle data.* The circumference of 1/4 circle are saved for anti-aliasing* radius * 4 bytes are used per circle (the most often used radiuses are saved)* 0: to disable caching */
#define LV_CIRCLE_CACHE_SIZE 4
#endif /*LV_DRAW_COMPLEX*//*** "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer* and blend it as an image with the given opacity.* Note that `bg_opa`, `text_opa` etc don't require buffering into layer)* The widget can be buffered in smaller chunks to avoid using large buffers.** - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it* - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes]  used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.** Both buffer sizes are in bytes.* "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers* and can't be drawn in chunks. So these settings affects only widgets with opacity.*/
#define LV_LAYER_SIMPLE_BUF_SIZE          (24 * 1024)
#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024)/*Default image cache size. Image caching keeps the images opened.*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.*However the opened images might consume additional RAM.*0: to disable caching*/
#define LV_IMG_CACHE_DEF_SIZE 0/*Number of stops allowed per gradient. Increase this to allow more stops.*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
#define LV_GRADIENT_MAX_STOPS 2/*Default gradient buffer size.*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.*If the cache is too small the map will be allocated only while it's required for the drawing.*0 mean no caching.*/
#define LV_GRAD_CACHE_DEF_SIZE 0/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
#define LV_DITHER_GRADIENT 0
#if LV_DITHER_GRADIENT
/*Add support for error diffusion dithering.*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.*The increase in memory consumption is (24 bits * object's width)*/
#define LV_DITHER_ERROR_DIFFUSION 0
#endif/*Maximum buffer size to allocate for rotation.*Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024)/*-------------* GPU*-----------*//*Use Arm's 2D acceleration library Arm-2D */
#define LV_USE_GPU_ARM2D 0/*Use STM32's DMA2D (aka Chrom Art) GPU*/
#define LV_USE_GPU_STM32_DMA2D 0
#if LV_USE_GPU_STM32_DMA2D
/*Must be defined to include path of CMSIS header of target processore.g. "stm32f7xx.h" or "stm32f4xx.h"*/
#define LV_GPU_DMA2D_CMSIS_INCLUDE
#endif/*Enable RA6M3 G2D GPU*/
#define LV_USE_GPU_RA6M3_G2D 0
#if LV_USE_GPU_RA6M3_G2D
/*include path of target processore.g. "hal_data.h"*/
#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"
#endif/*Use SWM341's DMA2D GPU*/
#define LV_USE_GPU_SWM341_DMA2D 0
#if LV_USE_GPU_SWM341_DMA2D
#define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h"
#endif/*Use NXP's PXP GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_PXP 0
#if LV_USE_GPU_NXP_PXP
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)*   and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS*   has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()*/
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
#endif/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
#define LV_USE_GPU_NXP_VG_LITE 0/*Use SDL renderer API*/
#define LV_USE_GPU_SDL 0
#if LV_USE_GPU_SDL
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
/*Texture cache size, 8MB by default*/
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
#endif/*-------------* Logging*-----------*//*Enable the log module*/
#define LV_USE_LOG 0
#if LV_USE_LOG/*How important log should be added:*LV_LOG_LEVEL_TRACE       A lot of logs to give detailed information*LV_LOG_LEVEL_INFO        Log important events*LV_LOG_LEVEL_WARN        Log if something unwanted happened but didn't cause a problem*LV_LOG_LEVEL_ERROR       Only critical issue, when the system may fail*LV_LOG_LEVEL_USER        Only logs added by the user*LV_LOG_LEVEL_NONE        Do not log anything*/
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN/*1: Print the log with 'printf';*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 0/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
#define LV_LOG_TRACE_MEM        1
#define LV_LOG_TRACE_TIMER      1
#define LV_LOG_TRACE_INDEV      1
#define LV_LOG_TRACE_DISP_REFR  1
#define LV_LOG_TRACE_EVENT      1
#define LV_LOG_TRACE_OBJ_CREATE 1#define LV_LOG_TRACE_LAYOUT     1#define LV_LOG_TRACE_ANIM       1#endif  /*LV_USE_LOG*//*-------------* Asserts*-----------*//*Enable asserts if an operation is failed or an invalid data is found.*If LV_USE_LOG is enabled an error message will be printed on failure*/#define LV_USE_ASSERT_NULL          1   /*Check if the parameter is NULL. (Very fast, recommended)*/#define LV_USE_ASSERT_MALLOC        1   /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/#define LV_USE_ASSERT_STYLE         0   /*Check if the styles are properly initialized. (Very fast, recommended)*/#define LV_USE_ASSERT_MEM_INTEGRITY 0   /*Check the integrity of `lv_mem` after critical operations. (Slow)*/#define LV_USE_ASSERT_OBJ           0   /*Check the object's type and existence (e.g. not deleted). (Slow)*//*Add a custom handler when assert happens e.g. to restart the MCU*/#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>#define LV_ASSERT_HANDLER while(1);   /*Halt by default*//*-------------* Others*-----------*//*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/*1: Show the used memory and the memory fragmentation* Requires LV_MEM_CUSTOM = 0*/#define LV_USE_MEM_MONITOR 0#if LV_USE_MEM_MONITOR#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT#endif/*1: Draw random colored rectangles over the redrawn areas*/#define LV_USE_REFR_DEBUG 0

相关文章:

  • 【全国青少年信息素养大赛算法创意初中组押题卷】
  • 防火墙最新技术汇总
  • 【学习笔记】后端(Ⅰ)—— NodeJS(Ⅱ)
  • Centos7.9上安装Oracle 11gR2 RAC 三节点(ASMlib管理asm磁盘)
  • Vue学习穿梭框Transfer组件
  • 贪心算法:划分字母区间
  • 包装类..
  • 如何彻底搞懂迭代器(Iterator)设计模式?
  • 反序列化漏洞(JBoss、apache log4、apache Shiro、JWT)Weblogic未授权访问、代码执行、任意上传
  • 《QT实用小工具·六十五》基于QPropertyAnimation实现的移动动画和控件覆盖
  • 内网安全之搭建ADCS证书服务
  • C++ 时间处理-从字符串中解析日期时间
  • 中银基金软件开发工程师春招群面记录
  • 网络安全之BGP详解
  • 通过管理系统完成商品属性维护
  • 【翻译】babel对TC39装饰器草案的实现
  • 【每日笔记】【Go学习笔记】2019-01-10 codis proxy处理流程
  • bearychat的java client
  • golang 发送GET和POST示例
  • iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
  • Js基础知识(一) - 变量
  • Python 使用 Tornado 框架实现 WebHook 自动部署 Git 项目
  • 初探 Vue 生命周期和钩子函数
  • 翻译 | 老司机带你秒懂内存管理 - 第一部(共三部)
  • 前端路由实现-history
  • 入门到放弃node系列之Hello Word篇
  • 我是如何设计 Upload 上传组件的
  • ​​快速排序(四)——挖坑法,前后指针法与非递归
  • ​Linux·i2c驱动架构​
  • %3cscript放入php,跟bWAPP学WEB安全(PHP代码)--XSS跨站脚本攻击
  • (AngularJS)Angular 控制器之间通信初探
  • (LeetCode) T14. Longest Common Prefix
  • (Redis使用系列) Springboot 使用redis实现接口幂等性拦截 十一
  • (附源码)基于SSM多源异构数据关联技术构建智能校园-计算机毕设 64366
  • (删)Java线程同步实现一:synchronzied和wait()/notify()
  • (原創) X61用戶,小心你的上蓋!! (NB) (ThinkPad) (X61)
  • (转)es进行聚合操作时提示Fielddata is disabled on text fields by default
  • (转载)OpenStack Hacker养成指南
  • (轉貼) 蒼井そら挑戰筋肉擂台 (Misc)
  • *++p:p先自+,然后*p,最终为3 ++*p:先*p,即arr[0]=1,然后再++,最终为2 *p++:值为arr[0],即1,该语句执行完毕后,p指向arr[1]
  • .Net 6.0 处理跨域的方式
  • .NET Core 将实体类转换为 SQL(ORM 映射)
  • .NET/C# 避免调试器不小心提前计算本应延迟计算的值
  • .NET3.5下用Lambda简化跨线程访问窗体控件,避免繁复的delegate,Invoke(转)
  • .vue文件怎么使用_我在项目中是这样配置Vue的
  • @Service注解让spring找到你的Service bean
  • [AIGC codze] Kafka 的 rebalance 机制
  • [Angular] 笔记 20:NgContent
  • [AX]AX2012 SSRS报表Drill through action
  • [C#7] 1.Tuples(元组)
  • [C++][数据结构][算法]单链式结构的深拷贝
  • [EFI]MSI GF63 Thin 9SCXR电脑 Hackintosh 黑苹果efi引导文件
  • [flume$2]记录一个写自定义Flume拦截器遇到的错误
  • [JavaEE]线程的状态与安全
  • [JDK工具-6] jmap java内存映射工具