Hi3556v200踩坑笔记(2)

Hi3556v200踩坑笔记(2)

学习资料

  1. Hi35XX海思芯片基础使用
  2. 海思3559
  3. Hisi海思

常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
app/komod/usb2net_load.sh;ifconfig usb0 192.168.2.10 netmask 255.255.255.0;route add default gw 192.168.2.1
mount -t nfs -o tcp,nolock 192.168.2.1:/nfs /mnt
/mnt/gdbserver :1234 /app/bin/main_app


mount -t nfs -o tcp,nolock 192.168.2.150:/nfsroot /mnt
/mnt/openssh/sbin/sshd

app/komod/usb2net_load.sh;ifconfig usb0 192.168.2.10 netmask 255.255.255.0;route add default gw 192.168.2.1
/gdbserver :1234 /app/bin/main_app

sed -i 's/.\/main_app \&/#.\/main_app \&/' /app/bootapp

ifconfig lo up;
wget --spider -q "http://192.168.2.10/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=1"
wget --spider -q "http://192.168.2.10/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=0"


wget --spider -q "http://127.0.0.1/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=1"
wget --spider -q "http://127.0.0.1/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=0"

wget --spider -q "http://192.168.0.1/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=1"

ifconfig lo up;
wget --spider -q "http://192.168.0.1/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=1"
wget --spider -q "http://127.0.0.1/cgi-bin/hisnet/setsceneauto.cgi?&-sceneauto=1"
http://192.168.0.1/cgi-bin/hisnet/getwifi.cgi
http://192.168.0.1/cgi-bin/hisnet/setworkmode.cgi?-workmode=NORM_REC
http://192.168.0.1/cgi-bin/hisnet/getworkstate.cgi?
http://192.168.0.1/cgi-bin/hisnet/workmodecmd.cgi?&-cmd=start
#rtsp://192.168.2.10:554/livestream/5


#nautilus /home/pc/hi3556/
#自启文件在/etc/init.d文件夹和/app/bootapp文件
#网络配置 默认修改上述自启文件,禁止启动main_app,才能加载usb0
/app/komod/usb2net_load.sh;ifconfig usb0 192.168.2.10 netmask 255.255.255.0;route add default gw 192.168.2.1
#ifconfig wlan0 192.168.2.1 netmask 255.255.255.0;route add default gw 192.168.2.1
#挂载nfs
mount -t nfs -o nolock 192.168.2.150:/nfsroot /mnt


ls -lht
fd -h

/mnt/gdbserver :1234 /mnt/main_app
/mnt/gdbserver :1234 /app/bin/main_app

./xml2bin -b /hisi/sdk/reference/dashcam/modules/ui/carrecorder/higv/higv.bin -l /hisi/sdk/reference/dashcam/modules/ui/carrecorder/bin/ -x /hisi/sdk/reference/dashcam/modules/ui/carrecorder/xml/ -e /hisi/sdk/middleware/component/higv/tools/64bit_xml2bin/new -t c

./xml2bin -b ./ui3556/output/higv.bin -e ./ui3556/extcfile/ -t c -x ./ui3556/xml/ -l ./ui3556/output/

检测摄像头

1
2
3
4
5
virt-tty a7
cat proc/umap/mipi_rx
cat /proc/umap/vi
cat /proc/umap/vpss
cat /proc/umap/venc

