ホーム バラエティ [Practical] Running OEMiRoT Secure Boot on STM32H563: From CubeMX Configuration to Provisioning

[Practical] Running OEMiRoT Secure Boot on STM32H563: From CubeMX Configuration to Provisioning

真鍋 千夏 真鍋 千夏 • 更新: • 公開: • 読了約 14 分
目次

Target board: NUCLEO-H563ZI
Implemented MCU: STM32H563ZIT6
MCU to select in CubeMX: STM32H563ZITx
Configuration: TrustZone enabled / OEMiRoT 1-stage boot / Secure + Non-secure LED sample

This procedure is a step-by-step guide to reproducing OEMiRoT on an actual NUCLEO-H563ZI board. Based on the official ST Wiki "STM32CubeMX OEMiRoT Boot path on STM32H563," this guide summarizes the process for the NUCLEO-H563ZI, including the LED, user button, ST-LINK connection, provisioning, and recovery after CLOSED state.

Although the screens are similar to the H573 documentation, the STM32H563ZIT6 mounted on the NUCLEO-H563ZI is a non-crypto model, so the major difference is that the TPC encryption option is disabled. This is not an error.

Also, while the ST Wiki H563 OEMiRoT procedure refers to PF4 as the "orange LED," in the NUCLEO-H563ZI user manual UM3115, PF4 is the LD2 yellow LED. In this procedure, it is referred to as the LD2 yellow LED (PF4) in accordance with the board manual.

1. Conclusion first

n31295f4c7bde

The feature used on the NUCLEO-H563ZI is OEMiRoT, not STiRoT. The MCU mounted on the board is the STM32H563ZIT6. Select STM32H563ZITx in CubeMX. TrustZone can be used, but it is not a crypto product with a hardware encryption accelerator like the H573. Therefore, STiRoT and Secure Manager are not applicable. The official ST Wiki also explains that OEMiRoT is the remaining boot path for the STM32H523/56x/5Ex.

The sample created with this procedure operates as follows.

  1. After reset, OEMiRoT_Boot is executed first.

  2. OEMiRoT_Boot verifies the signature and integrity of the Secure/Non-secure applications.

  3. It transitions to the Secure application, and the LD2 yellow LED (PF4) on the NUCLEO-H563ZI blinks at a 500 ms interval.

  4. When the blue user button (PC13) on the NUCLEO-H563ZI is pressed, it calls NonSecure_Init() and transitions to the Non-secure application.

  5. In the Non-secure application, the LD1 green LED (PB0) on the NUCLEO-H563ZI blinks at an 800 ms interval.

2. Environment and Prerequisites

The minimum requirements for the official H563 Wiki are STM32CubeMX 6.9.0 or later and STM32CubeProgrammer 2.13.0. In this document, I will proceed by recording the versions of CubeMX, CubeProgrammer, and STM32CubeH5 actually used. Since screen names and folder names change depending on the version, please replace Vx.x.x in the text with your own environment.

Items to prepare:

Please keep the working path short. The following is a recommended example.

C:\ST\STM32Cube\Repository\STM32Cube_FW_H5_V1.6.0
C:\ST\work\NUCLEO_H563ZI_OEMiROT

Example to avoid:

C:\Users\<user>\Documents\長い日本語フォルダ\STM32 security trial with spaces\...

Provisioning and postbuild batch files are prone to failure if there are spaces, Japanese characters, or if the directory hierarchy is too deep. If you have been stuck here in the past, shortening the path is the most effective solution.

Checking ST-LINK firmware:

Check for ST-LINK firmware updates using STM32CubeProgrammer or STM32CubeIDE.
Older ST-LINK firmware can sometimes cause unexpected failures with connections or DA.

3. Signals used on the NUCLEO-H563ZI

In this procedure, the components on the NUCLEO-H563ZI board are used as follows.


Section 11.1 of UM3115 states that LD1 green LED = PB0, LD2 yellow LED = PF4, LD3 red LED = PG4, and B1 blue user button = PC13. Although the ST Wiki H563 OEMiRoT page refers to PF4 as an "orange LED," please proceed by reading it as the LD2 yellow LED (PF4) on the actual NUCLEO-H563ZI hardware. The pin assignment of PF4 is correct.

In UM3115, it is explained that user LEDs are ON when the I/O is HIGH and OFF when it is LOW. With the default factory solder bridge settings, LD1 is connected to PB0 and B1 is connected to PC13.

Things to check before starting:

  • JP2 is in the default [1-2] STLK state

  • JP1 is OFF, using the built-in STLINK-V3EC

  • JP5 is ON, supplying power to the MCU

  • Connected to the PC via the ST-LINK side USB CN1

  • Product state is OPEN in STM32CubeProgrammer

  • If the board was previously set to CLOSED/TZ-CLOSED, perform a Regression first to return it to OPEN

It is important to note that even for the NUCLEO-H563ZI procedure, you should use the MCU Selector rather than the Board Selector on the CubeMX start screen. Starting from the Board Selector can include unnecessary peripheral settings for board initialization, which increases the differences from the official OEMiRoT procedure. In this procedure, select STM32H563ZITx in the MCU Selector and manually assign only the necessary PF4, PC13, and PB0 pins on the NUCLEO-H563ZI.

4. Positioning of OEMiRoT on the NUCLEO-H563ZI

OEMiRoT is an immutable Root of Trust placed by the OEM in user Flash. The ST Wiki explains that OEMiRoT is included in STM32CubeH5 as an example based on MCUboot and provides two services: Secure Boot and Secure Firmware Update.

Proceed with the following understanding for the NUCLEO-H563ZI.

5. Overall flow

  1. Install STM32CubeH5 from CubeMX.

  2. First, build the OEMiROT_Boot for NUCLEO-H563ZI within STM32CubeH5.

  3. Select STM32H563ZITx from the MCU Selector in CubeMX and enable TrustZone.

  4. Assign PF4, PC13, and PB0 of the NUCLEO-H563ZI to Secure/Non-secure.

  5. Select OEMiRoT in Boot Path and Debug Authentication.

  6. Generate the OBKey for OEMiRoT and the OBKey for DA using TPC.

  7. Generate code in CubeMX.

  8. Add sample code for the Secure side and the Non-secure side.

  9. Build the Secure side first, then build the Non-secure side.

  10. Execute provisioning.bat to deploy to the board.

  11. Verify the LED operation.

  12. If set to CLOSED, verify Debug Authentication or Regression.

同じカテゴリの記事

真鍋 千夏
デジタルマーケター 真鍋 千夏
プロフィールを見る →

美容と暮らしの話題を担当。メーカーの公式発表、商品成分の公表資料、専門家の監修記事をもとに事実を整理します。

おすすめの関連記事