海思AI开发 [2]:搭建开发环境
在 Linux 服务器上建立交叉编译环境,Windows 工作台通过串口和网口与Hi3559AV100 单板连接,开发人员可以在 Windows 工作台中进行程序开发或者远程登录到 Linux 服务器进行程序开发。
搭建Linux服务器环境
使用wsl安装Ubuntu18.04
-
- 直接在Windows Store中搜索linux进行安装
cd <tool-dir> |
-
- 通过管理工具可以将子系统移动到非C盘,防止C盘爆炸
安装nfs,samna,ssh等网络组件
暂时略过,windows可以通过\\wsl$\Ubuntu-18.04
访问wsl的文件系统
软件包安装
-
- 配置默认使用bash,执行
sudo dpkg-reconfigure dash
,选no
- 配置默认使用bash,执行
-
- 执行如下,安装软件包:
sudo apt-get install make libc6:i386 lib32z1 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools:i386 texinfo texlive gawk libssl-dev openssl bc |
报如下错误:
Package libc6:i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libdb1-compat tzdata
E: Package ‘libc6:i386’ has no installation candidate
E: Unable to locate package u-boot-tools:i386
跳过libc6:i386
,直接安装lib32z1
,会提示如下:
The following additional packages will be installed:
libc6-i386
The following NEW packages will be installed:
lib32z1 libc6-i386
这应该是名字写的有问题,同样u-boot-tools:i386
也会有:
E: Unable to locate package u-boot-tools:i386`
尝试u-boot-tools-i386
也不行,安装u-boot-tools
倒是可以。
其他软件包安装没有问题。
-
- 创建
/etc/ld.so.preload
文件,并执行echo "" > /etc/ld.so.preload
,以解决 64bit linux server 上某些第三方库编译失败的问题。
- 创建
安装交叉编译工具
-
- 将
aarch64-himix210-linux.tgz
拷贝到linux系统~
文件夹下,执行如下命令:
- 将
tar -xvf aarch64-himix210-linux.tgz |
-
- 打印如下提示信息:
Installing HuaWei LiteOS Linux at /opt/hisi-linux/x86-arm
mkdir: created directory ‘/opt/hisi-linux’
mkdir: created directory ‘/opt/hisi-linux/x86-arm’
mkdir: created directory ‘/opt/hisi-linux/x86-arm/aarch64-himix210-linux’
Extract cross tools …
export path /opt/hisi-linux/x86-arm/aarch64-himix210-linux/bin
是为安装成功
测试交叉编译工具
写了一个简单的测试工程,目录结果如下:
hello |
cross_build.sh
内容如下:
cmake -DCMAKE_BUILD_TYPE=Release \ |
执行sh文件结果如下:
– The C compiler identification is GNU 7.3.0
– The CXX compiler identification is GNU 7.3.0
– Check for working C compiler: /opt/hisi-linux/x86-arm/aarch64-himix210-linux/bin/aarch64-himix210-linux-gcc
– Check for working C compiler: /opt/hisi-linux/x86-arm/aarch64-himix210-linux/bin/aarch64-himix210-linux-gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /opt/hisi-linux/x86-arm/aarch64-himix210-linux/bin/aarch64-himix210-linux-g++
– Check for working CXX compiler: /opt/hisi-linux/x86-arm/aarch64-himix210-linux/bin/aarch64-himix210-linux-g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Configuring done
– Generating done
– Build files have been written to: /home/aaron-wu/cross_compile_test/hello/build
Scanning dependencies of target hello
[ 66%] Building CXX object CMakeFiles/hello.dir/src/hello.cc.o
[ 66%] Building CXX object CMakeFiles/hello.dir/main.cc.o
[100%] Linking CXX executable hello
[100%] Built target hello
编译成功
首次安装SDK
SDK包
在Hi3559AV100***/01.software/board
目录下,可以看到一个Hi3559AV100_SDK_Vx.x.x.x.tgz
的文件,该文件就是 Hi3559AV100 的软件开发包
解压缩SDK包
-
- 将上述SDK包拷贝到linux服务器上
-
- 执行如下命令进行解压缩
tar -zxf Hi3559AV100_SDK_Vx.x.x.x.tgz |
展开SDK包内容
cd Hi3559AV100_SDK_V2.0.4.0/ |