参考海思官方文档:《Hi3519AV100╱Hi3556AV100 开发环境用户指南.pdf》、《Hi3519AV100 SDK 安装及升级使用说明.pdf》
1、安装ubuntu18.04虚拟机
- 虚拟机版本:VMware® Workstation 15 Pro
- 操作系统版本:ubuntu-18.04.1-desktop-x64
- 海思Hi3519A交叉编译工具只支持32位
- ubuntu18.04无官方32位ISO镜像
- ubuntu16.04的32位系统,正在vmware-tools无法正常复制文件的问题
- 所以选择ubuntu18.04 64位操作系统作为开发环境
# 系统版本
hisilicon@ubuntu:~$ uname -a
Linux ubuntu 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# 系统更新
hisilicon@ubuntu:~$ sudo apt update
......
hisilicon@ubuntu:~$ sudo apt upgrade
......
2、安装arm-himix200-linux工具链
- 切换到root账号或者使用sudo安装,避免权限不足
- 工具链默认会安装/opt/hisi-linux/x86-arm路径下
- 解压需要时间较长,需要耐心等待
- 由于开发环境操作系统为64位,工具链为32位,安装完成后直接运行相关命令会提示文件不存在
- 所以需要安装32位库:sudo apt install lib32z1-dev
- 如果修改软件源为阿里等国内镜像源,可能会因为源地址配置不全造成32位库安装失败
# 切换root
hisilicon@ubuntu:~$ sudo su
[sudo] password for hisilicon:
# 将安装包复制到Downloads目录,并进入该目录
root@ubuntu:/home/hisilicon# cd Downloads/arm-himix200-linux/
# 安装工具链
root@ubuntu:/home/hisilicon/Downloads/arm-himix200-linux# source ./arm-himix200-linux.install
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/arm-himix200-linux'
Extract cross tools ...
export path /opt/hisi-linux/x86-arm/arm-himix200-linux/bin
# 安装32位库
hisilicon@ubuntu:~$ sudo apt install lib32z1-dev
[sudo] password for hisilicon:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cpp-7 gcc gcc-7 gcc-7-base gcc-7-multilib gcc-8-base gcc-multilib lib32asan4
lib32atomic1 lib32cilkrts5 lib32gcc-7-dev lib32gcc1 lib32gomp1 lib32itm1
lib32mpx2 lib32quadmath0 lib32stdc++6 lib32ubsan0 lib32z1 libasan4
libatomic1 libc-dev-bin libc6-dev libc6-dev-i386 libc6-dev-x32 libc6-i386
libc6-x32 libcc1-0 libcilkrts5 libgcc-7-dev libgcc1 libgomp1 libitm1
liblsan0 libmpx2 libquadmath0 libstdc++6 libtsan0 libubsan0 libx32asan4
libx32atomic1 libx32cilkrts5 libx32gcc-7-dev libx32gcc1 libx32gomp1
libx32itm1 libx32quadmath0 libx32stdc++6 libx32ubsan0 linux-libc-dev
manpages-dev zlib1g-dev
Suggested packages:
gcc-7-locales make autoconf automake libtool flex bison gcc-doc gcc-7-doc
libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg
liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg
libquadmath0-dbg glibc-doc
The following NEW packages will be installed:
gcc gcc-7 gcc-7-multilib gcc-multilib lib32asan4 lib32atomic1 lib32cilkrts5
lib32gcc-7-dev lib32gcc1 lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0
lib32stdc++6 lib32ubsan0 lib32z1 lib32z1-dev libasan4 libatomic1
libc-dev-bin libc6-dev libc6-dev-i386 libc6-dev-x32 libc6-i386 libc6-x32
libcilkrts5 libgcc-7-dev libitm1 liblsan0 libmpx2 libquadmath0 libtsan0
libubsan0 libx32asan4 libx32atomic1 libx32cilkrts5 libx32gcc-7-dev
libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0 libx32stdc++6 libx32ubsan0
linux-libc-dev manpages-dev zlib1g-dev
The following packages will be upgraded:
cpp-7 gcc-7-base gcc-8-base libcc1-0 libgcc1 libgomp1 libstdc++6
7 upgraded, 46 newly installed, 0 to remove and 179 not upgraded.
Need to get 43.8 MB/44.3 MB of archives.
After this operation, 152 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
......
# 验证工具链是否可正常运行
root@ubuntu:/home/hisilicon/Downloads/arm-himix200-linux# arm-himix200-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-himix200-linux-gcc
COLLECT_LTO_WRAPPER=/opt/hisi-linux/x86-arm/arm-himix200-linux/host_bin/../libexec/gcc/arm-linux-gnueabi/6.3.0/lto-wrapper
Target: arm-linux-gnueabi
Configured with: /home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/src/gcc-6.3.0/configure --host=i386-redhat-linux --build=i386-redhat-linux --target=arm-linux-gnueabi --prefix=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/install --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --disable-nls --enable-clocale=gnu --enable-extra-hisi-multilibs --with-sysroot=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/install/target --with-build-sysroot=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/install/target --with-gmp=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/obj/host-libs/usr --with-mpfr=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/obj/host-libs/usr --with-mpc=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix200-linux/arm_himix200_build_dir/obj/host-libs/usr --enable-libgomp --disable-libitm --enable-poison-system-directories --with-pkgversion='HC&C V1R3C00SPC200B005_20190606' --disable-bootstrap
Thread model: posix
gcc version 6.3.0 (HC&C V1R3C00SPC200B005_20190606)
# 如果重启后或者切换用户后无法使用相关工具命令,可重新引用相关环境变量
hisilicon@ubuntu:~/Downloads/arm-himix200-linux$ sudo su
root@ubuntu:/home/hisilicon/Downloads/arm-himix200-linux# source /etc/profile
3、安装Hi3519AV100SDK
- SDK并不是真正的安装,而是当前目录解压展开,需提前规划好目录
- 由于默认shell的原因,直接运行./sdk.unpack会出错,可使用bash shell运行解包脚本
# 解压SDK
root@ubuntu:/home/hisilicon/3519A# tar -zxf Hi3519AV100_SDK_V2.0.2.0.tgz
root@ubuntu:/home/hisilicon/3519A# cd Hi3519AV100_SDK_V2.0.2.0/
root@ubuntu:/home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0# ls
package scripts sdk.cleanup sdk.unpack smp_image_glibc
# 安装SDK
root@ubuntu:/home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0# /bin/bash sdk.unpack
Unpacking SDK
WARN: Be sure you have installed the cross-compiler. if not, install it first!
WARN: ALL THE SOUCE FILES WILL BE OVERWRITED, FILES YOU MOTIFIED WILL BE LOST !!!
SDK_CHIP =hi3519av100
unpacking drv
mkdir: created directory 'drv/'
run_command_progress_float: 'tar -xvzf package/drv.tgz'
[100%]##################################################|
unpacking osal
mkdir: created directory 'osal/'
run_command_progress_float: 'tar -xvzf package/osal.tgz'
[100%]##################################################|
unpacking osdrv
run_command_progress_float: 'tar -xvzf package/osdrv.tgz'
[100%]##################################################|
mkdir: created directory 'smp'
mkdir: created directory 'smp/a53_linux/'
unpacking mpp_smp_linux.tgz
run_command_progress_float: 'tar -xvzf package/mpp_smp_linux.tgz -C smp/a53_linux'
[100%]##################################################|
/home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0/smp/a53_linux /home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0
/home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0
直接执行./sdk.unpack进行解压安装会报错,因为Ubuntu中,/bin/sh默认已经指向dash,这是一个不同于bash的shell,主要是为了执行脚本而出现,而不是交互,dash速度更快,但功能比bash少很多,语法严格遵守POSIX标准,**出现错误后不会执行后续脚本命令**。
解决方法1:
步骤1:/bin/bash sdk.unpack
解决方法2:
步骤1:vim scripts/common.sh; 第一行:#!/bin/sh->!/bin/bash
步骤2:vim sdk.unpack; 第一行:#!/bin/sh->!/bin/bash
步骤3:./sdk.unpack
解决方法3:
步骤1:sudo dpkg-reconfigure dash
步骤2:出现菜单问是否需要dash,选no.
步骤3:./sdk.unpack
root@ubuntu:/home/hisilicon/3519A/Hi3519AV100_SDK_V2.0.2.0# ./sdk.unpack
./sdk.unpack: 2: ./sdk.unpack: source: not found
./sdk.unpack: 4: ./sdk.unpack: ECHO: not found
./sdk.unpack: 6: ./sdk.unpack: WARN: not found
./sdk.unpack: 7: ./sdk.unpack: WARN: not found
./sdk.unpack: 8: ./sdk.unpack: ECHO: not found
./sdk.unpack: 15: ./sdk.unpack: ECHO: not found
./sdk.unpack: 20: ./sdk.unpack: ECHO: not found
mkdir: created directory 'drv/'
./sdk.unpack: 22: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 24: ./sdk.unpack: ECHO: not found
mkdir: created directory 'osal/'
./sdk.unpack: 26: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 28: [: =: unexpected operator
./sdk.unpack: 28: [: =: unexpected operator
./sdk.unpack: 34: ./sdk.unpack: ECHO: not found
mkdir: created directory 'osdrv/'
./sdk.unpack: 36: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 39: [: =: unexpected operator
./sdk.unpack: 54: [: =: unexpected operator
./sdk.unpack: 54: [: =: unexpected operator
./sdk.unpack: 82: [: =: unexpected operator
./sdk.unpack: 82: [: =: unexpected operator
./sdk.unpack: 110: [: =: unexpected operator
./sdk.unpack: 110: [: =: unexpected operator
来源:oschina
链接:https://my.oschina.net/u/4272821/blog/4701046