前言
最近在使用RK1808,板子是公司硬件的同事做的,除了cpu外,其它元器件和电路大部分是参考的demo板,因此调试过程不是很顺利,有坑的地方我尽量记录下来
uboot
默认SDK里面的uboot设置有个问题,那就是启动时delay为0,当然产品可以这样做,但是调试的时候偶尔还是需要进入command line的,因此这里需要做一定的修改
打开默认的配置文件:vi your_sdk/u-boot/configs/rk1808_defconfig
修改delay参数:CONFIG_BOOTDELAY=3
为什么我要在这里修改,因为为了图方便,我是用它提供的build.sh脚本进行编译,该脚本的帮助打印如下
====USAGE: build.sh modules====
uboot -build uboot
kernel -build kernel
modules -build kernel modules
rootfs -build default rootfs, currently build buildroot as default
buildroot -build buildroot rootfs
ramboot -build ramboot image
yocto -build yocto rootfs, currently build ros as default
ros -build ros rootfs
debian -build debian rootfs
pcba -build pcba
recovery -build recovery
all -build uboot, kernel, rootfs, recovery image
cleanall -clean uboot, kernel, rootfs, recovery
firmware -pack all the image we need to boot up system
updateimg -pack update image
otapackage -pack ab update otapackage image
save -save images, patches, commands used to debug
default -build all modules
使用./build.sh uboot或者./build.sh kernel进行编译,会自动去调取默认的配置文件,并将当前目录下的.config文件覆盖掉,因此要修改配置,就得直接改默认的配置文件,当然为了保险起见,建议最好先将源文件备份
另外,uboot是支持自己选串口的,修改以下参数可以实现,但是这个改了之后不一定能用,还得看设备树之类的配置是否启用了对应的串口
CONFIG_DEBUG_UART_SHIFT=2
进入uboot的command line后,命令行的提示信息也可以进行修改,一般改为公司名字,例如
Hit key to stop autoboot('CTRL+C'): 0
zigsun #
zigsun #
zigsun #
修改的方式,是在默认的配置文件后,加入一行
以太网
不知道什么原因,以太网在1808的设备树里面默认是不打开的,因此开机后,ifconfig只能看到lo和wlan0
最头疼的是官方的文档,也没有介绍1808的以太网该怎么弄,只介绍了其它一些芯片,还有3.10版本内核遇到问题该怎么处理,而这个1808的SDK内核是4.4版本的
所以一个很简单的问题,花了一天时间
解决办法:
找到uboot和kernel下的dts文件,注意该芯片是64位(Arm Cortex-A35 是最高效的 Armv8-A 64-bit 处理器)
给出我的路径,仅供参考
W:rockchipRKSDKu-bootarcharmdtsrk1808.dtsi
W:rockchipRKSDKkernelarcharm64bootdtsrockchiprk1808.dtsi
找到gmac开头的节点,将末尾的disabled修改为okay
gmac: ethernet@ffdd0000 {
...
/* status = "disabled"; */
status = "okay";
...
}
以太网还有别的问题存在,以后再做补充
NFS
内核配置中,NFS默认是不打开的,这在产品生产阶段当然没有问题,但是作为调试来讲,想传输文件就老麻烦了
在内核中,进行以下配置
make menuconfig
File systems --->
Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version 2
<*> NFS client support for NFS version 3
NFS client support for the NFSv3 ACL protocol extension
<*> NFS client support for NFS version 4
Provide swap over NFS support
NFS client support for NFSv4.1
NFS client support for NFSv4.2
(kernel.org) NFSv4.1 Implementation ID Domain
NFSv4.1 client support for migration
Root file system on NFS
[ ] Use the legacy NFS DNS resolver
< > NFS server support
[ ] RPC: Enable dprintk debugging
< > Ceph distributed file system
< > CIFS support (advanced network filesystem, SMBFS successor)
< > NCP file system support (to mount NetWare volumes)
< > Coda file system support (advanced network fs)
< > Andrew File System support (AFS)
Networking support --->
Networking options --->
IP: kernel level autoconfiguration
IP: DHCP support
IP: BOOTP support
[ ] IP: RARP support
编译内核的时候,可以选择用build.sh kernel,也可以自己make,当然得加一些参数
这里选择不修改默认的配置文件,自己使用make手动编译,只需要指定设备树和线程数即可
sudo make ARCH=arm64 rk1808-evb-v10.img -j8
网络测试工具iperf
板子上自带的iperf版本是(iperf version 2.0.10 (11 Aug 2017) pthreads)
我用这个工具主要是为了测试udp传输的丢包率,但是在实际测试的过程中,发现数据有问题,明显是溢出了
[ 3] local 192.168.10.101 port 5001 connected with 192.168.10.113 port 33501
[ 3] 0.0- 1.0 sec 12.5 MBytes 105 Mbits/sec 0.038 ms 0/ 8923 (0%)
[ 3] 1.0- 2.0 sec 12.5 MBytes 105 Mbits/sec 0.068 ms 0/ 8918 (0%)
[ 3] 2.0- 3.0 sec 12.5 MBytes 105 Mbits/sec 0.058 ms 0/ 8917 (0%)
[ 3] 3.0- 4.0 sec 12.5 MBytes 105 Mbits/sec 0.056 ms 0/ 8917 (0%)
[ 3] 4.0- 5.0 sec 12.5 MBytes 105 Mbits/sec 0.065 ms 0/ 8916 (0%)
[ 3] 5.0- 6.0 sec 12.5 MBytes 105 Mbits/sec 0.045 ms 0/ 8918 (0%)
[ 3] 6.0- 7.0 sec 12.5 MBytes 105 Mbits/sec 0.046 ms 0/ 8917 (0%)
[ 3] 7.0- 8.0 sec 12.5 MBytes 105 Mbits/sec 0.071 ms 0/ 8916 (0%)
[ 3] 8.0- 9.0 sec 12.5 MBytes 105 Mbits/sec 0.058 ms 0/ 8916 (0%)
[ 3] 0.0-10.0 sec 125 MBytes 105 Mbits/sec 0.046 ms 2147305320/2147394484 (1e+02%)
为了解决这个问题,到官网去下载了源码,版本选择的是较老的2.0.5(主要为了与主机ubuntu14.04-64bit的iperf版本对应)
https://iperf.fr/iperf-download.php
解压后,先进行配置,我的配置很长,主要是环境变量中指定的编译链是海思的,这回又来一个瑞星微的,我不想每次都去改环境变量,所以每次编译瑞星微的芯片都用绝对路径指定工具链,按照这个指定好CC和CXX,然后指定好安装路径prefix(编译完成后,make install的安装路径),注意这个配置是在一行内
sudo ./configure --host=arm CC=/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc CXX=/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ --prefix=/home/glx/share/rockchip/iperf-2.0.5/install
然后进行编译
sudo make
这其中有2个报错需要解决
/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/6.3.1/cstdlib:146:11: error: ‘::malloc’ has not been declared
using ::malloc;
/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/6.3.1/bits/cpp_type_traits.h:205:12: error: redefinition of ‘struct std::__is_integer’
struct __is_integer
。。。
struct __is_integer
主要是说malloc缺少声明,然后就是int和bool的重复定义
很好解决,修改一下配置生成的config.h文件即可,将以下两句话注释掉
//#define bool int
//#define malloc rpl_malloc
最后sudo make&sudo make install即可,最后使用nfs或者tftp将生成的文件传到目标板上,注意生成了两个目录bin和share,只需要拷贝bin目录下的可执行文件即可,将这个可执行文件,想办法去覆盖/usr/bin/iperf
测试时
找一个服务器执行 iperf -s -u -i 1
目标板执行 iperf -c 192.168.10.101 -u -b 100M
目标板打印信息:
[root@rk1808:/mnt/glx]# ./iperf -c 192.168.10.101 -u -b 100M
------------------------------------------------------------
Client connecting to 192.168.10.101, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.10.113 port 55651 connected with 192.168.10.101 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec
[ 3] Sent 84970 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec 0.043 ms 0/84969 (0%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
服务器打印信息:
[ 4] local 192.168.10.101 port 5001 connected with 192.168.10.113 port 55651
[ 4] 0.0- 1.0 sec 12.0 MBytes 101 Mbits/sec 0.106 ms 0/ 8546 (0%)
[ 4] 1.0- 2.0 sec 12.0 MBytes 100 Mbits/sec 0.041 ms 0/ 8540 (0%)
[ 4] 2.0- 3.0 sec 11.9 MBytes 99.5 Mbits/sec 0.073 ms 0/ 8465 (0%)
[ 4] 3.0- 4.0 sec 11.9 MBytes 99.5 Mbits/sec 0.049 ms 0/ 8464 (0%)
[ 4] 4.0- 5.0 sec 11.9 MBytes 99.5 Mbits/sec 0.046 ms 0/ 8458 (0%)
[ 4] 5.0- 6.0 sec 11.9 MBytes 99.6 Mbits/sec 0.052 ms 0/ 8467 (0%)
[ 4] 6.0- 7.0 sec 11.9 MBytes 100 Mbits/sec 0.051 ms 0/ 8507 (0%)
[ 4] 7.0- 8.0 sec 12.0 MBytes 100 Mbits/sec 0.041 ms 0/ 8539 (0%)
[ 4] 8.0- 9.0 sec 11.9 MBytes 100 Mbits/sec 0.079 ms 0/ 8518 (0%)
[ 4] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec 0.044 ms 0/84969 (0%)
[ 4] 0.0-10.0 sec 1 datagrams received out-of-order
显示已经正常,而且我的网络看起来还不错,udp传输没有丢包
前言
最近在使用RK1808,板子是公司硬件的同事做的,除了cpu外,其它元器件和电路大部分是参考的demo板,因此调试过程不是很顺利,有坑的地方我尽量记录下来
uboot
默认SDK里面的uboot设置有个问题,那就是启动时delay为0,当然产品可以这样做,但是调试的时候偶尔还是需要进入command line的,因此这里需要做一定的修改
打开默认的配置文件:vi your_sdk/u-boot/configs/rk1808_defconfig
修改delay参数:CONFIG_BOOTDELAY=3
为什么我要在这里修改,因为为了图方便,我是用它提供的build.sh脚本进行编译,该脚本的帮助打印如下
====USAGE: build.sh modules====
uboot -build uboot
kernel -build kernel
modules -build kernel modules
rootfs -build default rootfs, currently build buildroot as default
buildroot -build buildroot rootfs
ramboot -build ramboot image
yocto -build yocto rootfs, currently build ros as default
ros -build ros rootfs
debian -build debian rootfs
pcba -build pcba
recovery -build recovery
all -build uboot, kernel, rootfs, recovery image
cleanall -clean uboot, kernel, rootfs, recovery
firmware -pack all the image we need to boot up system
updateimg -pack update image
otapackage -pack ab update otapackage image
save -save images, patches, commands used to debug
default -build all modules
使用./build.sh uboot或者./build.sh kernel进行编译,会自动去调取默认的配置文件,并将当前目录下的.config文件覆盖掉,因此要修改配置,就得直接改默认的配置文件,当然为了保险起见,建议最好先将源文件备份
另外,uboot是支持自己选串口的,修改以下参数可以实现,但是这个改了之后不一定能用,还得看设备树之类的配置是否启用了对应的串口
CONFIG_DEBUG_UART_SHIFT=2
进入uboot的command line后,命令行的提示信息也可以进行修改,一般改为公司名字,例如
Hit key to stop autoboot('CTRL+C'): 0
zigsun #
zigsun #
zigsun #
修改的方式,是在默认的配置文件后,加入一行
以太网
不知道什么原因,以太网在1808的设备树里面默认是不打开的,因此开机后,ifconfig只能看到lo和wlan0
最头疼的是官方的文档,也没有介绍1808的以太网该怎么弄,只介绍了其它一些芯片,还有3.10版本内核遇到问题该怎么处理,而这个1808的SDK内核是4.4版本的
所以一个很简单的问题,花了一天时间
解决办法:
找到uboot和kernel下的dts文件,注意该芯片是64位(Arm Cortex-A35 是最高效的 Armv8-A 64-bit 处理器)
给出我的路径,仅供参考
W:rockchipRKSDKu-bootarcharmdtsrk1808.dtsi
W:rockchipRKSDKkernelarcharm64bootdtsrockchiprk1808.dtsi
找到gmac开头的节点,将末尾的disabled修改为okay
gmac: ethernet@ffdd0000 {
...
/* status = "disabled"; */
status = "okay";
...
}
以太网还有别的问题存在,以后再做补充
NFS
内核配置中,NFS默认是不打开的,这在产品生产阶段当然没有问题,但是作为调试来讲,想传输文件就老麻烦了
在内核中,进行以下配置
make menuconfig
File systems --->
Network File Systems --->
<*> NFS client support
<*> NFS client support for NFS version 2
<*> NFS client support for NFS version 3
NFS client support for the NFSv3 ACL protocol extension
<*> NFS client support for NFS version 4
Provide swap over NFS support
NFS client support for NFSv4.1
NFS client support for NFSv4.2
(kernel.org) NFSv4.1 Implementation ID Domain
NFSv4.1 client support for migration
Root file system on NFS
[ ] Use the legacy NFS DNS resolver
< > NFS server support
[ ] RPC: Enable dprintk debugging
< > Ceph distributed file system
< > CIFS support (advanced network filesystem, SMBFS successor)
< > NCP file system support (to mount NetWare volumes)
< > Coda file system support (advanced network fs)
< > Andrew File System support (AFS)
Networking support --->
Networking options --->
IP: kernel level autoconfiguration
IP: DHCP support
IP: BOOTP support
[ ] IP: RARP support
编译内核的时候,可以选择用build.sh kernel,也可以自己make,当然得加一些参数
这里选择不修改默认的配置文件,自己使用make手动编译,只需要指定设备树和线程数即可
sudo make ARCH=arm64 rk1808-evb-v10.img -j8
网络测试工具iperf
板子上自带的iperf版本是(iperf version 2.0.10 (11 Aug 2017) pthreads)
我用这个工具主要是为了测试udp传输的丢包率,但是在实际测试的过程中,发现数据有问题,明显是溢出了
[ 3] local 192.168.10.101 port 5001 connected with 192.168.10.113 port 33501
[ 3] 0.0- 1.0 sec 12.5 MBytes 105 Mbits/sec 0.038 ms 0/ 8923 (0%)
[ 3] 1.0- 2.0 sec 12.5 MBytes 105 Mbits/sec 0.068 ms 0/ 8918 (0%)
[ 3] 2.0- 3.0 sec 12.5 MBytes 105 Mbits/sec 0.058 ms 0/ 8917 (0%)
[ 3] 3.0- 4.0 sec 12.5 MBytes 105 Mbits/sec 0.056 ms 0/ 8917 (0%)
[ 3] 4.0- 5.0 sec 12.5 MBytes 105 Mbits/sec 0.065 ms 0/ 8916 (0%)
[ 3] 5.0- 6.0 sec 12.5 MBytes 105 Mbits/sec 0.045 ms 0/ 8918 (0%)
[ 3] 6.0- 7.0 sec 12.5 MBytes 105 Mbits/sec 0.046 ms 0/ 8917 (0%)
[ 3] 7.0- 8.0 sec 12.5 MBytes 105 Mbits/sec 0.071 ms 0/ 8916 (0%)
[ 3] 8.0- 9.0 sec 12.5 MBytes 105 Mbits/sec 0.058 ms 0/ 8916 (0%)
[ 3] 0.0-10.0 sec 125 MBytes 105 Mbits/sec 0.046 ms 2147305320/2147394484 (1e+02%)
为了解决这个问题,到官网去下载了源码,版本选择的是较老的2.0.5(主要为了与主机ubuntu14.04-64bit的iperf版本对应)
https://iperf.fr/iperf-download.php
解压后,先进行配置,我的配置很长,主要是环境变量中指定的编译链是海思的,这回又来一个瑞星微的,我不想每次都去改环境变量,所以每次编译瑞星微的芯片都用绝对路径指定工具链,按照这个指定好CC和CXX,然后指定好安装路径prefix(编译完成后,make install的安装路径),注意这个配置是在一行内
sudo ./configure --host=arm CC=/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc CXX=/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ --prefix=/home/glx/share/rockchip/iperf-2.0.5/install
然后进行编译
sudo make
这其中有2个报错需要解决
/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/6.3.1/cstdlib:146:11: error: ‘::malloc’ has not been declared
using ::malloc;
/home/glx/share/rockchip/RKSDK/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/6.3.1/bits/cpp_type_traits.h:205:12: error: redefinition of ‘struct std::__is_integer’
struct __is_integer
。。。
struct __is_integer
主要是说malloc缺少声明,然后就是int和bool的重复定义
很好解决,修改一下配置生成的config.h文件即可,将以下两句话注释掉
//#define bool int
//#define malloc rpl_malloc
最后sudo make&sudo make install即可,最后使用nfs或者tftp将生成的文件传到目标板上,注意生成了两个目录bin和share,只需要拷贝bin目录下的可执行文件即可,将这个可执行文件,想办法去覆盖/usr/bin/iperf
测试时
找一个服务器执行 iperf -s -u -i 1
目标板执行 iperf -c 192.168.10.101 -u -b 100M
目标板打印信息:
[root@rk1808:/mnt/glx]# ./iperf -c 192.168.10.101 -u -b 100M
------------------------------------------------------------
Client connecting to 192.168.10.101, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.10.113 port 55651 connected with 192.168.10.101 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec
[ 3] Sent 84970 datagrams
[ 3] Server Report:
[ 3] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec 0.043 ms 0/84969 (0%)
[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
服务器打印信息:
[ 4] local 192.168.10.101 port 5001 connected with 192.168.10.113 port 55651
[ 4] 0.0- 1.0 sec 12.0 MBytes 101 Mbits/sec 0.106 ms 0/ 8546 (0%)
[ 4] 1.0- 2.0 sec 12.0 MBytes 100 Mbits/sec 0.041 ms 0/ 8540 (0%)
[ 4] 2.0- 3.0 sec 11.9 MBytes 99.5 Mbits/sec 0.073 ms 0/ 8465 (0%)
[ 4] 3.0- 4.0 sec 11.9 MBytes 99.5 Mbits/sec 0.049 ms 0/ 8464 (0%)
[ 4] 4.0- 5.0 sec 11.9 MBytes 99.5 Mbits/sec 0.046 ms 0/ 8458 (0%)
[ 4] 5.0- 6.0 sec 11.9 MBytes 99.6 Mbits/sec 0.052 ms 0/ 8467 (0%)
[ 4] 6.0- 7.0 sec 11.9 MBytes 100 Mbits/sec 0.051 ms 0/ 8507 (0%)
[ 4] 7.0- 8.0 sec 12.0 MBytes 100 Mbits/sec 0.041 ms 0/ 8539 (0%)
[ 4] 8.0- 9.0 sec 11.9 MBytes 100 Mbits/sec 0.079 ms 0/ 8518 (0%)
[ 4] 0.0-10.0 sec 119 MBytes 99.9 Mbits/sec 0.044 ms 0/84969 (0%)
[ 4] 0.0-10.0 sec 1 datagrams received out-of-order
显示已经正常,而且我的网络看起来还不错,udp传输没有丢包
举报