SFI to STM32H563ZITx fails irrecoverably with illegal BOOT_UBE value
I'm exploring Secure Firmware Install of our product firmware, programming it to a Nucleo H563ZI development board straight out of the box, never previously used. I'm programming it with firmware binaries (including a bespoke OEM iRoT), option bytes and a couple of OBkeys files (one for certificate-based Debug Authentication, another for my iRoT’s keys). For these current experiments, I'm using a global license for installation.
I'm using STM32CubeProgrammer and STM32 Trusted Package Creator version 2.22.0, with X-CUBE-RSSE package version 2.0.0 installed.
Running the installation process within the GUI STM32CubeProgrammer, the following message boxes are displayed as it proceeds:
* (Info) File download complete
* (Info) MCU Reset
* (Error) Error: Execution of RSS CMD failed, returned value = 0xFFEADE2A
* (Error) Error: Failed to Process Area Number 1 of type H
The installation process stops after the last of these errors. After failure, the MCU's option bytes are in this state:
OPTION BYTES BANK: 0
Product state:
PRODUCT_STATE: 0x17 (Provisioning, Debug partially opened (only non-secure))
BOR Level:
BOR_LEV : 0x0 (BOR Level 1, the threshold level is low (around 2.1 V))
BORH_EN : 0x0 (0x0)
User Configuration:
IO_VDD_HSLV : 0x0 (0x0)
IO_VDDIO2_HSLV: 0x0 (0x0)
IWDG_STOP : 0x1 (0x1)
IWDG_STDBY : 0x1 (0x1)
BOOT_UBE : 0xC3 (ST-iRoT (system flash) selected)
SWAP_BANK : 0x0 (0x0)
IWDG_SW : 0x1 (0x1)
NRST_STOP : 0x1 (0x1)
NRST_STDBY : 0x1 (0x1)
OPTION BYTES BANK: 1
User Configuration 2:
TZEN : 0xB4 (Trust zone enabled)
USBPD_DIS : 0x1 (Disabled)
SRAM2_ECC : 0x0 (SRAM2 ECC check enabled )
SRAM3_ECC : 0x0 (SRAM3 ECC check enabled )
BKPRAM_ECC : 0x1 (BKPRAM ECC check disabled)
SRAM2_RST : 0x0 (SRAM2 erase when system reset)
SRAM1_3_RST : 0x1 (SRAM1 and SRAM3 not erased when a system reset occurs)
OPTION BYTES BANK: 2
Boot Configuration:
NSBOOTADD : 0x80000 (0x8000000)
NSBOOT_LOCK : 0xC3 (The SWAP_BANK and NSBOOTADD can still be modified following their individual rules.)
SECBOOT_LOCK : 0x0 (Unknown Value)
SECBOOTADD : 0x0 (0x0)
OPTION BYTES BANK: 3
Bank1 - Flash watermark area definition:
SECWM1_STRT : 0x0 (0x8000000)
SECWM1_END : 0x7F (0x80FE000)
Write sector group protection 1:
WRPSGn1 : 0xFFFFFFFF (0x8000000)
OPTION BYTES BANK: 4
Bank2 - Flash watermark area definition:
SECWM2_STRT : 0x0 (0x8100000)
SECWM2_END : 0x7F (0x81FE000)
Write sector group protection 2:
WRPSGn2 : 0xFFFFFFFF (0x8000000)
OPTION BYTES BANK: 5
OTP write protection:
LOCKBL : 0x0 (0x0)
OPTION BYTES BANK: 6
Flash data bank 1 sectors:
EDATA1_EN : 0x0 (No Flash high-cycle data area)
EDATA1_STRT : 0x0 (0x0)
OPTION BYTES BANK: 7
Flash data bank 2 sectors:
EDATA2_EN : 0x0 (No Flash high-cycle data area)
EDATA2_STRT : 0x0 (0x0)
OPTION BYTES BANK: 8
Flash HDP bank 1:
HDP1_STRT : 0x1 (0x2000)
HDP1_END : 0x0 (0x0)
OPTION BYTES BANK: 9
Flash HDP bank 2:
HDP2_STRT : 0x1 (0x2000)
HDP2_END : 0x0 (0x0)
I can't get the MCU out of the Provisioning Product State from here:
- Provisioning with my Debug Authentication certificate succeeds but then try to change PRODUCT_STATE to 0x72 (Closed, so I can run a Full Regression):
- Error: Expected value for Option Byte "PRODUCT_STATE": 0x72, found: 0x17
- Error: Option Byte Programming failed Or modified by application after OB_LAUNCH
- Try to change BOOT_UBE to 0xB4:
- Error: Expected value for Option Byte "BOOT_UBE": 0xB4, found: 0xC3
- Error: Option Byte Programming failed Or modified by application after OB_LAUNCH
- Try to change SECBOOT_LOCK to 0xC3:
- Error: Expected value for Option Byte "SECBOOT_LOCK": 0xC3, found: 0x0
- Error: Option Byte Programming failed Or modified by application after OB_LAUNCH
- Try to change BOOT_UBE and PRODUCT_STATE as above at the same time: Same errors as above
- Try to change BOOT_UBE, PRODUCT_STATE and SECBOOT_LOCK as above at the same time: Same errors as above
So, the board is effectively "bricked"; it can't be usefully programmed with any firmware from this point.
What concerns me the most in these option bytes is the line:
BOOT_UBE : 0xC3 (ST-iRoT (system flash) selected)
As I understand it, this is an illegal setting on the STM32H563, since it has no ST-iRoT, and I did not set it; see my option bytes file below. So, I guess the SFI process must be setting it for some reason. I wonder if this is the reason I can’t end provisioning?
The full log from STM32CubeProgrammer is:
10:21:11 : UPLOADING ...
10:21:11 : Size : 4 Bytes
10:21:11 : Address : 0xBF960CC
10:21:11 : Read progress:
10:21:11 : Data read successfully
10:21:11 : Time elapsed during the read operation is: 00:00:00.011
10:21:11 : Starting Firmware Install operation...
10:21:11 : Warning: Option Byte: BOOT_UBE, value: 0xB4, was not modified.
10:21:11 : Warning: Option Bytes are unchanged, Data won't be downloaded
10:21:11 : Time elapsed during option Bytes configuration: 00:00:00.012
10:21:11 : Reconnecting...
10:21:13 : Reconnected !
10:21:13 : Reconnecting...
10:21:14 : Reconnected !
10:21:14 : Time elapsed during option Bytes configuration: 00:00:02.369
10:21:14 : Reconnecting...
10:21:15 : ST-LINK SN : 0042002B3133511437363734
10:21:15 : ST-LINK FW : V3J10M3
10:21:15 : Board : NUCLEO-H563ZI
10:21:15 : Voltage : 3.28V
10:21:15 : SWD freq : 8000 KHz
10:21:15 : Connect mode: Hot Plug
10:21:15 : Reset mode : Hardware reset
10:21:15 : Device ID : 0x484
10:21:15 : Revision ID : Rev X
10:21:15 : Reconnecting...
10:21:16 : Reconnected !
10:21:16 : Time elapsed during option Bytes configuration: 00:00:01.205
10:21:16 : Warning: Option Byte: SECBOOT_LOCK, value: 0xC3, was not modified.
10:21:16 : Warning: Option Bytes are unchanged, Data won't be downloaded
10:21:16 : Time elapsed during option Bytes configuration: 00:00:00.008
10:21:16 : Warning: Option Byte: SECBOOTADD, value: 0xC0000, was not modified.
10:21:16 : Warning: Option Byte: SECWM1_END, value: 0x7F, was not modified.
10:21:16 : Warning: Option Byte: SECWM1_STRT, value: 0x0, was not modified.
10:21:16 : Warning: Option Byte: SECWM2_END, value: 0x7F, was not modified.
10:21:16 : Warning: Option Byte: SECWM2_STRT, value: 0x0, was not modified.
10:21:16 : Warning: Option Byte: SRAM1_3_RST, value: 0x1, was not modified.
10:21:16 : Reconnecting...
10:21:17 : Reconnected !
10:21:17 : Time elapsed during option Bytes configuration: 00:00:01.195
10:21:17 : Reconnecting...
10:21:19 : ST-LINK SN : 0042002B3133511437363734
10:21:19 : ST-LINK FW : V3J10M3
10:21:19 : Board : NUCLEO-H563ZI
10:21:19 : Voltage : 3.28V
10:21:19 : SWD freq : 8000 KHz
10:21:19 : Connect mode: Hot Plug
10:21:19 : Reset mode : Hardware reset
10:21:19 : Device ID : 0x484
10:21:19 : Revision ID : Rev X
10:21:19 : Reconnecting...
10:21:20 : Reconnected !
10:21:21 : Reconnecting...
10:21:22 : Reconnected !
10:21:24 : Time elapsed during option Bytes configuration: 00:00:05.398
10:21:24 : Reconnecting...
10:21:25 : ST-LINK SN : 0042002B3133511437363734
10:21:25 : ST-LINK FW : V3J10M3
10:21:25 : Board : NUCLEO-H563ZI
10:21:25 : Voltage : 3.28V
10:21:25 : SWD freq : 8000 KHz
10:21:25 : Connect mode: Hot Plug
10:21:25 : Reset mode : Hardware reset
10:21:25 : Device ID : 0x484
10:21:25 : Revision ID : Rev X
10:21:25 : Installing RSSe
10:21:25 : Opening and parsing file: RSSe_SFI_H56x_H573_v3.1.0.bin
10:21:25 : Memory Programming ...
10:21:25 : File : RSSe_SFI_H56x_H573_v3.1.0.bin
10:21:25 : Size : 55.56 KB
10:21:25 : Address : 0x20054100
10:21:25 : Erasing memory corresponding to segment 0:
10:21:25 : Download in Progress:
10:21:25 : File download complete
10:21:25 : Time elapsed during download operation: 00:00:00.111
10:21:25 : MCU Reset
10:21:25 : Reconnecting...
10:21:26 : ST-LINK SN : 0042002B3133511437363734
10:21:26 : ST-LINK FW : V3J10M3
10:21:26 : Board : NUCLEO-H563ZI
10:21:26 : Voltage : 3.28V
10:21:26 : SWD freq : 8000 KHz
10:21:26 : Connect mode: Hot Plug
10:21:26 : Reset mode : Hardware reset
10:21:26 : Device ID : 0x484
10:21:26 : Revision ID : Rev X
10:21:27 : Get RSSe status...
10:21:27 : RSS version = 2.2.0
10:21:27 : RSSe version = 3.1.0
10:21:27 : Starting SFI
10:21:27 : Processing license...
10:21:27 : Get RSSe status...
10:21:27 : Processing Image Header
10:21:27 : Get RSSe status...
10:21:27 : Processing Area 1...
10:21:27 : Error: Execution of RSS CMD failed, returned value = 0xFFEADE2A
10:21:27 : Error: Failed to Process Area Number 1 of type H
10:21:27 : Disconnected from device.My option bytes .csv file, set up using the SFI Option Bytes tab in STM32 Trusted Package Creator, is:
OPTSR_PRG,0x2D3072F8
OPTSR2_PRG,0xB4000070
NSBOOTR_PRG,0x080000C3
SECBOOTR_PRG,0x0C0000B4
SECWM1R_PRG,0x007F0000
SECWM2R_PRG,0x007F007F
WRP1R_PRG,0xFFFFFFFC
WRP2R_PRG,0xFFFFFFFF
EDATA1R_PRG,0x00000000
EDATA2R_PRG,0x00000000
HDP1R_PRG,0x00070000
HDP2R_PRG,0x00000001So, questions:
- What does "Error: Execution of RSS CMD failed, returned value = 0xFFEADE2A" signify?
- What would cause failure to process an area of type H?
- Am I doing anything wrong in my use of the tools to see this behaviour?
- Why is SFI setting BOOT_UBE to value 0xC3, which is illegal on this MCU?
- Is there any way to recover this board to a usable condition from this state or should we throw it away?
