2019-12-01 06:22 AM
Is there someway to do this with stm32cubeide?
For my specific use case I am storing configuration data on last page of flash (currently working on figuring out how to erase it so i can rewrite it in software), but I would also like to be able to configure it by reprogramming it. I can check that the page is empty and write settings to it, but I haven't found any way to erase it with stm32cubeide, I need to open the st link utility in order to erase the flash as far as I can tell.
Solved! Go to Solution.
2019-12-04 03:36 AM
There are a few ways of doing it. For example, you can either call cube programmer CLI and run a mass erase as a pre-build step ${cubeide_cubeprogrammer_path}/STM32_Programmer_CLI.exe
If you use that way it's important that in the debug configuration under "Main" tab that you don't have auto build disabled because then the pre-build step will not be called.
You can also go to the startup tab in the debug configuration and add "monitor flash mass_erase" as an Initialization command.
2019-12-04 03:36 AM
There are a few ways of doing it. For example, you can either call cube programmer CLI and run a mass erase as a pre-build step ${cubeide_cubeprogrammer_path}/STM32_Programmer_CLI.exe
If you use that way it's important that in the debug configuration under "Main" tab that you don't have auto build disabled because then the pre-build step will not be called.
You can also go to the startup tab in the debug configuration and add "monitor flash mass_erase" as an Initialization command.
2019-12-04 10:57 PM
Thanks, somehow I had tried to write in the initialization commands section, but I hadn't thought to include the word "monitor" in my command, so it only gave errors.
2021-11-06 10:19 AM
I think this works for a ST link debugger connection ; unfortunately not for a Segger Jlink?!
When adding "monitor flash mass_erase" to the debug configuration -> Initialization startup :
I get the following error :
Any suggestions?
diederik
2021-11-08 02:06 AM
Hello Diederik,
J-Link has its own commands which you can find more about in their user manual available here.
I believe the command for J-Link should be flash erase but you can double check that with the manual.
2022-03-14 04:52 AM
Using Segger J-Link the command is: monitor flash erase
2022-03-15 03:10 AM
Thank you for the clarification! I usually use my ST-Link so I wasn't sure :grinning_face_with_sweat:
2022-08-28 11:33 AM
Hi
Is there a similar way to to a partial erase?
I am switching back and forth between two different software builds in a dual banked system and I only want to erase the currently executing bank.
BR
Martin
2022-08-28 12:28 PM
By default the debugger only erases the necessary sectors/pages.
2022-08-28 04:37 PM
> dual banked system
This is interesting question. How the programmer knows which mode to use: one bank or dual bank, and which bank is the 'current'? Does it check the option bytes?