环境搭建

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#用户切换,保留$PATH
su - root
su - pc
#nfs pc
sudo /etc/init.d/nfs-kernel-server start
sudo ufw disable#关闭防火墙
#海思包安装命令
sudo apt-get install -y build-essential
sudo apt-get install u-boot-tools
sudo apt-get install zlib1g-dev liblzo2-dev uuid-dev pkg-config
sudo apt-get install make libc6 lib32z1 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk curl upx pngquant
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
#海思手册没有的包安装命令
sudo apt-get install bison flex dos2unix aptitude libpcap-dev gperf libuuid1:i386 u-boot-tools libpam0g-dev lib32z1-dev unzip
sudo aptitude install libtool
#arm
apt-get install build-essential u-boot-tools zlib1g-dev liblzo2-dev uuid-dev pkg-config make libc6 lib32z1 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk curl upx pngquant make libc6 lib32z1 lib32stdc++6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk libssl-dev openssl bc bison flex dos2unix aptitude libpcap-dev gperf libuuid1 libpam0g-dev lib32z1-dev
apt-get install build-essential u-boot-tools zlib1g-dev liblzo2-dev uuid-dev pkg-config make libc6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk curl upx pngquant make libc6 zlib1g-dev libncurses5-dev ncurses-term libncursesw5-dev g++ u-boot-tools texinfo texlive gawk libssl-dev openssl bc bison flex dos2unix aptitude libpcap-dev gperf libuuid1 libpam0g-dev
sudo aptitude install libtool

##工具链安装命令
su
source ./arm-himix100-linux.install
#bash环境变量
sudo gedit /etc/profile
export PATH="/opt/hisi-linux/x86-arm/arm-himix100-linux/bin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/x86_64-linuxgnu/pkgconfig"

################
# 其他命令
################
#默认make all编译后,自启main_app刷屏,kill,然后修改自启文件
top #查看id
kill id
#裁剪Linux内核
cp ./arch/arm/configs/hi3559v200_amp_defconfig .config #如果make all过,跳过该步
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- menuconfig
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage -j 20

开启NFS 内核配置

首先make all,然后进入内核目录修改。

1
2
3
#cp arch/arm/configs/hi355xvxx_xxx_defconfig .config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- menuconfig
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage -j 20

使用

1
cat /proc/filesystems

查看是否有nfs,有则配置成功

1
2
#查看nfs是否共享成功
showmount -e <ip>

OpenSSH配置

相关资料

  1. openssh移植及使用
  2. 移植openssh到arm-linux
  3. HI3516DV300笔记(三)安装SSH和SFTP
  4. 全志A33 SSH移植配置(已成功)

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#下载 编译 
wget https://mirrors.tuna.tsinghua.edu.cn/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz --no-check-certificate
wget https://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz --no-check-certificate
wget https://archive.fastgit.org/openssl/openssl/archive/refs/tags/OpenSSL_1_0_1t.tar.gz --no-check-certificate

tar -zxvf zlib-1.2.11.tar.gz;
tar -zxvf OpenSSL_1_0_1t.tar.gz;
tar -zxvf openssh-6.1p1.tar.gz;

cd ./openssl-OpenSSL_1_0_1t
./Configure --prefix=$PWD/_install os/compiler:arm-himix100-linux-gcc
make -j20
make install

cd ..
cd ./zlib-1.2.11
export CC=/opt/hisi-linux/x86-arm/arm-himix100-linux/bin/arm-himix100-linux-gcc
./configure --prefix=$PWD/_install --static
make -j20
make install

cd ..
cd ./openssh-6.1p1
#主要--prefix= 后面跟的路径是在板端的绝对路径
#export OPENSSHINSTALLPATH=/
export OPENSSHINSTALLPATH=/mnt/openssh
./configure --host=arm-himix100-linux --prefix=$OPENSSHINSTALLPATH --with-zlib=$PWD/../zlib-1.2.11/_install --with-ssl-dir=$PWD/../openssl-OpenSSL_1_0_1t/_install --with-libs --disable-etc-default-login --disable-strip CC=arm-himix100-linux-gcc AR=arm-himix100-linux-ar
make -j20

#打包
#install & pack

#cd ./openssh_build

export TOPPATH=$PWD/../openssh_build
export ROOTPATH=$TOPPATH/rootfs
mkdir $ROOTPATH
mkdir -p $ROOTPATH/bin
mkdir -p $ROOTPATH/sbin
mkdir -p $ROOTPATH/usr/local/openssh
mkdir -p $ROOTPATH/usr/local/libexec
mkdir -p $ROOTPATH/usr/local/etc
mkdir -p $ROOTPATH/usr/local/openssh/etc
mkdir -p $ROOTPATH/usr/local/openssh/bin

