Skip to main content
GearHead
Associate II
July 16, 2020
Solved

How to change option bytes in STM32CubeIDE?

  • July 16, 2020
  • 1 reply
  • 4283 views

I'm working with an STM32F04, and I'd like to change the option bytes so that my firmware can't be read back out after the device is programmed. I can tell from documentation I need to set the RDP byte to something besides 0xAA or 0xCC, but there isn't much about how to do this from the IDE.

Is there an option or a file I can edit in the STM32CubeIDE to modify the byte once my firmware is programmed?

Thank you!

This topic has been closed for replies.
Best answer by TDK

The only way to do this in STM32CubeIDE is to add a separate section in the linker for your option bytes.

The easiest way to change them is probably in STM32CubeProgrammer or in your startup code. Just add a section that checks RDP and change it if necessary.

1 reply

TDK
TDKBest answer
Super User
July 16, 2020

The only way to do this in STM32CubeIDE is to add a separate section in the linker for your option bytes.

The easiest way to change them is probably in STM32CubeProgrammer or in your startup code. Just add a section that checks RDP and change it if necessary.

"If you feel a post has answered your question, please click ""Accept as Solution""."
GearHead
GearHeadAuthor
Associate II
July 16, 2020

Thank you! I just downloaded CubeProgrammer and this is exactly what I was hoping for - automatic programming and option byte modification. Hopefully this helps the next person - it's easy to get lost with all of the different IDE/ DFuse/ etc. tools available