您尚未登录。

楼主 # 2022-06-16 00:23:14

rf
会员
注册时间: 2019-05-21
已发帖子: 27
积分: 2

lvgl8.2 freetype 如何支持

网上查到如何使用lvgl 支持freetype ,运行在arm板上,资料少之又少,官网的又有有点弄不明白,请求下8.2版本的lvgl怎么能支持freetype,我已经编译好了交叉编译好了freetype,生成了.so,也把头文件拷贝到lvgl/src/extra/freetype下了,但是编译不通过。

离线

#1 2022-09-15 19:12:12

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

@rf

同问这个问题,但是这个根本没人回答

离线

#2 2022-09-17 17:50:46

pzh
会员
注册时间: 2022-08-02
已发帖子: 5
积分: 87

Re: lvgl8.2 freetype 如何支持

可参考下 https://gitee.com/zeepunt/lvgl_linux_simulator.git 的 commit log:[port] support freetype

最近编辑记录 pzh (2022-09-17 17:51:20)

离线

#3 2022-09-19 11:11:38

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

pzh 说:

可参考下 https://gitee.com/zeepunt/lvgl_linux_simulator.git 的 commit log:[port] support freetype

请问一下,我编译报如下错误,你有遇到过嘛,那么编译通过后,又该怎么移植到实际板子上运行

CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SDL2", but
  CMake did not find one.

  Could not find a package configuration file provided by "SDL2" with any of
  the following names:

    SDL2Config.cmake
    sdl2-config.cmake

  Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
  "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/lvgl_linux/lvgl_linux_simulator/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.

离线

#4 2022-09-19 22:24:02

pzh
会员
注册时间: 2022-08-02
已发帖子: 5
积分: 87

Re: lvgl8.2 freetype 如何支持

@达子666
1、这个报错信息可以通过下面的命令安装 SDL 来解决

sudo apt install libsdl2-dev

2、如果实际的板子是运行发行版的 Linux,比如 Ubuntu Server,可以直接使用这个模拟器。
3、如果是自己通过 busybox + kernel + rootfs 构建的 Linux,那么就可以在服务器上通过交叉编译生成目标文件,再将目标文件放到板子上运行。
     大概的过程是:
     1)提供 /dev/fb0
     2)修改 lvgl_linux_simulator/include/lv_drv_conf.h 文件

#ifndef USE_SDL
# define USE_SDL 0
#endif

...

#ifndef USE_FBDEV
#  define USE_FBDEV           1
#endif

#if USE_FBDEV
#  define FBDEV_PATH          "/dev/fb0"
#endif

     3)修改 src/lv_port.c 文件

void lv_port_disp_init(void)
{
    /* 分配显示缓冲区 */
    int buf_size = sizeof(lv_color_t) * SDL_HOR_RES * SDL_VER_RES;
    buf_1 = malloc(buf_size);
    buf_2 = malloc(buf_size);
    if ((NULL != buf_1) && (NULL != buf_2))
        lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, buf_size);

    /* 默认初始化 */
    lv_disp_drv_init(&disp_drv);
    
    /* 缓冲区 */
    disp_drv.draw_buf = &disp_buf;
    /* 回调函数,需开发者提供,用于将缓冲区的内容复制到显示器的特定区域 */
    disp_drv.flush_cb = ;
    /* 显示器的水平分辨率,单位是像素 */
    disp_drv.hor_res = ;
    /* 显示器的垂直分辨率,单位是像素 */
    disp_drv.ver_res = ;

    /* 注册显示设备 */
    disp = lv_disp_drv_register(&disp_drv);
}

     4)修改 CMakeLists.txt 文件

/* 这里改为交叉编译工具链 */
set(CMAKE_C_COMPILER "/usr/bin/gcc")
...
/* 把下面的 SDL2 去掉 */

离线

#5 2022-09-21 15:52:19

ronz
会员
注册时间: 2021-11-19
已发帖子: 31
积分: 31

Re: lvgl8.2 freetype 如何支持

我用的8.1
下载freetype-2.10.0
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix=$PWD/library --with-zlib=no --with-png=no
make
make install

lvgl makefile -- 参照

FREERTYPE_DIR ?= ../freetype-2.10.0
FREERTYPE_INCDIR ?= ../freetype-2.10.0/library/include/freetype2
FREERTYPE_LINK ?= ../freetype-2.10.0/library/lib

CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -I$(MIXML_DIR)/  \
        -I$(FREERTYPE_INCDIR)/ -I$(FREERTYPE_LINK)/ \
        -I$(FFMPEG_INDIR)/ -I$(FFMPEG_LINK)/ \
        -Wall -Wshadow -Wundef   \
        -Wno-unused-function \
        -fno-strict-aliasing -Wno-error=cpp \
        -Wno-error=pedantic \
        -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated \
        -Wempty-body -Wshift-negative-value -Wstack-usage=2048 -Wno-unused-value \
        -Wuninitialized -Wmaybe-uninitialized \
        -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 -O3
LDFLAGS ?= -lm   -L$(FREERTYPE_LINK)/ -lfreetype \
          -L$(FFMPEG_LINK)/ -lavformat -lavcodec -lavutil -lswscale -lm -lpthread

最近编辑记录 ronz (2022-09-21 15:54:15)

离线

#6 2022-09-21 19:44:01

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

@ronz
你用的是这里面的嘛,然后改一下makefile:

git clone https://github.com/lvgl/lv_port_linux_frame_buffer

离线

#7 2022-09-22 08:01:43

ronz
会员
注册时间: 2021-11-19
已发帖子: 31
积分: 31

Re: lvgl8.2 freetype 如何支持

达子666 说:

@ronz
你用的是这里面的嘛,然后改一下makefile:

git clone https://github.com/lvgl/lv_port_linux_frame_buffer

/**
* @file lv_drv_conf.h
* Configuration file for v8.2.0
*/

/*
是的,8.2 我记错了

离线

#8 2022-09-22 11:11:59

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

@pzh

大佬编译了为啥一直报下面这种错误

home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c: In function ‘lv_port_disp_init’:
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:34:5: warning: implicit declaration of function ‘fbdev_init’; did you mean ‘lv_init’? [-Wimplicit-function-declaration]
   34 |     fbdev_init();
      |     ^~~~~~~~~~
      |     lv_init
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:47:25: error: expected expression before ‘;’ token
   47 |     disp_drv.flush_cb = ;
      |                         ^
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c: In function ‘lv_port_indev_init’:
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:80:25: error: ‘sdl_mouse_read’ undeclared (first use in this function)
   80 |     indev_drv.read_cb = sdl_mouse_read;
      |                         ^~~~~~~~~~~~~~
[ 51%] Building C object CMakeFiles/lvgl_linux.dir/assets/mouse_cursor_icon.c.o
[ 51%] Building C object CMakeFiles/lvgl_linux.dir/src/lv_port.c.o
/home/ubuntu/lvgl_linux/lvgl_linux_simulator/src/lv_port.c:12:10: fatal error: component/lv_drivers-8.3.0/display/fbdev.h: No such file or directory
   12 | #include <component/lv_drivers-8.3.0/display/fbdev.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/lvgl_linux.dir/build.make:76: CMakeFiles/lvgl_linux.dir/src/lv_port.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: CMakeFiles/lvgl_linux.dir/all] Error 2
make: *** [Makefile:152: all] Error 2。

离线

#9 2022-09-28 11:24:08

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

ronz 说:
达子666 说:

@ronz
你用的是这里面的嘛,然后改一下makefile:

git clone https://github.com/lvgl/lv_port_linux_frame_buffer

/**
* @file lv_drv_conf.h
* Configuration file for v8.2.0
*/

/*
是的,8.2 我记错了


可否帮忙分享一下源码,我搞了几天,还是没能成功。非常感谢

离线

#10 2022-09-28 13:17:18

xiaoleizii
会员
注册时间: 2019-05-10
已发帖子: 23
积分: 114

Re: lvgl8.2 freetype 如何支持

参考下别人的工程,例如下面这个:
https://gitee.com/mFlying/ssd2xx-demo/blob/master/4.littlevgl/README.md

离线

#11 2023-01-05 08:32:26

达子666
会员
注册时间: 2022-05-09
已发帖子: 24
积分: 22

Re: lvgl8.2 freetype 如何支持

xiaoleizii 说:

参考下别人的工程,例如下面这个:
https://gitee.com/mFlying/ssd2xx-demo/blob/master/4.littlevgl/README.md

感谢

离线

#12 2023-04-18 16:35:14

麻人麻了
会员
注册时间: 2023-04-18
已发帖子: 1
积分: 1

Re: lvgl8.2 freetype 如何支持

贴主,您有解决这个问题吗

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn