1.0 OTA相关配置
首先确保网络相关配置都已正常没有问题,接下来进行OTA相关配置。
1.1 在 Luban-Lite 根目录下执行 scons --menuconfig
,进入menuconfig的功能配置界面,按如下选择:
Local packages options ---> Third-party packages options ---> -*- WebClient: A HTTP/HTTPS Client for RT-Thread ---> [*] ota_downloader: The firmware downloader which using on RT-Thread OTA component ---> [ ] Enable OTA downloader debug [*] Enable HTTP/HTTPS OTA (http://192.168.31.22/ota.cpio) HTTP OTA Download default URL ArtInChip packages options ---> [*] aic-env ---> -*- Enable ENV interface and CMD [*] Enable redundant environment support (env) Env part name (env_r) Env redundant part name (4096) Environment Size
1.2 Boot 配置¶
使能 ENV 相关配置
在 Luban-Lite 根目录下执行 scons --menuconfig
,进入menuconfig的功能配置界面,按如下选择:
Local packages options ---> ArtInChip packages options ---> [*] aic-env ---> [*] Enable ENV interface and CMD [*] Enable redundant environment support [*] Enable ENV interface and CMD [ ] Enable ENV debug [*] Enable A/B system support in bootloader
配置完成后进行编译,生成相应文件。
2.0 使用nginx在Windows上搭建HTTP服务器
-
从官网下载 NGINX 软件包,地址:nginx: download
-
将下载的软件包进行解压,注意解压包的路径不能包含中文字符
- 在”CMD” 环境下,使用 start nginx 指令启动NGINX服务,服务启动成功后,在任务管理器中会有两个”nginx”进程,并测试服务器是否工作正常(可以使用tasklist /fi "imagename eq nginx.exe"查看是否正常启动,正常会显示两个exe任务,不正常则查看error.log文件的报错,一般为端口占用错误,更改使用的端口即可)
-
适配 nginx.conf 文件配置,使用指令 nginx -s reload 重新加载配置,开放服务器目录。(配置文件地址:nginx-1.24.0\conf)
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80; #使用的端口,占用可更改为其它端口
server_name 192.168.x.xxx; #改为自己PC的IP地址
root D:/share; #开放资源文件夹
#charset koi8-r;
charset utf-8;
#access_log logs/host.access.log main;
location / {
allow all;
autoindex on;
autoindex_exact_size on; # output file sizes rounded to kilobytes, megabytes, and gigabytes
autoindex_localtime on; # output local times in the directory
}
}
将提供下载的文件移入对应文件夹,在浏览器中输入本机ip地址即可查看可供下载的文件
3.0 就行OTA程序升级
将程序下载到板子上,确保连接上网络,可以使用ping命令进行测试。网络连接正常则可使用以下命令进行程序升级
http_ota
程序升级完成后将自动完成重启,此时程序切换到另一系统区域进行启动。
以下为遇到的下载问题,于OTA无关
下载是出现报错,提示有很多坏块
输入命令查看是否存在溢出,通过打印信息判断并未发生溢出
mtd list
使用命令擦除全块,再次进行下载,程序成功下载
mtd erase 需要擦除的存储器 需要擦除的起始地址 需要擦除的结束地址