Edit online

参数配置

Read time: 4 minute(s)

遵照以下流程,配置 Luban-Lite OTA 方案。

配置 BootLoader

  1. 在 SDK 根目录下执行下列命令之一,进入 BootLoader 的配置界面:
    • bm 命令

    • scons –apply-def=dxxx_xxx-nor_baremetal_bootloaderscons –menuconfig

  2. 配置 aic-env 参数。
    Local packages options  --->
        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
                [ ]     Enable ENV debug
                [*]   Enable A/B system support in bootloader
    

配置 OS

  1. 在 SDK 根目录下执行下列命令之一,进入 OS 的配置界面:
    • me 命令

    • scons –apply-def=dxxx_xxx-nor_rt-thread_helloworldscons –menuconfig

  2. 使能 aic-ota 配置,同时 aic-env 相关配置会自动使能 。
    Local packages options  --->
        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
                [ ]     Enable ENV debug
            [*] aic-ota --->
                [ ]   Enable OTA downloader debug
                [*]   Enable OTA interface
  3. 如需测试网络 OTA,需要按照如下配置打开网络 OTA,否则可跳过。
    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 HTTP/HTTPS OTA
                    (http://192.168.31.22/ota.cpio) HTTP OTA Download default URL
                [ ]   Enable Ymodem OTA
    注: 为了方便配置,使能 LPKG_USING_HTTP_OTA 后,会自动选上 AIC_ENV_INTERFACE 和 AIC_OTA_INTERFACE。
  4. 如需测试 Ymodem OTA ,按照如下配置打开 Ymodem OTA:
    Local packages options  --->
        Third-party packages options  --->
            [*] ota_downloader: The firmware downloader which using on RT-Thread OTA component  --->
                [*]   Enable Ymodem OTA
  5. 保存配置后退出。
  6. 根据 OTA 升级包制作原理中的配置说明,更新 ota-subimgs.cfg 文件。
  7. 如有需要,可裁剪分区

裁剪分区

裁剪分区是指通过修改 image_cfg.json 文件进行分区调整。

根据实际 OTA 需求裁剪分区,例如只需升级 OS,则可以删除 RODATA 与 DATA 的备份分区。
"spi-nand": { // Device, The name should be the same with string in image:info:media:type
    "size": "128m", // Size of SPI NAND
    "partitions": {
        "spl":      { "size": "1m" },
        "env":      { "size": "256k" },
        "env_r":    { "size": "256k" },
        "os":       { "size": "4m" },
        "os_r":     { "size": "4m" },
        "rodata":   { "size": "12m" },
        "rodata_r": { "size": "12m" },
        "data": {
            "size": "40m",
            "nftl": { // Volume in NFTL device
                "data": { "size": "-" },
            },
        },
        "data_r": {
            "size": "40m",
            "nftl": { // Volume in NFTL device
                "data": { "size": "-" },
            },
        },
    },
},
注:
  1. 各分区的大小总和不能超过总的 FLASH 大小。

  2. _r 的分区为备份分区,即 B 分区。若不需要升级 B 分区,可将对应 _r 分区删除。

  3. ota-subimgs.cfg 中对应文件不应该被打包,需整行删除。

1. 剪裁 OTA 分区对照表

名称

image_cfg.json 分区名称

ota-subimgs.cfg 打包文件名称

系统

os_r

[file]dxx_os.itb:os;

只读文件系统

rodata_r

[file]rodata.fatfs:rodata;

读写文件系统

data_r

[file]data.fatfs:blk_data;