cp scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan $ROOTPATH/usr/local/openssh/bin
cp sshd_config ssh_config $ROOTPATH/usr/local/openssh/etc
cp sshd $ROOTPATH/sbin
cp sftp-server ssh-keysign $ROOTPATH/usr/local/libexec
cd $ROOTPATH/bin
ln -s /usr/local/openssh/bin/scp
ln -s /usr/local/openssh/bin/sftp
ln -s /usr/local/openssh/bin/ssh
ln -s /usr/local/openssh/bin/ssh-add
ln -s /usr/local/openssh/bin/ssh-agent
ln -s /usr/local/openssh/bin/ssh-keygen
ln -s /usr/local/openssh/bin/ssh-keyscan

cd $ROOTPATH
cp $TOPPATH/sshd_config $ROOTPATH/usr/local/openssh/etc
cp $TOPPATH/openssh_install.sh $ROOTPATH
tar -zcvf $TOPPATH/../openssh_build.tar.gz .

###########
# 板端执行
###########
#board openssh_install.sh
tar -zxvf /openssh_build.tar.gz
#mkdir -p /var/run/sshd
#mkdir -p /var/empty
export OPENSSHPATH=/
export MNTPATH=/

#export OPENSSHPATH=/mnt/openssh
#export MNTPATH=/mnt
export SSHKEYGRNPATH=$OPENSSHPATH/usr/local/openssh/bin
mkdir $OPENSSHPATH/etc
cd $OPENSSHPATH/usr/local/etc
$SSHKEYGRNPATH/ssh-keygen -t rsa -f ssh_host_rsa_key -N ""
$SSHKEYGRNPATH/ssh-keygen -t dsa -f ssh_host_dsa_key -N ""
$SSHKEYGRNPATH/ssh-keygen -t ecdsa -f ssh_host_ecdsa_key -N ""
$SSHKEYGRNPATH/ssh-keygen -t dsa -f ssh_host_ed25519_key -N ""
cp $OPENSSHPATH/usr/local/openssh/etc/sshd_config $OPENSSHPATH/etc
cp $OPENSSHPATH/usr/local/openssh/etc/ssh_config $OPENSSHPATH/etc
cp $OPENSSHPATH/usr/local/openssh/etc/ssh_config $OPENSSHPATH/etc
mkdir -p /usr/local/etc
cp $OPENSSHPATH/usr/local/openssh/etc/ssh_config /usr/local/etc
mkdir -p /var/run/sshd
mkdir -p /var/empty
cd /var
chown root.root empty -R
#board start ssh
/sbin/sshd
/mnt/openssh/sbin/sshd

此时文件目录为

压缩包文件结果如下

找到sshd_config修改如下:

1
2
3
4
5
6
7
8
9
10
11
HostKey /usr/local/etc/ssh_host_rsa_key
HostKey /usr/local/etc/ssh_host_dsa_key
HostKey /usr/local/etc/ssh_host_ecdsa_key
PermitRootLogin yes
PasswordAuthentication yes
PermitEmptyPasswords yes

Subsystem sftp internal-sftp

#避免Privilege separation user sshd does not exist
UsePrivilegeSeparation no

ssh通过密钥无密码访问服务器时,尽管密钥配好了,端口服务启动都正常,但是还是ssh还是不能访问。最后发现,是密钥文件的权限问题,一般来说:
对.ssh目录设置700权限
对id_rsa,authorized_keys文件设置600权限
对id_rsa.pub,known_hosts文件设置644权限
所以,权限设置不对的话ssh登陆不上Linux系统

vscode 环境配置

