2026-02-02 1:23 AM
Hi all,
I've searched for similar post but solutions provided did not work for my case.
For compatibility reasons I needed to upgrade from ST-Link to Cube programmer CLI but I've encountered roadblocks while using the -w commands with the Cube CLI.
If I write directly with the CubeProgrammer UI, no issue at all, but if i try using CLI below error pops-up:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD mode=UR -w8 0x08080000 0x02 -v -hardRst ST-LINK SN : 54FF6C066685495431141687
██████████████████████████████████████████████████Error: |
Some details about:
Thanks all for your help and support with this.
Regards
G
2026-02-02 2:21 AM - edited 2026-02-02 2:49 AM
Hello Blast3r and welcome to the community!
According to UM2237, downloading using -w<8,16,32> requires the flash memory to be erased since it doesn't erase it in order to write.
STM32CubeProgrammer GUI does it for you automatically when you edit.
2026-02-04 7:03 AM
Hi @Kouthair, thanks for your fast reply.
I've double check the documentation and saw the note about this. I need to say sorry but I thought the principle was like the previous CLI, where there was no need to erase prior sending -w8/16/32 commands.
The problem at this point is that the sector in question contains data from a previous process and cannot be lost.
What approach do you recommend?
From the documentation I see that dump command, as per privious CLI, is not more available.
Thanks for your help.
Regards
G.
2026-02-11 6:32 AM - edited 2026-02-11 6:32 AM
Hello again @blast3r,
At the moment there is not a way to do this, the STM32CubeProgrammer GUI version also does this: It has to erase the entire sector and program the updated content.
2026-02-11 8:50 AM
@blast3r Note that not only the target memory should be erased: different STM32 MCUs have different limitations on programming of the internal flash. For example on some STM32 you can only write in multiples of 32 bytes, aligned on 32 bytes. The details are in the Data sheet (DS) or Reference Manual (RM) for your model.
2026-02-13 3:11 AM
Well, I guess I need to use the --read command, store the entire sector into a separate file, erase it and then --download the file after manipulated it with the bites to be updated...
Not so user-friendly unfortunateely, but to date is the only option I assume.
I whish I could return to the V2 CLI