Skip to main content
Senior
November 21, 2023
Solved

Specify option bits in source code file

  • November 21, 2023
  • 1 reply
  • 1999 views

I am about to release firmware to production and would like to include the proper options bits in the firmware so that production can simply program the .elf file at the same time as updating the option bits.  I realize that there are several option bits that have to changed on a new MCU before my firmware will work.  But maybe the option bits would automatically get programmed first.

What is recommended way to handle initial programming of an MCU?

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

You can set option bytes and program the ELF in one go using the stm32cubeprogrammer CLI.

 

There's no way to tie them into your ELF directly, as far as I know.

You can check/set them within your program at startup, which has the same effect as long as the program gets run. Depends which option bytes you need, in particular.

1 reply

TDK
TDKBest answer
Super User
November 21, 2023

You can set option bytes and program the ELF in one go using the stm32cubeprogrammer CLI.

 

There's no way to tie them into your ELF directly, as far as I know.

You can check/set them within your program at startup, which has the same effect as long as the program gets run. Depends which option bytes you need, in particular.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Senior
November 21, 2023

My code requires use of the entire flash and the default option bits only allow 1/2 to be used, so I need to program the fuses before programming the code.  Is that possible from the stm32cubeprogrammer?

TDK
Super User
November 21, 2023

What chip are you using and what option byte needs set in order to use all of the flash? Only thing I can think of is STM32WB but there's good reason you can't use all of the flash there.

> Is that possible from the stm32cubeprogrammer?

Yes.

"If you feel a post has answered your question, please click ""Accept as Solution""."