飞凌 OK113i-C 全志T113-i开发板初体验

原创
2023/12/14 15:35
阅读数 47

1801909317.jpg

板子做工精致很有份量,拿在手里沉甸甸的,各种接口一应俱全——USB、TF 卡座、SIM卡座、4G模块卡座、网口、RGB LCD接口、LVDS、RS485、CAN、各种音频口、TV-in/TV-Out,板上还自带一个RTL8723du wifi/蓝牙二合一模块,作为一块主打工业控制的主控板这些接口实属绰绰有余了。手里的板子是256MB内存+256MB nand flash版本(这个是低配版本,还有个512MB+8GB emmc的高配版本),飞凌开发文档中提到已经移植好了Qt5开发环境,所以这个内存跑跑Qt的UI程序是再合适不过了,可惜手里没有匹配的开箱即用的LCD显示屏不然接上直接能试试出厂自带的Qt测试程序了。

提供的开发资料中已经包含有Ubuntu 20.04 的虚拟机文件,因为是直接用的Linux版本系统,所以需要自己搭建开发环境,以下所涉内容都是在装有Ubuntu 20.04的PC上进行操作,而且,因为以前在安装过T113-S3的开发环境,所以在编译SDK过程中并没有碰到其他因缺少依赖软件报的错误。

T113-i longan linux开发环境搭建

解压SDK

cat OK113i-linux-sdk.tar.bz2* | tar jx -C ~/Dev/sdk/T113-i/

编译前的准备

除了 gcc,ncurse,bison,autoconf,wget,patch,texinfo,zlib,dos2unix 之外需要安装如下:

sudo apt-get install git
sudo apt-get install gnupg
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install build-essential
sudo apt-get install zip
sudo apt-get install curl
sudo apt-get install libc6-dev
sudo apt-get install libncurses5-dev:i386
sudo apt-get install x11proto-core-dev
sudo apt-get install libx11-dev:i386
sudo apt-get install libreadline6-dev:i386
sudo apt-get install libgl1-mesa-glx:i386
sudo apt-get install libgl1-mesa-dev
sudo apt-get install g++-multilib
sudo apt-get install mingw32
sudo apt-get install tofrodos
sudo apt-get install python-markdown
sudo apt-get install libxml2-utils
sudo apt-get install xsltproc
sudo apt-get install zlib1g-dev:i386
sudo apt-get install gawk
sudo dpkg-reconfigure dash 选择no
sudo apt-get install libgl1-mesa-dev:i386
sudo apt install u-boot-tools

初次编译内核

./build.sh config

Welcome to mkscript setup progress
All available platform:
   0. linux
Choice [linux]: 0
All available board:
   0. ok113i
Choice [ok113i]: 0
All available flash:
   0. default
   1. nor
   2. nand
Choice [default]: 0
All available display_type:
   0. tvout_pal
   1. tvout_ntsc
   2. lcd_800x480
   3. lcd_1024x600
   4. mipi_1024x600
   5. lvds_1280x800
Choice [tvout_pal]: 2
Relocating the buildroot SDK from /home/forlinx/work/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host to /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host ...
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk
  File "<string>", line 1
    import os.path; print os.path.relpath('/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig', '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs')
                          ^
SyntaxError: invalid syntax
ERROR: Can't find kernel defconfig!

python 报系统库语法错误,根据经验是系统python版本问题,首先查看系统中python版本号

python --version
Python 3.8.10

不出意外的话编译系统依赖python 2.7,所以切换到python 2.7版本,具体操作如下:
首先,查看系统有几个python版本

update-alternatives --list python
/usr/bin/python2
/usr/bin/python3

然后,通过如下切换到想要的版本

update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
 
  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3   2         auto mode
  1            /usr/bin/python2   1         manual mode
  2            /usr/bin/python3   2         manual mode
 
Press <enter> to keep the current choice[*], or type selection number: 1

切换后,再确认python 版本:

python --version
Python 2.7.18

最后再试一次:

./build.sh config

Welcome to mkscript setup progress
All available platform:
   0. linux
Choice [linux]: 0
All available board:
   0. ok113i
Choice [ok113i]: 0
All available flash:
   0. default
   1. nor
   2. nand
