参考1:https://littlevgl.readthedocs.io/en/latest/Doc/02.RT-thread_LittlevGL/RT-thread+LittlevGL.html

参考2:https://linux-sunxi.org/Allwinner_SoC_Family

编译工具使用(这是错误的选择):https://sourcery.mentor.com/GNUToolchain/package12813/public/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

安装环境为Ubuntu 20.04,需要安装:apt-get install lsb-core lib32z1 lib32ncurses6

否则会出现:

root@szddt:/opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/bsp/allwinner_tina#  /opt/f1c100s/arm-2014.05/bin/arm-none-linux-gnueabi-gcc -v
bash: /opt/f1c100s/arm-2014.05/bin/arm-none-linux-gnueabi-gcc: No such file or directory

安装pip3: sudo apt install python3-pip libusb-1.0-0-dev

测试pip3: pip3 –version

sudo apt-get install python3-requests

scons编译的时候提示错误,找不到fd_set:

hechen@szddt:/opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/bsp/allwinner_tina$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/app/adc_app.o
applications/app/adc_app.c: In function 'controls_create':
applications/app/adc_app.c:26:17: warning: unused variable 'disp_size' [-Wunused-variable]
  lv_disp_size_t disp_size = lv_disp_get_size_category(NULL);
                 ^
CC build/applications/app/air_app.o
applications/app/air_app.c:35:13: warning: 'bar_anim' defined but not used [-Wunused-function]
 static void bar_anim(lv_task_t * t)
             ^
CC build/applications/app/common.o
In file included from /opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h:14:0,
                 from /opt/f1c100s/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/sys/types.h:219,
                 from /opt/f1c100s/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/stdlib.h:314,
                 from applications/app/common.c:3:
/opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/components/dfs/include/dfs_select.h:19:22: error: unknown type name 'fd_set'
 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
                      ^
/opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/components/dfs/include/dfs_select.h:19:39: error: unknown type name 'fd_set'
 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
                                       ^
/opt/f1c100s/lv7_rtthread_f1c100s/rt-thread/components/dfs/include/dfs_select.h:19:57: error: unknown type name 'fd_set'
 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
                                                         ^
scons: *** [build/applications/app/common.o] Error 1
scons: building terminated because of errors.

需要在rtconfig.h中加人 #define HAVE_SYS_SELECT_H 重新编译。

接下来scons编译提示错误:

applications/app/mainpage.c: In function 'main_page_create':
applications/app/mainpage.c:256:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < 3; i++) {
  ^
applications/app/mainpage.c:256:2: note: use option -std=c99 or -std=gnu99 to compile your code

需要在rtconfig.py里面CC增加一段-std=c99

if PLATFORM == 'gcc':
    # toolchains
    PREFIX  = 'arm-none-linux-gnueabi-'
    CC      = PREFIX + 'gcc -std=c99'
    CXX     = PREFIX + 'g++'
    AS      = PREFIX + 'gcc'
    AR      = PREFIX + 'ar'
    LINK    = PREFIX + 'g++'
    TARGET_EXT = 'elf'
    SIZE    = PREFIX + 'size'
    OBJDUMP = PREFIX + 'objdump'
    OBJCPY  = PREFIX + 'objcopy'

    DEVICE  = ' -mcpu=arm926ej-s -ffunction-sections -fdata-sections'
    CFLAGS  = DEVICE + ' -Wall'

接下来编译提示:

CC build/drivers/drv_fb.o
drivers/drv_fb.c:25:6: error: #elif with no expression
 #elif
      ^
drivers/drv_fb.c:30:6: error: #elif with no expression
 #elif
      ^
drivers/drv_fb.c:35:6: error: #elif with no expression
 #elif
      ^
scons: *** [build/drivers/drv_fb.o] Error 1

将对应的行的“#elif”,改成“#elif 1″

继续编译,提示函数定义中的类型错误

CC build/drivers/drv_gpio.o
drivers/drv_gpio.c:240:6: error: conflicting types for 'gpio_set_debounce'
 void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler)
      ^
In file included from drivers/drv_gpio.c:27:0:
drivers/drv_gpio.h:240:6: note: previous declaration of 'gpio_set_debounce' was here
 void gpio_set_debounce(enum gpio_port port, rt_uint8_t prescaler);
      ^
scons: *** [build/drivers/drv_gpio.o] Error 1
scons: building terminated because of errors.

将240行的“enum gpio_direction_type”改成“rt_uint8_t”

折腾失败,主要是因为:

arm-linux-guneabi-gcc 链接到glibc
arm-none-eabi-gcc 使用newlib,也就是裸机平台

发表评论

电子邮件地址不会被公开。 必填项已用*标注