2025-11-26 2:36 PM - edited 2025-11-26 2:37 PM
Hello,
STM32L4+, CubeProgrammer 2.21, ST-Link V2, Windows 10
I need to do:
* Full flash erase
* Write Application image (.hex or .bin)
* Write Bootloader image (.hex or .bin)
* Set RDP level 1
* Start the application at the Bootloader start address.
-
I am successfully doing this with the CubeProgrammer GUI, but I fail to get it to work with CLI.
The "-e all" command works and says "Mass erase successfully achieved":
C:\"Program Files"\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe -c port=SWD ap=0 -e all
-
However, I have tried numerous variants of the following command (and its separate parts alone) without success:
C:\"Program Files"\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe -c port=SWD freq=3900 ap=0 -e all -w C:\SVN\Path\More_path\hex\Application.elf -w C:\SVN\Path\More_path\hex\Bootloader.hex -ob rdp=0xBB -s 0x08000000
I have also tried with .bin files and their respective start addresses.
The only response I get is the header:
-------------------------------------------------------------------
STM32CubeProgrammer v2.21.0
-------------------------------------------------------------------
-
The command "-c port=SWD freq=3900 ap=0 -s 0x08000000" gives a complete (failure) response:
-------------------------------------------------------------------
STM32CubeProgrammer v2.21.0
-------------------------------------------------------------------
ST-LINK SN : 36FF6C064D59303612251543
ST-LINK FW : V2J46S7
Board : --
Voltage : 3.17V
SWD freq : 1800 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x470
Revision ID : Rev V
Device name : STM32L4Rxxx/STM32L4Sxxx
Flash size : 2 MBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0x95
Debug in Low Power mode enabled
RUNNING Program ...
Address: : 0x8000000
Warning: failed to run application!
Warning: The core is kept under Reset!
Error: Start operation failed
-
I have tried to find a tutorial or a list of CLI command examples but um2237 is a wee bit brief and I haven't found much on the internet.
Grateful for your input.
BR
Niclas
2025-11-26 2:42 PM
> I need to do:
> * Full flash erase
> * Write Application image (.hex or .bin)
> * Write Bootloader image (.hex or bin)
> * Set RDP level 1
> * Start the application at the Bootloader start address.
It's not possible to do the last step. You can't run flash in RDP 1 in debug mode. The chip needs to boot up normally.