2025-05-26 10:46 AM
I am trying to run the Secure Boot examples from STM32CubeL5 and have everything built, but on step 2 where I run `TFM_SBSFU_Boot\STM32CubeIDE\regression.sh` I am having an error where I cannot program the option bytes.(Another similar thread was with someone who bought a counterfeit part so I'll also mention that I bought the kit from ST.)
This is the script output
$ ./regression.sh
regression script started
Regression to RDP 0, enable tz
-------------------------------------------------------------------
STM32CubeProgrammer v2.19.0
-------------------------------------------------------------------
ST-LINK SN : 004600313137510B33333639
ST-LINK FW : V3J13M4
Board : STM32L562E-DK
Voltage : 3.29V
SWD freq : 8000 KHz
Connect mode: Hot Plug
Reset mode : Software reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: rdp, value: 0xAA, was not modified.
Warning: Option Byte: tzen, value: 0x1, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Time elapsed during option Bytes configuration: 00:00:00.003
Remove bank1 protection
-------------------------------------------------------------------
STM32CubeProgrammer v2.19.0
-------------------------------------------------------------------
ST-LINK SN : 004600313137510B33333639
ST-LINK FW : V3J13M4
Board : STM32L562E-DK
Voltage : 3.29V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
Hard reset is performed
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: secwm1_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp1a_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp1b_pend, value: 0x0, was not modified.
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
Reconnecting...
Reconnected !
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
OPTION BYTE PROGRAMMING VERIFICATION:
Error: Expected value for Option Byte "secwm1_pend": 0x0, found: 0x75
Error: Expected value for Option Byte "secwm1_pstrt": 0x7F, found: 0x0
Error: Expected value for Option Byte "wrp1a_pend": 0x0, found: 0x23
Error: Expected value for Option Byte "wrp1a_pstrt": 0x7F, found: 0x4
Error: Option Byte Programming failed Or modified by application after OB_LAUNCH
Time elapsed during option Bytes configuration: 00:00:02.122
regression script failed, press a key
If I open STM32CubeProrammer and edit the fields manually I get the same errors.
12:35:55 : UPLOADING OPTION BYTES DATA ...
12:35:55 : Bank : 0x00
12:35:55 : Address : 0x50022040
12:35:55 : Size : 40 Bytes
12:35:55 : Bank : 0x01
12:35:55 : Address : 0x50022060
12:35:55 : Size : 16 Bytes
12:35:55 : OPTION BYTE PROGRAMMING VERIFICATION:
12:35:55 : Error: Expected value for Option Byte "SECWM1_PEND": 0x0, found: 0x75
12:35:55 : Error: Expected value for Option Byte "WRP1A_PEND": 0x0, found: 0x23
12:35:55 : Error: Option Byte Programming failed Or modified by application after OB_LAUNCH
12:35:55 : Time elapsed during option Bytes configuration: 00:00:02.124
12:40:06 : Disconnected from device.
What can I do to be able to program these bytes?