This article provides insight into the partition layout of the ISP image file, ISPBOOOT.BIN, tailored for SP7350. The ISP (In-System Program) file plays a pivotal role as it houses essential images enabling SP7350 to initialize and write data to flash devices, including eMMC device, SPI-NAND flash, 8-bit NAND flash, and SPI-NOR flash.
When the SP7350 powers on, its internal ROM code initiates a search for the ISPBOOOT.BIN file. The search location is the root directory of the first or solo partition on the selected boot devices, with options including an SD card or a USB flash drive. Once found, the file is loaded, extracting the first-stage boot loader, X-Boot, and storing it in the internal SRAM.
The X-Boot image, situated at offset 0 within ISPBOOOT.BIN, has a maximum size of 192 KiB, with the actual size recorded in the X-Boot image header. Upon successful checksum verification, the system transitions to execute X-Boot.
X-Boot initializes and trains the SDRAM controller, preparing the DRAM for use. Subsequently, it loads the TF-A (Trusted Firmware-A) and OP-TEE (Open Portable Trusted Execution Environment) images from the fip (firmware image package) partition within ISPBOOOT.BIN, storing them in DRAM. Additionally, the U-Boot image is extracted from offset 0x30000 of ISPBOOOT.BIN and stored in DRAM. Upon successful checksum verification for all images, the system proceeds to execute TF-A, followed by OP-TEE, and finally U-Boot.
U-Boot autonomously executes scripts to program the flash devices.
The partition layout of ISPBOOOT.BIN is illustrated below, commencing with the X-Boot image (partition name: xboot0), followed by the U-Boot image (partition name: uboot0), and a header detailing the subsequent partitions.
Note actual size is the file size aligned to 1k boundary.
The following table explains details of each partition.
Partitions | Offset | Size | Descriptions |
---|---|---|---|
xboot0 | 0 | 192 kB | Image of X-Boot, including training firmware of DDR |
uboot0 | 0x30000 | 1344 kB | Image of U-Boot |
file_header | 0x180000 | 16 kB | Header for the following partitions |
xboot | 0x184000 | actual size | Image of X-boot, including training firmware of DDR |
uboot1 | - | actual size | Image of U-Boot (the factory default) |
uboot2 | - | actual size | Image of U-Boot (the latest update) |
fip | - | actual size | Image of fip, including TF-A and OP-TEE |
env | - | actual size | Image of environment variables of U-Boot |
env_redund | - | actual size | Image of environment variables of U-Boot (redundant) |
dtb | - | actual size | Image of device-tree blob (not used) |
kernel | - | actual size | Image of Linux kernel with U-Boot header |
rootfs | - | actual size | Image of root file-system |
isp_script_nand | - | actual size | Script of U-Boot for NAND flash in-system program |
isp_script_emmc | - | actual size | Script of U-Boot for eMMC in-system program |
If ISPBOOOT.BIN is for programming SPI-NOR flash, isp_script_nand partition will be replaced with isp_script_nor partition, no isp_script_emmc partition.
Refer to the code below for the definition of partition_info in the file_header.
#define SIZE_FILE_NAME (32) struct partition_info_s { u08 file_name[SIZE_FILE_NAME]; // file name of source (basename only) u08 md5sum[36]; u32 file_offset; // offset in output file u64 file_size; // file size of the partition u32 partition_start_addr; // partition's start address in NAND, there will be an offset added in U-Boot script ($isp_nand_addr_1st_part), less than 4GB is expected. u64 partition_size; // reserved size for this partition, less than 4GB is expected. u32 flags; u32 emmc_partition_start; // Unit: block u32 reserved[7]; // let size of this structure == SIZE_PARTITION_INFO_S } __attribute__((packed));
Refer to the code below for the definition of file_header.
#define SIZE_PARTITION_INFO_S (128) #define SIZE_INIT_SCRIPT (2048) #define NUM_OF_PARTITION (111) struct file_header_s { u08 signature[32]; u08 init_script[SIZE_INIT_SCRIPT]; u32 flags; u08 reserved[SIZE_PARTITION_INFO_S - 36]; struct partition_info_s partition_info[NUM_OF_PARTITION]; } __attribute__((packed)); // sizeof(this structure) == 16384
The signature string is “Pentagram_ISP_image".