image layout guide - XradioTech/XR871-OLD GitHub Wiki


Content


XR871 Image Layout V1.0

image_layout_v1.0

XR871 Image Layout V2.0

image_layout_v2.0

XR871 Image Layout Elements

  • Bootloader
    Bootloader is used to load the app.bin of image0 or image1 into ram and execute the entry handler of application. During OTA update, Bootloader will not be updated. Bootloader用于将image0或image1的app.bin加载到ram中,并执行应用程序的入口处理程序。OTA升级过程中,Bootloader不会更新

  • Image0
    Image0 is a firmware package that includes applications, network and some other related binary files. Its start address is the end of Bootloader,default is 32K. Image0是一个固件包,其中包括应用系统,网络系统和其他相关二进制文件。其起始位置位于bootloader区域结束处,默认为32K。

  • SysInfo Area
    Sysinfo is a data structure that contains information such as the WLAN MAC address and is stored in the Sysinfo area on flash.
    sysinfo是一个数据结构,包含了诸如WLAN MAC地址之类的信息,并存储在flash上的sysinfo区域

    • The start address of the Sysinfo area is defined in prj_config.h of every project direct.The structure of sysinfo is defined in sysinfo.h
      Sysinfo区域的起始地址定义在每一个工程目录下的prj_config.h文件中。sysinfo的数据结构定义在sysinfo.h
    • Sysinfo stores data by using FDCM.The detaile and usage of FDCM can be found in 《XR871_FDCM_Developer_Guide-CN.pdf》 Sysinfo是基于FDCM实现的,FDCM的具体原理和使用方法可参考《XR871_FDCM_Developer_Guide-CN.pdf》。
  • OTA Area
    The OTA area is used to store OTA configuration information and guides the bootloader to load the latest firmware.
    OTA区域用来存储OTA配置信息,并引导Bootloader加载最新的固件文件。

    • The start address and size of the ota area are defined in image.cfg
      OTA区域的起始地址以及大小都在image.cfg中定义
    {
      "magic"   :"AWIH",
      "version" :"0.3",
      "OTA"     :{"addr": "1024K", "size": "32K"},
      "count"   :7,
      "section" :[
      	{"id": "0xa5ff5a00", "bin" :"boot.bin",	...},
       ......
    
    
  • Image1
    The Image1 is a firmware backup area for storing the firmware burned during OTA upgrade.Its start address is the end of OTA area.The Image0 and Image1 areas will be used alternately during the OTA upgrade. After the OTA upgrade is successful, the OTA configuration in OTA Area will be updated.
    Image1是一个固件备份区,用于存储OTA升级期间刻录的固件。其起始位置位于OTA区域的结束处。Image0和Image1区域在OTA升级时会交替使用,互做备份,升级成功后,OTA Area中的配置信息将同步更新。

XR871 Image Configuration File

  • File Content
  • magic - magic number, AWIH
  • version - version number of image.cfg
  • OTA - OTA Area start address and size definition
  • count - the number of image sections
  • section - the image detail infomation sections
    • id - the image id defined in include/sys/image.h
    • bin - the name of binary file
    • cert - the name of signed binary files with certificates, which is only used for secure boot.
    • flash_offs - the starting address of the binary file stored in FLASH, uint in KB.
    • sram_offs - the starting address of the binary file loaded in SRAM, uint in Byte.
    • ep - the entry point
    • attr - the attribute of this binary file
      • 0x00000001 - for normal file
      • 0x00000002 - for XIP file
      • 0x00000011 - for compressed file

image.cfg

  • Flash Offset Configuration Boot.bin is fixed to 0 address, app.bin is fixed to the start address of image0 area(default is 32KB). The other bin files are not fixed to any address.It will be just all right that the files are not overlapped. Boot.bin固定需要设置为0地址,app.bin固定需要设置为image0 area的起始地址(一般默认为32KB),其他bin文件的地址并没有强制性的要求,只要没有互相重叠并且不超过image area范围就可以。

  • Bin overlapp If the bin files are overlapped, mkimage tool will generate an “image_auto_cal.cfg” file(default in /image/xr871/) after calculation.User can use it instead of the old one.Please pay attention if the whole size of bin files is bigger than start address of OTA area.In that case, mkimage tool will not generat the “image_auto_cal.cfg” file, and user need to fix image layout by itself. 如果bin文件出现了互相重叠的情况,打包工具会进行自动计算,然后生成一个“image_auto_cal.cfg”文件(默认位置在工程目录/image/xr871/下),用户可以直接使用该cfg文件重新进行打包。需要注意的是,如果全部的bin文件在经过自动计算后,其大小依然超过OTA area的起始地址,则不会生成“image_auto_cal.cfg”文件。此时,用户重新规划flash布局,并手动进行cfg文件的修改。

image-overlapped

  • Set User cfg File The project default uses one cfg file in /appos/project/image_cfg/xr871/.If user want to use its own cfg file, just add the path of user own cfg file in /gcc/Makefile of using project. 项目工程在默认时使用的cfg文件是/appos/project/image_cfg/xr871/路径下的某个cfg文件,如果用户想要使用自己修改的cfg文件,可以在对应的项目工程目下的/gcc/Makefile中添加自定义cfg路径。

set-user-cfg-file

XR871 Image Relationship

image_relation

XR871 Image Reference Documents