NewSTO NAND Flash BBT Specification
1. Location
Then whole NAND is partitioned as below table.
Block | Offset | Description | Size | |
Dec | Hex | |||
0 | 0x0000000 | RESERVED for NAND booting | 128K | 0x20000 |
1 | 0x0020000 | RESERVED for NAND booting | 128K | 0x20000 |
2 | 0x0040000 | RESERVED for NAND booting | 128K | 0x20000 |
3 | 0x0060000 | RESERVED for NAND booting | 128K | 0x20000 |
4 - 29 | 0x0080000 | BOOTLOADER secured area | 3.2M | 0x340000 |
30 - 53 | 0x03C0000 | BOOT DATA secured area | 3M | 0x300000 |
54 - 75 | 0x06C0000 | RAW DATA secured area | 2.8M | 0x2C0000 |
76 - 111 | 0x0980000 | File system containing Linux Kernel and static file system in one single file | 4.5M | 0x480000 |
112 - 249 | 0x0E00000 | Root file system | 17.25M | 0x1140000 |
250 - 537 | 0x1F40000 | Runtime File system | 36M | 0x2400000 |
538 - 999 | 0x4340000 | User data File system | 57.75M | 0x39C0000 |
1000 - 1023 | 0x7D00000 | Bad block table | 3M | 0x300000 |
The BBT is aligned withlinux BBT specification.
Block 1000~1023 is reservedfor storing BBT. The BBT is stored in last block of NAND chip. There are twoBBTs in total: one primary BBT and one mirror BBT.
Usually primary BBT isstored in block 1023. Mirror BBT is stored in block 1022. If block 1023 or 1022is bad, BBT should be stored in 1021,1020, etc. Generally speaking, find good blocks inreverse order from 1023 to 1000.
2. Structure
Every block consumes 2 bitsto indicate whether it is bad.
Good Block | 2’b11 |
Bad Block | 2’b10 |
All the 1024 blocks need a256 bytes table in total. Every BBT has identificationand a version number in corresponding OOB area.
The identification is storedin byte 8~11 area of oob area. The version number is stored in byte 12 of oobarea.
Their identification isshown as below table.
Primary BBT | Bbt0 |
Mirror BBT | 1tbB |
The version number is increased1 by nand flash driver after every update. For initial creation please set thisversion number to 1.
3. Example
Suppose all nand blocks are good except block 1. The first byte of BBT should be 0xfb. That is11111011 in binarary code. Indicate block 1 is bad.
The content of BBTdata area
Primary BBT’s oobarea
Mirror BBT’s oob area
4. ECC consideration
For imagine hardware ECC is enabled in NAND driver. So offline nand write should adopt the sameecc checksum algorithm as driver does. The ecc’s layout of NAND is shown asbelow. Note that only offset 8, 24, 40, 56 are valid.