AN6007 · Application noteGetting started with STiRoT (ST immutable Root of Trust) for STM32H5 MCUs
Download .pdfOpen in the full document

Update firmware image generation

Update firmware image generation

STiRoT_Code_Image.xml contains all the parameters driving the image generation such as:
  • The authentication and encryption keys.
  • The version and the dependency information.
STiRoT_Code_Image.xml can be edited with STM32 Trusted Package Creator in order to modify the version and the dependency information. The keys are directly inherited from the STiRoT_Config.xml file.

Dependency can be enabled when the compatibility with a specific data image version is required: the installation of both images is synchronized in this case.

To generate a clear (non-encrypted) image, the encryption key must be removed from the list of parameters of the xml file.

The following figure shows the firmware image generation:

Figure 8. Firmware image generation


The list of all parameters is detailed in the appendix Code image XML file.

Initial data image generation

The STiRoT_Data_Init_Image.xml file contains all the parameters driving the image generation such as the authentication and the version information. STiRoT_Data_Init_Image.xml can be edited with STM32 Trusted Package Creator in order to modify the version information. The keys are directly inherited from the STiRoT_Config.xml file.

The following figure shows the data image generation:

Figure 9. Initial data image generation


The list of all parameters is detailed in Data init image XML file.

Update data image generation

The STiRoT_Data_Image.xml file contains all the parameters driving the image generation such as the authentication and encryption keys, and the version information. STiRoT_Data_Image.xml can be edited with STM32 Trusted Package Creator in order to modify the version and the dependency information. The keys are directly inherited from the STiRoT_Config.xml file.

Dependency can be enabled when the compatibility with a specific firmware image version is required: installation of both images is synchronized in this case

The following figure shows the data image generation:

Figure 10. Data image generation


The list of all parameters is detailed in Data image XML file.

STiRoT start-up sequence

Figure 11. STiRoT start-up sequence


The step 5 is optional and can be disabled through STiRoT configuration. When not allowed, a reset is generated instead of a jump to the loader.

Application development phase

The most efficient way to develop and debug an application is to boot directly on the user flash memory in the Open product state. To do this, set the UBE to 0xB4 and the SECBOOTADD to 0x0C000400 using STM32CubeProgrammer (STM32CubeProg). By default, the firmware execution offset is 0x0.

Figure 12. Boot directly in user flash memory


As long as the device is in Open state, the user flash memory can be erased without performing a regression, and a debugger can be connected without performing a Debug Authentication (refer to AN6007_generalinformation.html#id_62441__p_rxk_s12_qyb for more details). Once validated, the Secure Boot path can be activated by configuring STiRoT through the provisioning process.

Refer to STiRoT execution status execution status for more information on debug information when STiRoT is activated.

STiRoT Config.obk file format

Note:

Be careful to endianness: uint32_t 0x01234567 is represented in the obk file as 0x67452301.

Table 9. STiRoT_Config.obk format

OffsetSizeTypeDescription
04uint32_tsdp command header: destination address
44uint32_tsdp command header: data size address
84uint32_tsdp command header: encryption enabled/disabled (1/0)
1232arraySHA256 of the following data content (from offset 44 to 268)
441uint8_tNumber of images managed by STiRoT
451uint8_tClock selection (64/200/250 MHz) – (0/1/2)
461uint8_tFirmware fully secure (1/0)
471uint8_tJump into ST bootloader enabled/disabled (1/0)
484uint32_tFirmware execution area offset
524uint32_tFirmware download area offset
564uint32_tFirmware area size
604uint32_tData area offset in HDPL2 OBKeys
644uint32_tData slot size in HDPL2 OBKeys
684uint32_tData download area offset
724uint32_tData download slot size
764uint32_tSize of the secure area inside the firmware execution area (meaningful only when the firmware is not fully secure).
804uint32_tSRAM2 erasing in case of reset
844uint32_tSRAM2 ECC management activation
884uint32_tProduct state minimal allowed (0x0000ED00, Open / 0x00001700, Provisioning / 0x00002E00, Provisioned / 0x0000C600, TZ-Closed / 0x00007200, Closed / 0x00005C00, Locked
9270arrayEncryption private key (MCUboot format)
1622arrayReserved
16491arrayAuthentication public key (MCUboot format)
2551uint8_tInternal tampers activation(1)
25612arrayReserved (global alignment of OBKeys data on 16 bytes)
1 This is applicable from the SFSP version 2.7.0 on STM32H573xx products , the SFSP version 1.3.0 on STM32H533xx products , the SFSP version 1.3.0 on STM32H553xx products, and SFSP version 1.1.0 on STM32H5F5xx products. For previous SFSP version, when a tamper fault occurs, the system resets in loop until a backup domain power-on reset is performed. Refer to document AN6007_generalinformation.html#id_62441__p_gf1_hls_3hc to get all the information about SFSP version tracking.

STiRoT Data.obk file format

STiRoT_Data.obk is part of the provisioning process to initialize the images version antirollback counters (zero value) and code image SHA256 reference (zero value).

Note:

Be careful to endianness: uint32_t 0x01234567 is represented in the obk file as 0x67452301.

Table 10. STiRoT_Data.obk format
OffsetSizeTypeDescription
04uint32_tsdp command header : destination address
44uint32_tsdp command header : data size (number of bytes)
84uint32_tsdp command header : encryption enabled/disabled (1/0)
1232arraySHA256 of the following data content (from offset 44 to 108)
444uint32_tVersion of the code image, automatically updated during the secure boot and secure firmware update process.
484uint32_tVersion of the previous code image, automatically updated during the secure boot and secure firmware update process.
524uint32_tVersion of the data image, automatically updated during the secure boot and secure firmware update process.
564uint32_tVersion of the previous data image, automatically updated during the secure boot and secure firmware update process.
6032arraySHA256 of the code image installed, automatically updated during the secure boot and secure firmware update process.
9216arrayReserved