2024-06-06 03:17 PM
Keil (among others) allows the choice of whether to do a full or partial erase before programming:
Is it possible to do that in STM32CubeIDE ?
If so, how ?
2024-06-06 11:52 PM
Hi @Andrew Neil
I don't think there is a nice GUI window as in Keil, I'm using the external tool configuration and depending on the argument you specify it can do either mass erase or only needed sectors:
For the sectors needed only, the argument is:
-c port=SWD mode=UR -d ${workspace_loc}\${project_name}\${config_name:${project_name}}\${project_name}.elf -v -rst
For mass erase instead:
-c port=SWD mode=UR -e all -d ${workspace_loc}\${project_name}\${config_name:${project_name}}\${project_name}.elf -v -rst
You can even skip the flash erase, or only some sectors. Everything is explained in the STM32_Programmer_CLI help.
Have a nice day,
Kraal
2024-06-07 04:33 AM - edited 2024-06-07 04:33 AM
Thanks for that.
So is that all I need to do, or does it also need some reference to the "external tool" to be added/modified elsewhere?
2024-06-07 04:43 AM - edited 2024-06-07 04:44 AM
From the external tool configuration, the last tab "Common" there is a checkbox under "Display in favorites menu" that you should check (red box below) :
Your configurations will then show in the main menu in the IDE :
Note that you don't need to develop the drop down menu if you always use the same configuration, you can directly click on "Play_toolbox" icon (if you hover over it, the text shall say "use latest tool" or something like so).
Warning: in my case, I have to select the project I want to flash in the project pane for the tool to work OK. Otherwise it fails to convert ${workspace_loc}\${project_name}\${config_name:${project_name}}\${project_name}.elf into something meaningful and will comply.
2024-06-07 05:19 AM
So this is giving a button to do just the programming - without debugging?
How do I integrate this with starting a Debug session?
How do I tell the Debug Configuration to use this to do its download? Or does it "just happen" automagically?
Or is there a way to tell the Debug Configuration to not do its download?
(I see I didn't mention that I wanted this included as part of starting a debug session - as Keil "just does it")
2024-06-07 05:45 AM
@Andrew Neil wrote:Or is there a way to tell the Debug Configuration to not do its download?
Aha - that one is answered by @TDK here:
But is there a way to modify the Debug Configuration's down load behaviour ?
2024-06-07 06:09 AM
If you run with GDB ans some GDBserver and the right memory map for the device, gdb does a sector erase for the sectors involved. E.g. blackmagic has a monitor command "mon(itor) erase_mass" to do a full erase.
2024-06-07 06:25 AM
You should be able to modify the debug download behavior, but I'm not sure to what extent. @STTwo-32 can you help regarding this please ?
Otherwise, the old TrueStudio documentation suggested to create a "Launch group" which executes:
- first the external tool to download the executable in the microcontroller (this can include external memory like QSPI providing you have the right external loader)
- then the debug session, with its download checkbox unticked