资料

  1. vscode连接SSH远程服务器(详细版)

  2. 手把手教windows10/linux ssh免密登录

  3. VSCode远程SSH免密登录配置实现

  4. VsCode + gdb + gdbserver远程调试C++程序

  5. 使用 VSCode 远程 图形化 GDB 调试 嵌入式linux

  6. vscode 使用makefile 在线调试运行C/C++程序的方法

SD卡使用

1
2
3
4
# 加载驱动
/app/komod/mmc_load.sh
# 挂载
mount /dev/mmcblk0p1 /mnt/sd

CLION

Using local makefile for CLion instead of CMake

Dealing with Makefile Projects in CLion: Status Update

CMAKE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1. 登录到 https://cmake.org/download/

2. 下载 cmake-3.21.0-rc2.tar.gz

wget https://github.com/Kitware/CMake/releases/download/v3.21.0-rc2/cmake-3.21.0-rc2.tar.gz

3. 解压 cmake-3.21.0-rc2.tar.gz

tar -zxvf cmake-3.21.0-rc2.tar.gz

4. 切换到 CMake 源目录并执行 bootstrap 脚本

cd cmake-3.21.0-rc2
./bootstrap --parallel=32

5. 执行 make
make -j32
make install -j32
ln -s /usr/local/bin/cmake /usr/bin/cmake
#ln [original filename] [link name]

6. 查看 cmake 工具版本
cmake --version

问题 Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable

1
sudo apt install libssl-dev

提取CFLAGS

1
2
echo $CFLAGS
read

Remote Debug

  1. 海思3559万能平台搭建:在线调试1gdb+gdbserver
  2. 海思3559万能平台搭建:在线调试3VsCode插件
  3. 使用 VSCode 远程 图形化 GDB 调试 嵌入式linux
  4. Hisi 使用GDB调试(远程调试)

GDB编译

1
2
3
4
5
6
7
#gdb
sudo apt install libgmp-dev libexpat1-dev
./configure --target=arm-himix100-linux --prefix=/opt/gdb-12.1/ -v
make -j8
make install
sudo ln -s /opt/gdb-12.1/bin/arm-himix100-linux-gdb /opt/hisi-linux/x86-arm/arm-himix100-linux/bin/arm-himix100-linux-gdb
#gdbserver

pqtools

  1. 海思3556V200 PQTools 工具环境搭建
1
2
3
4
5
6
7
8
9
10
11
12
13
#usb 连接  192.168.2.10 这个ip是自己配置的
app/komod/usb2net_load.sh;ifconfig usb0 192.168.2.10 netmask 255.255.255.0;route add default gw 192.168.2.1

#WIFI 连接192.168.0.1
cp -rf /app/bin/libs/libmpi.so /lib/
cp -rf /app/bin/libs/libsecurec.so /lib/

ifconfig lo up;
wget --spider -q "http://192.168.2.10/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=1"
wget --spider -q "http://192.168.2.10/cgi-bin/hisnet/setpqdebug.cgi?&-pqdebug=0"

#rtsp地址
rtsp://IP:554/livestream/1

WSL开发环境

Windows10 WSL2搭建支持nfs的hi3518开发环境

关于wsl执行32位程序

wsl并不支持32位程序,wsl2才可以。需要安装几个基础库:

1
2
3
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install gcc-multilib

有了这几个库是前提,安装32位版本的程序或库的时候,要在最后添加:i386来指定架构。

可以通过Hyper-V管理器->虚拟交换机管理器,配置WSL2为外部网络,从而直接板端和WSL2通讯

添加reference/common库

  1. reference/common目录下 make all

  2. reference/dashcam/modules/init/amp/linux/Makefile 这里添加hiosd_client

    1
    2
    3
    4
    COMM_LIBS :=	-ldevmng -lphotomng -lrecordmng -lusb \
    -lstoragemng -lutils -lhilog -ltimedtask -ltimestamp -lmsg_client -lhicycle -lhiflash \
    -lthttpd -lhisnet -lpowercontrol -lfiletrans -lliveserver -lplayback -lupgrade\
    -lsharefs -lscene_client -lsystem -lqueue -lhiosd_client

    HIOSD

    middleware/ndk/sample/arch/common/sample_public_venc.c

    middleware/ndk/sample/arch/common/loadbmp.c

