2. Burn-in Procudure

2.1. Preparations Before Use

  1. For details, see 《CV181x Linux Development Environment User Guide》[1.2 How to Compile BSP]. Compile the following files:

fip.bin - bootloader + uboot
boot.spinand - Linux image
logo.jpg - boot logo (Optional)
rootfs.spinand  - root file system
system.spinand - system partition (Optional)
cfg.spinand - encrypted ISP PQ partition (Optional)

fip.bin is obatained from the install/<board name> directory:

$ ls -al  install/soc_cv1820_wevb_0005b_spinand
_images/1.png

*.spinand is obtained from install/<board name>/rawimages:

$ ls -al  install/soc_cv1820_wevb_0005b_spinand/rawimages
_images/2.png

Attention

Note: *.spinand in the rawimages subdirectory is the raw images used by the burner. The *.spinand in the directory on the upper level is a special format for the CVITEK SD card/USB update tool, and an additional 128 bytes header is added based on the bare image.

  1. Enter the build/tools/common/spinand_tool/fip_maker, perform

make clean; make
  1. Copy fip.bin to the directory. Run./fip_maker {pagesize} {DID/MID} {input_path} {output_path}, where {pagesize} and {DID/MID} parameter values refer to spi nand particle datasheet settings.

Example:
    ./fip_maker 2048 0x71e5 ./fip.bin ./fip_out.bin
  1. If there is no error, fip_out.bin will be generated. This fip_out.bin is the fip.bin file required for pre-burning.

After preparing the binary file through the above three steps, the burner can be pre-burned.

2.2. Partition Table

The Flash partition table of the CVITEK solution is defined in xml format. For details, see the《Flash Partition Tool Usage Guide》.

Flash partition is defined in XML format. We use boards/default/partition/partition_spinand_page_2k. XML as an example:

<physical_partition type="spinand">
    <partition label="fip" size_in_kb="2560" file="fip.bin"/>
    <partition label="BOOT" size_in_kb="8192" file="boot.spinand"/>
    <partition label="MISC" size_in_kb="384" file="logo.jpg" />
    <partition label="ENV" size_in_kb="128" file="" />
    <partition label="ROOTFS" size_in_kb="71680" file="rootfs.spinand" />
    <partition label="SYSTEM" size_in_kb="20480" file="system.spinand" mountpoint="" type="ubifs" />
    <partition label="CFG" size_in_kb="4096" file="cfg.spinand" mountpoint="/mnt/cfg" type="ubifs" />
    <partition label="DATA" file="" mountpoint="/mnt/data" type="ubifs" />
</physical_partition>

Take NAND flash with 2KB page size 128KB blocksize as an example: Based on the data in the xml file, the size of each partition is converted into the size of the block (formula: Number of blocks = partition size/single blocksize), as shown below:

Partition

Start block offset

Number of blocks

Binary files

FIP

0

20

fip.bin

BOOT

24

64

boot.spinand

MISC

Sequential (skip bad blocks))

3

logo.jpg

ENV

Sequential (skip bad blocks)

1

Null

ENV_BAK

Sequential (skip bad blocks)

1

Null

ROOTFS

Sequential (skip bad blocks)

560

rootfs.spinand

SYSTEM

Sequential (skip bad blocks)

160

system.spinand

CFG

Sequential (skip bad blocks)

32

cfg.spinand

DATA

Sequential (skip bad blocks)

Don’t Care

Null

2.3. Burning Rule

2.3.1. FIP Partition

The FIP partition consists of two parts: one is the processor-related Bootloader (no open source), and the other is u-boot.

The CVITEK compilation process will automatically package the two into a fip.bin. fip.bin is from block 0 to 19 according to Select a block according to the sequence, and write two copies in total.

The first copy will be written in block 0~9, and the second copy will be written in block 10~19, which are mutual backup.

Burning fip.bin itself into spinand will probably use 3~4 blocks. However, due to the characteristics of spinand, blocks may be damaged, so the remaining unused blocks are reserved for the repair mechanism.

To illustrate with an example, fip.bin is 640KB, and the block size is 128KB, so 5 blocks are needed to write a fip.bin:

Example 1:

If there are no bad blocks, burn the first fip.bin to block 0, 1, 2, 3, 4; burn the second fip.bin to block 9, 10, 11, 12, 13.

Example 2:

If block 4 and 11 are both bad blocks, please burn the first fip.bin to block 0, 1, 2, 3, 5; and burn the second fip.bin to block 9, 10, 12, 13, 14 .

2.3.2. Other Partition

According to the configuration of the partition table, burn in order, skip the bad block, skip to the next good block and then burn.