Image Layout
The purpose of this document is to provide an introduction to image layout, covering the following two aspects:
Flash Layout
Overview of the image layout in Flash, aiming to prevent misuse.
Steps on how to adjust the Flash Layout.
Image Data Layout
Introduce parts in images.
Flash Layout
In order to use the flash more conveniently and prevent misuse, Flash Layout is introduced.
RTL87x3E Flash Layout
Images can be divided into two categories: High Level Images and BANK Images.
RTL87x3E Flash Layout indicates the start address and max size of images in flash:
The configurations of the system config image(OEM HEADER) and BOOT PATCH are fixed in the ROM and can’t be changed.
The configurations of PLATFORM_EXT, LOWERSTACK_EXT and UPPERSTACK are recorded in BOOT PATCH and can’t be changed.
The OEM HEADER records the layout of high level images.
The OTA Header, fixed at the beginning of the BANKx area, defines the layout of images in the same BANKx.
High Level Images
The high level images of Flash Layout are shown in the following figure.
Note
The BKP DATAx sections are reserved.
After the flash map is modified, please make sure to regenerate the related images.
The Flash Layout of all images should not overlap, and the Flash Layout of the high level images should not overlap either. The Flash Layout size of the image should be larger than the image size. It is also suggested to be aligned by flash sector size (0x1000 bytes). If two images share one flash sector, they should download together, as the minimum flash erase size is the flash sector size.
Let’s take the 4M flash map as an example to show the description of the Flash Layout in the following map. Similarly, the other Flash Layouts can be described according to their corresponding flash_map.h
.
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
RSVD |
0x02000000 |
0x00002000 |
Reserved. |
OEM HEADER |
0x02002000 |
0x00002000 |
Stores configuration information, which includes Bluetooth Address and user defined Flash Layout. |
BOOT PATCH |
0x02004000 |
0x00002000 |
Flash boot loader. |
PLATFORM_EXT |
0x02006000 |
0x00008000 |
Stores Platform extension information. |
LOWERSTACK_EXT |
0x0200E000 |
0x00007000 |
Stores Bluetooth Controller extension information. |
UPPERSTACK |
0x02015000 |
0x0003F000 |
Stores Bluetooth Host information. |
BANK0 |
0x02054000 |
0x001AC000 |
Stores data and code running area, further subdivided into OTA Header, FSBL, Stack Patch, SYS Patch, APP, DSP SYS, DSP APP, DSP CFG, APP CFG, and EXT images. |
BANK1 |
0x02200000 |
0x001AC000 |
The same as BANK0, and the size of BANK1 must also be the same as BANK0. |
VP_DATA |
0x023AC000 |
0x00032000 |
Stores VP data. |
FTL |
0x023DE000 |
0x00015000 |
Supports accessing flash with a logical address. Users can read/write flash with a unit size of at least 4 bytes. |
BKP DATA1 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
BKP DATA2 |
0x023FE000 |
0x00002000 |
Optional to use. Stores any data. |
OTA_TMP_ADDR |
0x00000000 |
0x00000000 |
Optional to use. For OTA. |
BANK Images
For RTL87x3E, BANK0 can be subdivided into the following images:
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
OTA Header |
0x02054000 |
0x00000400 |
OTA version, start address, and size of each BANK. |
FSBL |
0x02054400 |
0x00001C00 |
Flash secure boot loader. |
Stack Patch |
0x02056000 |
0x0003D000 |
Stack optimization and extension code. |
SYS Patch |
0x02093000 |
0x0001D000 |
Optimized and expanded code for systems in non-secure ROM. |
APP |
0x020B0000 |
0x000DE000 |
Running code for development solutions. |
DSP SYS |
0x0218E000 |
0x00020000 |
DSP system information. |
DSP APP |
0x021AE000 |
0x00038000 |
DSP running code. |
DSP CFG Data |
0x021E6000 |
0x0000A000 |
DSP config information. |
APP CFG Data |
0x021F0000 |
0x00002000 |
APP config information. |
EXT_IMG0 |
0x021F2000 |
0x0000A000 |
Optional to use. Stores any data. |
EXT_IMG1 |
0x021FC000 |
0x00004000 |
Optional to use. Stores any data. |
EXT_IMG2 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
EXT_IMG3 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
RTL87x3EP Flash Layout
Images can be divided into two categories: High Level Images and BANK Images. RTL87x3EP Flash Layout indicates the start address and max size of images in flash:
The configurations of the OEM HEADER and BOOT PATCH are fixed in the ROM and can’t be changed.
The configurations of PLATFORM_EXT, LOWERSTACK_EXT, and UPPERSTACK are recorded in BOOT PATCH and can’t be changed.
The OEM HEADER records the layout of high level images.
The OTA Header, fixed at the beginning of the BANKx area, defines the layout of images in the same BANKx.
High Level Images
The high level images of the Flash Layout are shown in the following figure.
Note
The BKP DATAx sections are reserved.
The BOOT PATCH0 and the BOOT PATCH1 should exist at the same time. They could record the PLATFORM_EXT, LOWERSTACK_EXT, and UPPERSTACK info.
After the flash map is modified, please make sure to regenerate the related images.
The Flash Layout of all images should not overlap, and the Flash Layout of the high level images should not overlap either. The Flash Layout size of the image should be larger than the image size. It is also suggested to be aligned by flash sector size (0x1000 bytes). If two images share one flash sector, they should download together, as the minimum flash erase size is the flash sector size.
Let’s take the 4M flash map as an example to show the detailed description of the Flash Layout in the following figure.
Similarly, the other Flash Layouts can be described according to their corresponding flash_map.h
.
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
RSVD |
0x02000000 |
0x00002000 |
Reserved. |
OEM HEADER |
0x02002000 |
0x00002000 |
Stores configuration information which includes Bluetooth Address and user defined Flash Layout. |
BOOT PATCH0 |
0x02004000 |
0x00003000 |
Flash boot loader. |
BOOT PATCH1 |
0x02007000 |
0x00003000 |
Flash boot loader. |
PLATFORM_EXT |
0x0200A000 |
0x00008000 |
Stores Platform extension information. |
LOWERSTACK_EXT |
0x02012000 |
0x0000D000 |
Stores Bluetooth Controller extension information. |
UPPERSTACK |
0x0201F000 |
0x0003F000 |
Stores Bluetooth Host information. |
BANK0 |
0x0205E000 |
0x001AC000 |
Stores data and code running area, further subdivided into OTA Header, FSBL, Stack Patch, SYS Patch, APP, DSP SYS, DSP APP, DSP CFG, APP CFG, and EXT images. |
BANK1 |
0x0220A000 |
0x001AC000 |
The same as BANK0, and the size of BANK1 must also be the same as BANK0. |
VP_DATA |
0x023B6000 |
0x00032000 |
Stores VP data. |
FTL |
0x023E8000 |
0x00008000 |
Support accessing flash with logic address. User can read/write flash with unit size of 4 bytes at least. |
BKP DATA1 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
BKP DATA2 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
OTA_TMP_ADDR |
0x00000000 |
0x00000000 |
Optional to use. For OTA. |
BANK Images
For RTL87x3EP, BANK0 could be subdivided into the following images:
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
OTA Header |
0x02054000 |
0x00000400 |
OTA version, start address, and size of each BANK. |
Stack Patch |
0x02056000 |
0x0003D000 |
Stack optimization and extension code. |
SYS Patch |
0x02093000 |
0x0001D000 |
Optimized and expanded code for systems in non-secure ROM. |
APP |
0x020B0000 |
0x000DE000 |
Running code for development solutions. |
DSP SYS |
0x0218E000 |
0x00020000 |
DSP system information. |
DSP APP |
0x021AE000 |
0x00038000 |
DSP running code. |
DSP CFG Data |
0x021E6000 |
0x0000A000 |
DSP config information. |
APP CFG Data |
0x021F0000 |
0x00002000 |
APP config information. |
EXT_IMG0 |
0x021F2000 |
0x0000A000 |
Optional to use. Stores any data. |
EXT_IMG1 |
0x021FC000 |
0x00004000 |
Optional to use. Stores any data. |
EXT_IMG2 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
EXT_IMG3 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
RTL87x3D Flash Layout
Images can be divided into two categories: High Level Images and BANK Images.
RTL87x3D Flash Layout indicates the start address and max size of images in flash:
The configurations of the OEM HEADER and BOOT PATCH are fixed in ROM, which can’t be changed.
The OEM HEADER includes the layout of high level images (except images in BANKx). See High Level Images.
The OTA Header fixed at the beginning of the BANKx area defines the layout of images in the same BANKx.
High Level Images
The high level images of Flash Layout is shown in the following figure.
Note
The BKP_DATA sections are reserved.
After the flash map is modified, please make sure to regenerate the related images.
The Flash Layout of all images should not overlap, and the Flash Layout of the high level images should not overlap either. The Flash Layout size of the image should be larger than the image size. It is also suggested to be aligned by flash sector size (0x1000 bytes). If two images share one flash sector, they should download together, as the minimum flash erase size is flash sector size.
Let’s take the 16M flash map as an example to show the detailed description of the Flash Layout in the following figure.
Similarly, the other Flash Layout can be described according to its corresponding flash_map.h
.
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
RSVD |
0x02000000 |
0x00002000 |
Reserved. |
OEM HEADER |
0x02002000 |
0x00002000 |
Stores configuration information which includes Bluetooth Address and user-defined Flash Layout. |
BOOT PATCH |
0x02004000 |
0x00002000 |
Flash boot loader. |
BANK0 |
0x02006000 |
0x00600000 |
Stores data and code running area, further subdivided into OTA Header, FSBL, Stack Patch, SYS Patch, APP, DSP SYS, DSP APP, DSP CFG, APP CFG, and EXT images. |
BANK1 |
0x02606000 |
0x00600000 |
The same as BANK0, and the size of BANK1 must also be the same as BANK0. |
FTL |
0x02C06000 |
0x0000F000 |
Support accessing flash with logic address. User can read/write flash with unit size of 4 bytes at least. |
BKP DATA1 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
BKP DATA2 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
OTA_TMP_ADDR |
0x00000000 |
0x00000000 |
Optional to use. For OTA. |
BANK Images
For RTL87x3D, BANK0 could be subdivided into the following images:
Memory Segment |
Starting Address |
Size (Bytes) |
Functions |
---|---|---|---|
OTA Header |
0x02606000 |
0x00001000 |
OTA version, start address, and size of each BANK. |
FSBL |
0x02607000 |
0x00003000 |
Flash secure boot loader. |
ROM Patch |
0x0260A000 |
0x00018000 |
Optimized and expanded code for systems in non-secure ROM. |
Stack Patch |
0x02622000 |
0x00040000 |
Stack optimization and extension code. |
APP |
0x02662000 |
0x00160000 |
Running code for development solutions. |
DSP SYS |
0x027C2000 |
0x000B0000 |
DSP system information. |
DSP APP |
0x02872000 |
0x00060000 |
DSP running code. |
DSP CFG Data |
0x028D2000 |
0x00005000 |
DSP Config information. |
APP CFG Data |
0x028D7000 |
0x0001A000 |
APP Config information. |
EXT_IMG0 |
0x028F1000 |
0x0000A000 |
Optional to use. Stores any data. |
EXT_IMG1 |
0x028FB000 |
0x002F2000 |
Optional to use. Stores any data. |
EXT_IMG2 |
0x00000000 |
0x00000000 |
Optional to use. Stores any data. |
EXT_IMG3 |
0x02BED000 |
0x00019000 |
Optional to use. Stores any data. |
How to Configure Flash Layout
Flash Map Generator in the MPPG Tool is designed to generate flash_map.ini
and flash_map.h
, which determine the Flash Layout.
The flash_map.ini
will be used by MPPG Tool and MCUConfig Tool.
To generate the
flash_map.ini
by ‘Flash Map Generator’, open the MPPG Tool first.Configure the whole Flash Layout in the ‘High Level Type’ list and configure the layout for BANKx in the ‘OTA File Type’ list after selecting ‘Flash Size’ combo box. Multi-image Header size is provided in the ‘Image Header Size’ combo box. ‘Set BP Size to Front’ combo box determines which area of the flash the BP level protects. Notice that items which ‘write enable’ is selected ‘RW’ should be placed out of BP size. Import an existing
flash_map.ini
by clicking the ‘Import’ button and then modify the layout based on it. Lastly, click the ‘Generate’ button to generate a newflash_map.ini
.For RTL87x3E, the Flash Map Generator is as follows:
For RTL87x3EP, the Flash Map Generator is as follows:
For RTL87x3D, the Flash Map Generator is as follows:
Note
Please refer to the MPPG Tool Chain User Guide in the
tool\MPPGTool
directory for details.
Bring New Flash Layout into Effect
Users can adjust the Flash Layout in the flash_map.ini
and flash_map.h
through the ‘Flash Map Generator’ in the MPPG Tool under the ‘Tool’ menu. But there are some constraints for the Flash Layout adjustment.
The image address and size are suggested to be aligned by 0x1000 bytes for the minimum size for flash erase is flash sector size. If there are two images in one flash sector, these two images should be updated together.
Not all images’ layout can be adjusted.
Constraints and Restrictions Brief
Flash Layout for images can be adjusted under some constraints and restrictions according to the image types. Images can be categorized into the following types:
Images of fixed address
RTL87x3E: BOOT PATCH image, LOWERSTACK_EXT image, PLATFORM_EXT image, UPPERSTACK image.
RTL87x3EP: BOOT PATCH image, LOWERSTACK_EXT image, PLATFORM_EXT image, UPPERSTACK image.
RTL87x3D: BOOT PATCH image.
The flash address for these images can’t be changed.
Patch code images
RTL87x3E: FSBL image, SYS Patch image, Stack Patch image.
RTL87x3EP: SYS Patch image, Stack Patch image.
RTL87x3D: FSBL image, ROM Patch image, Stack Patch image.
When these images are released with position independent attribute, changing the Flash Layout for these images just needs to update the content of these images through the toolupdate_images_by_flash_map.exe
under the directory ofsdk\tool\Gadgets\update_images_by_flash_map
.
APP code image
APP image is compiled related with the APP flash address in the Flash Layout, and it should be recompiled with the new Flash Layout. The FTL is not an image, and if the FTL address or size is changed, APP image should be recompiled with the new flash map, please refer to FTL POOL.OEM HEADER image
The high level Flash Layout configurations are placed in the OEM HEADER. Therefore, if the high level Flash Layout are changed, the OEM HEADER should be updated. If the system config image can’t be updated through the OTA upgrade procedure, all the high level Flash Layouts can’t be modified again.OTA Header image
All the Flash Layout information for the images in the BANK are placed in the OTA Header image for each BANK. If the Flash Layout for the BANK images is changed, the OTA Header image should be updated. If the address of the OTA Header image in BANKx is changed, please keep the address of OTA BANK0 or OTA BANK1 in the high level the same with it.VP data image for RTL87x3E
The Flash Layout information for VP data image on the RTL87x3E is related to storage partition in the APP code image. If the Flash Layout for VP data image is changed, the APP code image must be recompiled.Other images
RTL87x3E: DSP SYS image, DSP APP image, DSP data image, APP config data image, ext image0~3.
RTL87x3EP: DSP SYS image, DSP APP image, DSP data image, APP config data image, ext image0~3.
RTL87x3D: DSP SYS image, DSP APP image, DSP data image, APP config data image, ext image0~3.
The Flash Layout for these images can be adjusted without updating the content of these images.
Users should update images according to the actual Flash Layout adjustment situation:
If the high level Flash Layout configuration about OTA BANK0, OTA BANK1, BKP DATAx and OTA_TMP_ADDR are not changed, and also the Flash Layout for FSBL/SYS Patch/ROM Patch/Stack Patch are not changed, only the Flash Layout for APP image, DSP related images, APP config image or ext image0~3 are changed, users need to recompile the APP image with new Flash Layout, please refer to Recompile APP Image, and update the OTA Header image, please refer to Update OTA Header Image.
If the high level Flash Layout configuration about OTA BANK0, OTA BANK1, BKP DATAx and OTA_TMP_ADDR are changed, users need to update the system config image through MCUConfig Tool, please refer to Update System Config Image.
If the Flash Layout for FSBL, SYS Patch, ROM Patch and Stack Patch are not changed, but the Flash Layout for APP image, DSP related images, APP config image or ext image0~3 is changed, users need to recompile the APP image with new Flash Layout, please refer to Recompile APP Image, and update the OTA Header image, please refer to Update OTA Header Image.
If the Flash Layout for FSBL, SYS Patch, ROM Patch and Stack Patch are changed, users can update the content of these images by
update_images_by_flash_map.exe
without recompiling, please refer to Update Image Content by Flash Map.
So the OTA Header image should be updated by referring to Update OTA Header Image when the image layout in the BANK is changed, and the OEM HEADER image should be updated by referring to Update System Config Image when the high layer Flash Layout is changed, and the Flash Layout for FSBL/SYS Patch/ROM Patch/Stack Patch can be changed by updating the content with the update_images_by_flash_map.exe
by referring to Update Image Content by Flash Map. And APP image needs to be recompiled with new flash map by referring to Recompile APP Image if the Flash Layout for APP image is changed.
Update System Config Image
If the high level Flash Layout configuration about OTA BANK0, OTA BANK1, BKP DATAx, and OTA_TMP_ADDR is changed, the system config image should be updated through MCUConfig Tool.
Open MCUConfig Tool and switch to the ‘System Configuration’ tab, scroll down to the ‘OEM Header Setting’ group, then click the ‘Import flash_map.ini’ button to load the new flash
map. A new system config image will be generated.
Update OTA Header Image
If the image layout in the BANK is changed, the OTA Header image should be updated through MPPG Tool.
Open MPPG Tool:
Click the menu Tool -> Generate OTA Header.
Click the ‘Load Flash Layout’ button to load the new
flash map.ini
.Select OTA BANK ‘Bank0’ or ‘Bank1’.
Set the OTA image version. The OTA image version is used for BANK switch.
Set the RSA key through the ‘Load RSA Key’ button.
Click the ‘Generate’ button to generate the OTA Header with the new Flash Layout.
Update Image Content by Flash Map
All FSBL/SYS Patch/ROM Patch/Stack Patch images are compiled with position independent attribute in the SDK package. With this user guide, the image content can be updated by the tool update_images_by_flash_map.exe
with the new flash map without recompiling.
It’s suggested to copy related files into a new work directory:
Collect the images (FSBL/SYS Patch/Stack Patch/ROM Patch) adjusted by Flash Layout adjusted according to BANK. If there’s only one BANK, take the BANK type as BANK0.
Copy
update_images_by_flash_map.exe
under thesdk\tool\Gadgets\update_images_by_flash_map
to the new work directory.If the images need to be signed by the RSA private key on the secure device, copy the RSA private key to the new work directory. The RSA signature can be updated by the tool
update_images_by_flash_map.exe
. Of course, all images can be updated with the RSA signature by the resign tool undersdk\tool\Gadgets\resign_tool
.
Run the command to update the images by BANK, specify the BANK type by ‘–bank_type 0’ or ‘–bank_type 1’, specify the out directory through ‘-o out_directory_path’ and specify the new flash_map.ini
by ‘–flash_map_ini’. Use ‘-d update_images_path’ to update the images under the directory of update_images_path, and use ‘-f update_image_path’ to update the specified image file.
Take BANK0 images as an example, update image content for BANK0 with new flash_map.ini
by the following command line:
Update images in BANK0 under the directory.
update_images_by_flash_map.exe --flash_map_ini NEW_FLASH_MAP_INI_PATH -d UPDATE_IMG_DIR_FOR_BANK0 --bank_type 0 -o OUT_DIRECTORY
Update the specified single image in BANK0.
update_images_by_flash_map.exe --flash_map_ini NEW_FLASH_MAP_INI_PATH -f UPDATE_IMG_FILE_PATH --bank_type 0 -o OUT_DIRECTORY
For BANK1 images, use ‘–bank_type 1’ in the command line:
Update images in BANK1 under the directory.
update_images_by_flash_map.exe --flash_map_ini NEW_FLASH_MAP_INI_PATH -d UPDATE_IMG_DIR_FOR_BANK1 --bank_type 1 -o OUT_DIRECTORY
Update the specified single image in BANK1.
update_images_by_flash_map.exe --flash_map_ini NEW_FLASH_MAP_INI_PATH -f UPDATE_IMG_FILE_PATH --bank_type 1 -o OUT_DIRECTORY
Recompile APP Image
If the image layout for the APP is changed, the APP image should be recompiled:
Copy the new
flash_map.h
andflash_map.ini
tosdk\bin\flash_map_config
to replace the old ones.Recompile the APP project to generate an APP image with the new Flash Layout.
Download Images with New Flash Layout
The Flash Layout modification would take effect after downloading the images into flash using MPPG Tool with new flash_map.ini
. Please pay attention to the flash_map.ini
setting and BANK type setting on the UI. For a secure device, please pay attention to the image resign operation.
Generate Ext Image Command Line
The prepend_header.exe
and md5.exe
under sdk\tool\Gadgets
will be used.
Use
prepend_header.exe
to add the Image Header for ext Image Payload.
The output file name is the same as the input file name.ext_image0:
prepend_header.exe /ext_image0 ext_image0.bin /ic_type IC_TYPE
ext_image1:
prepend_header.exe /ext_image1 ext_image1.bin /ic_type IC_TYPE
ext_image2:
prepend_header.exe /ext_image2 ext_image2.bin /ic_type IC_TYPE
ext_image3:
prepend_header.exe /ext_image3 ext_image3.bin /ic_type IC_TYPE
For RTL87x3E, use ‘/ic_type 87x3E’. For RTL87x3EP, use ‘/ic_type 8773E’. For RTL87x3D, use ‘/ic_type 87x3D’.
Add MP Header for ext image through
mp.ini
.
The output file name will append_MP
after the input file name.; This is a config file mp.ini used by prepend_header tool to generate MP Header for a given image. ; ; The following sections are mandatory: BinID, Version, PartNumber. ; ; Note that MP Header is a 512-byte fixed data area, pay attention to the long strings that have ; been written and ensure they are not out of bounds of the Header. [MandatoryInfo] ; Image type of current binary file. BinID=ID_EXT_IMAGE1 ; Version of current binary file. Range: 0.0.0.0 ~ 255.255.255.255 Version=1.0.0.0 ; Part number of current image, ASCII type, 32 bytes maximum. PartNumber=RTL87x3E [OptionalInfo] ; Optional. Fill the required version number in specific field if specific image is needed. ; Item will be ignored if the format of the value is wrong or the value does not exist. DependOnSocvConfig = DependOnOemConfig = DependOnFactoryMp = DependOnFsbl = DependOnOtaHeader = DependOnPatch = DependOnApp = DependOnAppData = DependOnAppDataTone = DependOnAppDataVp = DependOnAppDspParam = DependOnDspSys = DependOnDspPatch = DependOnDspScenario1 = DependOnDspScenario2 = ; Optional ASCII type comment string, 255 bytes maximum. Comment= ; Optional ASCII type author information string, 255 bytes maximum. Author= ; Optional ASCII type date and time string, 255 bytes maximum. Date= ; Optional bin Header format revision. Revision=0x01
BinID for ext image in the
mp.ini
is defined as follows, please set the BinID according to the image type.Ext Image Type
BinID in mp.ini
ext_image0
ID_EXT_IMAGE0
ext_image1
ID_EXT_IMAGE1
ext_image2
ID_EXT_IMAGE2
ext_image3
ID_EXT_IMAGE3
Add MP Header command lines:
ext_image0:
prepend_header.exe /ext_image0 ext_image0.bin /mp_ini mp_ext_img0.ini /ic_type IC_TYPE
ext_image1:
prepend_header.exe /ext_image1 ext_image1.bin /mp_ini mp_ext_img1.ini /ic_type IC_TYPE
ext_image2:
prepend_header.exe /ext_image2 ext_image2.bin /mp_ini mp_ext_img2.ini /ic_type IC_TYPE
ext_image3:
prepend_header.exe /ext_image3 ext_image3.bin /mp_ini mp_ext_img3.ini /ic_type IC_TYPE
Add MD5 data in the image file name for ‘ext_imageN_MP.bin’.
The output file name will be ‘ext_imageN_MP-MD5Number.bin’.md5.exe ext_imageN_MP.bin
Image Data Layout
Each image includes three parts: MP Header, Image Header, and Image Payload. The three parts will be introduced separately later.
Some config data images may exist extended data after the Image Payload, and the extended data length is not included in the image length of MP Header and the Image Payload length of Image Header.
MP Header Layout
The size of MP Header is 512 Bytes on all ICs. The information in the MP Header is used by the tools (MPPG Tool and OTA Tool) for performing checks, and it will be stripped by the tools before being downloaded to the MCU. The data format is as follows (taking image size as an example):
Type ID |
Data Length |
Data |
---|---|---|
0x0014 |
0x04 |
Image Size |
Image Header Layout
The Image Header includes information about the image, such as length and secure information. The format of the Image Header for all images on the specified IC is the same. However, some items are useful only in certain images, while they are reserved in others. The default Image Header size varies for different ICs.
RTL87x3E and RTL87x3EP
The default length of the Image Header for RTL87x3E and RTL87x3EP is 1024 bytes. The information in the Image Header Layout is shown in the following map.
Memory Segment |
Size (Bytes) |
Functions |
---|---|---|
Image_cmac |
16 |
CMAC of the Image, for authentication if secure boot is enabled. NOTE that this field should be all 0xFF when downloading the image file to flash, and it can be recalculated. |
Image_signature |
256 |
Signature of the image, for authentication if secure boot is enabled. |
Image_hash |
32 |
SHA256 of the image, used to check integrity. |
Image Control Header |
12 |
Includes essential information for this image, see Image Control Header Items intro for details. |
UUID |
16 |
Should be consistent with ROM UUID. |
Exe Base |
4 |
Image entry address. |
Load Base |
4 |
Start address of code which should be loaded to RAM. |
Load Len |
4 |
Code length of code which should be loaded to RAM. |
Image Base |
4 |
Flash Layout of this image. |
Device ID |
2 |
NOT used. |
Flash Layout Size |
2 |
Used when flash size is larger than layout size. |
Decode Key |
16 |
NOT used. |
Load Destination Address |
4 |
Specifies the RAM address to copy the image from flash to RAM. |
Ex_info |
24 |
Used to configure heap range. Only used in APP image. |
Git/Svn Version |
16 |
For image version control if Git or SVN is used. Optional. |
RSA Public Key |
260 |
For image authentication if secure boot is enabled. |
Ver_val |
4 |
OTA Header image version. Only used in OTA Header image. |
Image Info |
128 |
Used to define layout of images in BANKx. Only used in OTA Header image and BOOT PATCH image. See Image Info Items. |
RSVD |
216 |
Reserved for future use. Same as OTA BANK Sub-image Header. |
RTL87x3D
The default length of the Image Header for RTL87x3D is 4096 bytes. The information in the Image Header Layout is shown in the following map.
Memory Segment |
Size (Bytes) |
Functions |
---|---|---|
Image_cmac |
16 |
CMAC of the Image, for authentication if secure boot is enabled. NOTE that this field should be all 0xFF when downloading the image file to flash, and it can be recalculated. |
Image_signature |
256 |
Signature of the image, for authentication if secure boot is enabled. |
Image_hash |
32 |
SHA256 of the image, used to check integrity. |
Image Control Header |
12 |
Includes essential information for this image, see Image Control Header Items intro for details. |
UUID |
16 |
Should be consistent with ROM UUID. |
Exe Base |
4 |
Image entry address. |
Load Base |
4 |
Start address of code which should be loaded to RAM. |
Load Len |
4 |
Code length of code which should be loaded to RAM. |
Image Base |
4 |
Flash Layout of this image. |
Device ID |
2 |
NOT used. |
Flash Layout Size |
2 |
Used when flash size is larger than layout size. |
Decode Key |
16 |
NOT used. |
Load Destination Address |
4 |
Specifies the RAM address to copy the image from flash to RAM. |
Ex_info |
24 |
Used to configure heap range. Only used in APP image. |
Git/Svn Version |
16 |
For image version control if Git or SVN is used. Optional. |
RSA Public Key |
260 |
For image authentication if secure boot is enabled. |
Ver_val |
4 |
OTA Header image version. Only used in OTA Header image. |
Image Info |
128 |
Used to define layout of images in BANKx. Only used in OTA Header image and BOOT PATCH image. See Image Info Items. |
RSVD |
216 |
Reserved for future use. Same as OTA BANK Sub-image Header. |
Dummy Data |
3072 |
Reserved for dummy data. |
Image Control Header Items
The Image Control Header includes basic information about this image. It’s in the Image Header. The format is shown in the following figure.
Note
For SocV/OEM Header Image, two fields of ICH are required and should be filled with the correct data: Image ID and Payload Length.
Image Info Items
The image_info in the Image Header of the OTA Header and BOOT PATCH defines the Flash Layout of some images. The format of image_info is different on different ICs.