问题

  1. 提示没有空间

  2. 无法在这个大型工作区文件夹中监视文件更改。请按照说明链接来解决此问题。

  3. hi_gzip

    问题解决:error: #error “Please port gnulib fseterr.c to your platform! Look at the definitions of ferror

    从放弃到入门[二] 海思Hi3516EV200 SDK初体验

  4. gdb调试symbol 'ps_lgetfpregs': can't resolve symbol

    <<BSP FAQ.docx>>

    1
    2
    3
    4
    5
    $ file /hisi/demo/reference/dashcam/rootfs/rootfs/lib/libpthread-0.9.33.2.so
    /hisi/demo/reference/dashcam/rootfs/rootfs/lib/libpthread-0.9.33.2.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter ld-uClibc.so.0, stripped

    $ file /opt/hisi-linux/x86-arm/arm-himix100-linux/target/lib/a7_softfp_neon-vfpv4/libpthread-0.9.33.2.so
    /opt/hisi-linux/x86-arm/arm-himix100-linux/target/lib/a7_softfp_neon-vfpv4/libpthread-0.9.33.2.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter ld-uClibc.so.0, with debug_info, not stripped

    not stripped的动态库替换即可

  5. 改60fps

  6. 使用PQTools缺少动态库

    使用标定工具前,请注意:工具利用了Matlab,因此需要用户预先安装MCR(MatlabCompiler Runtime)2012a(7.17)的32位版本。下载地址:
    http://cn.mathworks.com/products/compiler/mcr/

分析

  1. 自启动
  2. 开发环境
  3. 动态库strip

SDK

  1. uboot 启动三秒

    osdrv/opensource/uboot/u-boot-2016.11/common/autoboot.c

  2. wifi没开

    reference/dashcam/modules/param/inicfg/hi3559v200/carrecorder/imx385_128M/config_product_devmng.ini

  3. 存储空间大小

    menuconfig

HiGVBuilder生成二进制文件报错

在这个提示出现后,不要关掉,打开output文件夹,发现有如下文件:

将这些文件单独复制到一个新的文件夹,并把与HiGVBuilder.exe同目录的xml2bin.exe复制到新的文件内,这命令行运行该程序,即可正常生成。

屏幕排线修改

  1. build\kconfig.mak

    1
    2
    3
    else ifeq ($(CONFIG_SCREEN_OLP039XGG0401), y)
    KCONFIG_CFLAGS += -DCONFIG_SCREEN_OLP039XGG0401
    KCONFIG_CFLAGS += -DCONFIG_SCREEN_TYPE_LCD16BIT
  2. amp\a7_liteos\mpp\init\sdk_init.c

    1
    2
    3
    4
    void vo_24bit_lcd_mux(void)
    int pinmux(void){
    vo_bt656_mode_mux();
    }
  3. reference\hal\screen\Kconfig

    1
    2
    3
    4
    5
    config SCREEN_OLP039XGG0401
    bool "SCREEN_OLP039XGG0401_bt656"
    depends on (HI3559V200 || HI3556V200) && DEMB
    help
    A Small Screen use RGB Serail Transmission
  4. reference\dashcam\modules\init\amp\liteos\src\hi_product_init_hi3559v200.c

    1
    static void Lcd_Pin_Mux(void) 
  5. VDP INTF_LCD_CTRL 0x1144D300

  6. IO驱动能力要加大

注意事项

  1. oled io驱动能力 大到小调试

ResImage

1
./res2img.sh ../data/target/ ./reslist.txt  ./resImage

注意reslist.txt 最后一行为回车

Hi3556v200踩坑笔记(2)

https://www.shjdgwj.cn/72703c183503/

作者

GWJ

发布于

2022-10-01

更新于

2023-12-28

许可协议

评论