No argument to stop flash erase before programming using the stlink gdb server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-10 10:46 PM - edited ‎2025-04-10 10:54 PM
So I know if I use the STM32CubeProgrammer there's an option to skip flash erase before programming which is great. However, I'm trying to debug some code and I need to prevent flash erase, because I have some code in a sector which I need to keep, but also program some new code in that same sector.
By using the 'ST-LINK_gdbserver --help' command, there's no option/argument which I can use to prevent the flash erase before programming. I tried using the '--skipErase' option mentioned here:
https://community.st.com/t5/stm32cubeprogrammer-mcus/skipping-flash-erase-with-stm32-programmer-cli-and-stlink-v3/td-p/608809
But it didn't work for me:
'/opt/ST/STM32CubeCLT_1.18.0/STLink-gdb-server/bin/ST-LINK_gdbserver -p 50000 -cp /opt/ST/STM32CubeCLT_1.18.0/STM32CubeProgrammer/bin --swd --halt --skipErase -m 0
PARSE ERROR: Argument: --skipErase
Couldn't find match for argument'
It seems like the --skipErase command is specific for the programmer, but there's no way to invoke it from the gdb server.
Would appreciate some guidance on this, thanks.
Solved! Go to Solution.
- Labels:
-
STM32CubeProgrammer
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-17 2:39 AM
Hello @rockybalboa__ ,
I can confirm that with ST-LINK_gdbserver, there's no option to skip the erase. However, I don't think it should be added since you have the possibility to only attach (-g) to a running target instead of downloading the binary via GDB.
=> You can use STM32CubeProgrammer to download your file while skipping the erase:
STM32_Programmer_CLI -c port=SWD -d File.elf --skipErase
and then attach to the target with ST-LINK_gdbserver:
ST-LINK_gdbserver -p 50000 -cp /opt/ST/STM32CubeCLT_1.18.0/STM32CubeProgrammer/bin --swd -g
Let me know if this resolved your issue.
Aziz
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-17 2:39 AM
Hello @rockybalboa__ ,
I can confirm that with ST-LINK_gdbserver, there's no option to skip the erase. However, I don't think it should be added since you have the possibility to only attach (-g) to a running target instead of downloading the binary via GDB.
=> You can use STM32CubeProgrammer to download your file while skipping the erase:
STM32_Programmer_CLI -c port=SWD -d File.elf --skipErase
and then attach to the target with ST-LINK_gdbserver:
ST-LINK_gdbserver -p 50000 -cp /opt/ST/STM32CubeCLT_1.18.0/STM32CubeProgrammer/bin --swd -g
Let me know if this resolved your issue.
Aziz
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.