Choice [default]: 0
All available display_type:
   0. tvout_pal
   1. tvout_ntsc
   2. lcd_800x480
   3. lcd_1024x600
   4. mipi_1024x600
   5. lvds_1280x800
Choice [lcd_1024x600]: 2
This buildroot SDK has already been relocated!
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk
INFO: kernel defconfig: generate /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/.config by /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTLD  scripts/kconfig/conf
*** Default configuration is based on 'OK113I_linux_defconfig'
#
# configuration written to .config
#
make: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/buildroot/buildroot-201902'
  GEN     /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/Makefile
Config.in.legacy:1769:warning: choice value used outside its choice group
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/buildroot/buildroot-201902/configs/OK113I_linux_defconfig:3159:warning: override: reassigning to symbol BR2_PACKAGE_OTA_BURNBOOT
#
# configuration written to /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/.config
#
make: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/buildroot/buildroot-201902'
INFO: buildroot defconfig is OK113I_linux_defconfig 

编译内核试试:

./build.sh kernel
ACTION List: mkkernel;========
Execute command: mkkernel 
INFO: build kernel ...
INFO: prepare_buildserver
INFO: Prepare toolchain ...
toolchain_archivedir=/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/build/toolchain/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi.tar.xz
build server start.
(cd /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/build && [ -x mkkernel.sh ] && ./mkkernel.sh)
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config include/generated
  CLEAN   .config

Using default config /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig ...

make[1]: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
......
......
make[1]: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
[NAND]: Build module driver
make: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/nand'
[NAND] NOT buid as ko
make: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/nand'
make: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/nand'
[NAND] NOT buid as ko
make: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/nand'
[NAND]: Build done
[ GPU]: Build module driver
make: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/gpu'
Nothing to do for unsupport configuration
make: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/gpu'
make: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/gpu'
Nothing to do for unsupport configuration
make: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/modules/gpu'
[ GPU]: Build done
---build dts for sun8iw20p1 ok113i-----
'/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build/arch/arm/boot/dts//board.dtb' -> '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/staging/sunxi.dtb'
Copy modules to target ...
16149 blocks
25241 blocks
build_ramfs
Copy boot.img to output directory ...

sun8iw20p1 compile Kernel successful


INFO: Prepare toolchain ...
toolchain_archivedir=/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/build/toolchain/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi.tar.xz

Using default config /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig ...

make[1]: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
  GEN     Makefile
*** Default configuration is based on 'OK113I_linux_defconfig'
#
# No change to .config
#
make[1]: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
---build dts for sun8iw20p1 ok113i-----
make[1]: Entering directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
  DTC     arch/arm/boot/dts/board.dtb
make[1]: Leaving directory '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build'
'/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/build/arch/arm/boot/dts//board.dtb' -> '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/staging/sunxi.dtb'
'/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/kernel/staging/sunxi.dtb' -> '/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/sunxi.dtb'
INFO: build kernel OK.

内核编译完后OK113i-linux-sdk/out目录需要注意,这个是所有的编译输出目录,后面buildroot编译完也是在这个目录编译输出的。此目录中如下几个目录需要特别记住:

  1. 编译内核的交叉编译工具链
     OK113i-linux-sdk/out/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi目录下就是编译内核的交叉编译工具链。
  2. buildroot的交叉编译工具链
    OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/ arm-linux-gnueabi-g++等,编译应用程序的时候使用这个编译工具。
  3. 内核编译输出目录
    OK113i-linux-sdk/out/kernel目录下就是内核编译目录位置,具体结构如下所示:
├── build # 编译生成的临时文件
│   ├── arch
│   ├── block
│   ├── certs
│   ├── crypto
│   ├── drivers #编译生成的驱动模块在此目录中
│   ├── fs
│   ├── include
│   ├── init
│   ├── ipc
│   ├── kernel
│   ├── lib
│   ├── Makefile
│   ├── mm
│   ├── modules.builtin
│   ├── modules.builtin.modinfo
│   ├── modules.order
│   ├── Module.symvers
│   ├── net
│   ├── scripts
│   ├── security
│   ├── sound
│   ├── source -> /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4
│   ├── System.map
│   ├── usr
│   ├── virt
│   ├── vmlinux
│   └── vmlinux.o
└── staging
    └── sunxi.dtb #猜测是设备树

