Skip to main content
Associate
Oct 23, 2026 1:56 PM UTC
Solved

Error when setting multiple Option Bytes and BOOT_LOCK is part of them

Hi,

I’m facing an issue when I’m trying to modify multiple Option Bytes on the STM32G473 with one call to STM32_Programmer_CLI.

The issue seems to occur whenever the BOOT_LOCK-parameter is part of the call.

The call looks like this:

STM32_Programmer_CLI --connect port=SWD --optionbytes BOR_LEV=0x3 nRST_STOP=0x0 nRST_STDBY=0x0 nRST_SHDW=0x0 IWDG_SW=0x1 IWDG_STOP=0x1 IWDG_STDBY=0x1 WWDG_SW=0x1 BFB2=0x0 DBANK=0x1 nBOOT1=0x1 SRAM_PE=0x1 CCMSRAM_RST=0x1 nSWBOOT0=0x0 nBOOT0=0x1 NRST_MODE=0x3 IRHEN=0x1 PCROP1_STRT=0x7FFF PCROP1_END=0x0 PCROP_RDP=0x0 WRP1A_STRT=0x7F WRP1A_END=0x0 WRP1B_STRT=0x7F WRP1B_END=0x0 PCROP2_STRT=0x7FFF PCROP2_END=0x0 WRP2A_STRT=0x7F WRP2A_END=0x0 WRP2B_STRT=0x7F WRP2B_END=0x0 SEC_SIZE1=0x0 SEC_SIZE2=0x0 BOOT_LOCK=0x1

When BOOT_LOCK is part of it, the execution stops with the error “Unable to get core ID” .

When it’s not, everything works fine.

The issue is also reproducible when it’s just one other parameter besides BOOT_LOCK, eg. STM32_Programmer_CLI --connect port=SWD --optionbytes BOR_LEV=0x3 BOOT_LOCK=0x1 .

After the call, only BOOT_LOCK is modified while BOR_LEV still has the default value of 0x0.

When I run it again with the same parameters (BOR_LEV=0x3 BOOT_LOCK=0x1), BOR_LEV is now also set correctly.

So, it seems like the issue only occurs when both parameters are actually modified by the call.

Because, when it is executed again afterwards, now with BOR_LEV=0x0 BOOT_LOCK=0x0, it errors out again.

I’ve attached the output when I run it with --verbosity 3.

 

Is this behavior expected or is this a bug in the tool?

Any help would be greatly appreciated!

Kouthair
KouthairBest answer
ST Technical Moderator
Oct 29, 2026 1:20 PM UTC

Hey ​@lhaegele ,
To address your questions; It is not necessary to put -ob before every Option byte register & no this does not apply to other STM32 MCUs. This appears to be specific to this device.
I’ll forward this to our development team for further investigation, we appreciate you reporting this issue and will let you know when a fix is available. (Internal ticket ID: CDM0066984)
For now, you can add “-ob” before BOOT_LOCK as that allows it to perform the change separately from the other option bytes.
 

PS: Internal Ticket ID: CDM0066984 is an internal tracking number and is not accessible or usable by customers.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

6 replies

Kouthair
ST Technical Moderator
Oct 28, 2026 10:50 AM UTC

Hello ​@lhaegele & welcome to the community! 

While using the first full call, can you try adding a -ob before BOOT_LOCK=0x1 and see if that works? 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
lhaegeleAuthor
Associate
Oct 28, 2026 12:45 PM UTC

Hi ​@Kouthair, thanks for your response.

When I add an additional -ob before BOOT_LOCK it seems to work flawlessly.

Is this necessary because BOOT_LOCK is in a different register than the other Option Bytes (that are changed from their default values)?

If so, does that mean that all the Option Bytes should be grouped by their containing registers to be sure, like:

STM32_Programmer_CLI --connect port=SWD -ob BOR_LEV=0x3 nRST_STOP=0x0 nRST_STDBY=0x0 nRST_SHDW=0x0 IWDG_SW=0x1 IWDG_STOP=0x1 IWDG_STDBY=0x1 WWDG_SW=0x1 BFB2=0x0 DBANK=0x1 nBOOT1=0x1 SRAM_PE=0x1 CCMSRAM_RST=0x1 nSWBOOT0=0x0 nBOOT0=0x1 NRST_MODE=0x3 IRHEN=0x1 -ob PCROP1_STRT=0x7FFF -ob PCROP1_END=0x0 PCROP_RDP=0x0 -ob WRP1A_STRT=0x7F WRP1A_END=0x0 -ob WRP1B_STRT=0x7F WRP1B_END=0x0 -ob PCROP2_STRT=0x7FFF -ob PCROP2_END=0x0 -ob WRP2A_STRT=0x7F WRP2A_END=0x0 -ob WRP2B_STRT=0x7F WRP2B_END=0x0 -ob SEC_SIZE1=0x0 BOOT_LOCK=0x1 -ob SEC_SIZE2=0x0?

Does this apply to other STM32-Controllers as well?

Is this documented anywhere?

 

Thanks for your help!

Kouthair
KouthairBest answer
ST Technical Moderator
Oct 29, 2026 1:20 PM UTC

Hey ​@lhaegele ,
To address your questions; It is not necessary to put -ob before every Option byte register & no this does not apply to other STM32 MCUs. This appears to be specific to this device.
I’ll forward this to our development team for further investigation, we appreciate you reporting this issue and will let you know when a fix is available. (Internal ticket ID: CDM0066984)
For now, you can add “-ob” before BOOT_LOCK as that allows it to perform the change separately from the other option bytes.
 

PS: Internal Ticket ID: CDM0066984 is an internal tracking number and is not accessible or usable by customers.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
lhaegeleAuthor
Associate
Nov 4, 2026 9:08 AM UTC

<Edit: moved to correct thread>