This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Firmware Format

Firmware can be divided into a single .img file and a .fls file composed of multiple .img files:

  • .img file is the smallest burning unit, and a .img file can be burned to a certain address in flash.

  • .fls is a complete firmware package composed of multiple .img files, and the order of .img files is not required.

.img File Format

An image is composed of three parts: Header, Body, and Digital Signature (as shown in the figure).

Figure 3

Image Header

The W800 Image Header contains information such as the magic number, image attributes, image start address, image length, image header location, image upgrade address, image CRC check, image decryption information, digital signature, and compression information.

Figure 3-1

Description of Each Image Header Field

Field

Description

magic_no

Magic number, fixed value 0xA0FFFF9F

img_attr

Image attribute type, IMAGE Attribute

img_addr

Image running position in flash

img_len

Length of the image area in bytes

img_header_addr

Position of the IMAGE header in flash

upgrade_img_addr

Upgrade area address, storage location of the upgrade IMAGE header in flash

org_checksum

CRC32 result of the image body

upd_no

Upgrade version number, larger value indicates a newer version; when the version number is 0xFFFFFFFF, any version of firmware can be upgraded

ver

Image version number, string

next

Position of the next image header in flash (optional)

hd_checksum

CRC32 value of the above fields in the image header

Image Attribute

Field

Bit

Description

img_type

4

0x0: SECBOOT; 0x1: User Image; 0xE: test program; other values: user-defined

code_encrypt

1

0: Firmware stored in plaintext; 1: Firmware stored encrypted by the customer

pricey_sel

3

The chip has 8 sets of built-in RSA private keys for decrypting the encrypted firmware key, users can choose any set to use, the range is 0~7

signature

1

0: IMAGE does not contain a signature; 1: IMAGE contains a 128-byte signature

zip_type

1

0: Not compressed; 1: image area is compressed: currently only GZIP is supported

reserved

1

Reserved

erase_block_en

1

0: Does not support 64KB block erase; 1: Supports block erase

erase_always

1

0: Check if the flash is all F before sector or block erase, sectors or blocks that are all F are not erased; 1: Always erase before writing

Image Body

Encrypted

Compressed

Image Body Content

Purpose

X

X

Original image content

SECBOOT, User Image

X

Compressed original image content

User Image

X

Encrypted original image content + encryption information

SECBOOT

Compressed and encrypted original image content + encryption information

User Image

Digital Signature

If the signature attribute in the image header is set, it means that the firmware contains a digital signature.

The digital signature is for the file composed of the image header and image body.

.fls File Format

Figure 5-1

The SOC distinguishes the current burning location based on the header.