比如内核编译后wifi模块的驱动文件就存放在OK113i-linux-sdk/out/kernel/build/drivers/net/wireless/rtl8723du目录下的8723du.ko

KERNEL MENUCONFIG 配置

build.sh menuconfig

上面设置的config居然是out目录下的文件,重新编译会被覆盖。
编译阶段打印使用这个配置/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig,试着改这个试试。

BUILDROOT 编译

./build.sh rootfs

默认全部编译运行build.sh,会有如下打印有用信息,此处记录下:

编译Qt测试程序时候的打印

...
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/arm-linux-gnueabi-g++ -c -pipe -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os --sysroot=/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot -O2 -O3 -Wall -W -D_REENTRANT -fPIC -DQT_NO_UITOOLS -DQT_NO_DEBUG -DQT_WEBKITWIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5 -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtWebKitWidgets -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtPrintSupport -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtWidgets -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtWebKit -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtGui -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtNetwork -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/qt5/QtCore -I. -I. -I/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/mkspecs/devices/linux-buildroot-g++ -o settings.o settings.cpp

/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/qmake -o Makefile /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/platform/framework/auto/qt_demo/terminal/terminal.pro ) && make -f Makefile 

build emmc rootfs
PARTITION_FEX=/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/device/config/chips/t113_i/configs/ok113i/longan/sys_partition.fex
ROOTFS_FEX_LINE=64
ROOTFS_FEX_STR=    size         = 2097152
ROOTFS_FEX_SIZE= 2097152
EXT4_SIZE=1073741824(1073741824/1024/1024)
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/device/config/chips/t113_i/configs/ok113i/longan/sys_partition.fex rootfs.fex size is  2097152
EXT4_SIZE= 2097152*512=1073741824
Creating filesystem with parameters:
    Size: 1073741824
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 4096
    Label: 
    Blocks: 262144
    Block groups: 8
    Reserved blocks: 0
    Reserved block group size: 63
Created filesystem with 8976/65536 inodes and 94920/262144 blocks
/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/build/bin/make_ext4fs -s -l 1073741824 /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/rootfs.ext4  /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/target

可以知道:

  1. sysroot = /home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/arm-buildroot-linux-gnueabi/sysroot
  2. 移植好的qmake所在路径: OK113i-linux-sdk/out/t113_i/ok113i/longan/buildroot/host/bin/qmake
  3. Qt示例工程源代码在/home/luoyang/Dev/sdk/T113-i/OK113i-linux-sdk/platform/framework/auto/qt_demo目录
  4. 编译好的驱动模块都在OK113i-linux-sdk/out/t113_i/ok113i/longan/dist目录下面:
OK113i-linux-sdk/out/t113_i/ok113i/longan/dist$ tree
.
├── 8723du.ko
├── c2590_mipi.ko
├── gc030a_mipi.ko
├── gc0310_mipi.ko
├── gc2385_mipi.ko
├── gc5025_mipi.ko
├── imx278_2lane_mipi.ko
├── imx278_mipi.ko
├── imx386_2lane_mipi.ko
├── imx386_mipi.ko
├── md5.ko
├── modules.alias
├── modules.alias.bin
├── modules.builtin
├── modules.builtin.alias.bin
├── modules.builtin.bin
├── modules.dep
├── modules.dep.bin
├── modules.devname
├── modules.order
├── modules.softdep
├── modules.symbols
├── modules.symbols.bin
├── Module.symvers
├── nvp6158.ko
├── ov2680_mipi.ko
├── ov5640.ko
├── ov8858_r2a_4lane.ko
├── sha1_generic.ko
├── sp5409_mipi.ko
├── sunxi-ce.ko
├── vf-test.ko
├── xr819s.ko
├── xr829.ko
├── xradio_btlpm.ko
└── xr_usb_serial_common.ko

最后总结

板子出厂的rootfs中包含的基础软件是真的很全面,基本可以做到开箱即用了,wifi驱动也已经适配了,wpa_supplicant、bluealsa、bluez、alsa、tinyalsa等工具软件也已经包含。因为目前手头没有能直接可用的显示屏,所以HMI显示和视频解码等高级功能没法体验。不过对于喜欢折腾的先适配一块触摸显示屏还是很有必要的,这样可玩性更高。

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部