cancel
Showing results for 
Search instead for 
Did you mean: 

Specify option bits in source code file

DavidNaviaux
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

4 REPLIES 4
TDK
Guru

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".

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?

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".

I am using the STM32G474RBT3.  It has 128kB of flash.  To allow my firmware to run, the DBANK and DFB2 option bits must be unchecked.