10.4.4. 测试指南¶
10.4.4.1. 测试环境¶
10.4.4.1.1. 硬件¶
开发板
网线
10.4.4.1.2. 软件¶
PC端的串口终端软件,用于PC和开发板进行串口通信
HTTP服务器
10.4.4.1.3. 搭建HTTP服务器¶
推荐使用 NGINX 工具在 Windows 上搭建HTTP服务器
10.4.4.1.3.1. 搭建过程¶
从官网下载 NGINX 软件包,地址:https://nginx.org/en/download.html
将下载的软件包进行解压,注意解压包的路径不能包含中文字符
在”CMD” 环境下,启动NGINX服务,服务启动成功后,在任务管理器中会有两个”nginx”进程,并测试服务器是否工作正常
适配 nginx.conf 文件配置,重新加载配置,开放服务器目录
HTTP 服务器窗口如下所示:

10.4.4.1.4. 编译和烧录¶
配置完成后,保存退出,编译,烧录
编译过程中可以看到 OTA 包打包信息,如下所示:
make CPIO image begin...
os.aic
data.fatfs
2961 blocks
make CPIO image done...
注解
上述 OTA 包包含了 os.aic,data.fatfs两个文件
10.4.4.1.5. 上传 OTA 升级包到服务器目录¶
OTA 升级包文件名称是 ota.cpio,执行命令 co 进入到 images 目录下可以看到该文件
将 ota.cpio 拷贝到 NGINX 服务器目录
10.4.4.2. 验证¶
10.4.4.2.1. 准备工作¶
烧录完成后,断开电源,上电,插入网线
10.4.4.2.1.1. 查看启动打印信息¶
ai:
IPv4 Address : 192.168.31.200
Default Gateway: 192.168.31.1
Subnet mask : 255.255.255.0
MAC addr : 00:22:44:88:77:66
[I] aicphy_poll_thread()635 Port 0 link UP! autoneg mode: speed 100M, full duplex, flow control off.
10.4.4.2.1.2. 测试网络连通状态¶
aic/> ping 192.168.31.22
aic/> Reply from 192.168.31.22: time=2ms
注解
ping 通网络,需要等待一段时间
10.4.4.2.1.3. 查看 OTA 升级命令¶
执行 help 命令查看 OTA 升级命令如下:
...
http_ota - Use HTTP to download the firmware
...
10.4.4.2.2. 启动 OTA 升级¶
执行命令 http_ota
或者 http_ota http://192.168.31.22/ota.cpio
以下是相关升级信息
aic/> http_ota
using uri: http://192.168.31.22/ota.cpio
01-01 08:08:48 I/NO_TAG: OTA file size is (1517056)
01-01 08:08:48 I/NO_TAG: find file os.aic cpio data success
01-01 08:08:48 I/NO_TAG: Start erase flash (os_r) partition!
01-01 08:08:50 I/NO_TAG: Erase flash (os_r) partition success! len = 524288
01-01 08:08:50 I/NO_TAG: Start upgrade os.aic!
01-01 08:08:50 I/NO_TAG: Download: [=>
01-01 08:08:50 I/NO_TAG: Download: [==>
01-01 08:08:50 I/NO_TAG: Download: [===>
......
01-01 08:08:52 I/NO_TAG: Sum check success!
01-01 08:08:52 I/NO_TAG: download os.aic success!
01-01 08:08:52 I/NO_TAG: find file data.fatfs cpio data success
01-01 08:08:52 I/NO_TAG: Start erase flash (rodata_r) partition!
01-01 08:08:59 I/NO_TAG: Erase flash (rodata_r) partition success! len = 2097152
01-01 08:08:59 I/NO_TAG: Start upgrade data.fatfs!
01-01 08:08:59 I/NO_TAG: Download: [>
01-01 08:08:59 I/NO_TAG: Download: [=>
01-01 08:08:59 I/NO_TAG: Download: [==>
......
01-01 08:09:05 I/NO_TAG: Sum check success!
01-01 08:09:05 I/NO_TAG: download data.fatfs success!
01-01 08:09:05 I/NO_TAG: find file TRAILER!!! cpio data success
01-01 08:09:05 I/NO_TAG:
01-01 08:09:05 I/NO_TAG: Download firmware to flash success.
01-01 08:09:05 I/NO_TAG: System now will restart...
注解
升级完成以后,自动重启,加载新代码启动
10.4.4.2.3. 升级判断¶
从程序打印log差异和文件系统中文件差异判断当前运行的版本
10.4.4.2.3.1. Boot 相关打印信息¶
Start-up from os/os_r
注解
os 表示从 os 分区读取数据启动 RTT 程序。
os_r 表示从 os_r 分区读取数据启动 RTT 程序。
10.4.4.2.3.2. RTT 相关打印信息如下¶
[I] aic_ota_set_status()170 OTA Upgrade success // OTA 升级成功打印信息
Mount APP in blk blk_rodata // 表示挂载块设备名称为 blk_rodata