Preferred way to set Option Bytes?
Unfortunately not directly. I’ve used the ST-Link Utility to set it on my development boards.Then I’ve switched to a completely IDE-free workflow, since it didn’t really help with development.
To define the option bytes in C code, you can use a section attribute to place it in a special section, then put that section at the address of option in the linker script. I think I’ve had some problems with openocd when trying this, but I can’t remenber exactly.