Skip to content

Option Bytes for bootloader #1657

Closed Answered by ABOSTM
MadZoids asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MadZoids,

Does option bytes always reset to factory configuration on new compile on generic board variants?

No, Option bytes remains after reset or power OFF/ON. And it is not changed on compilation nor during download of binary in flash.

Can we change the option bytes from sketch level?

There is no dedicated API to do so in Arduino.
Nevertheless you can still make use of STM32 HAL/LL or even direct Register access (all are accessible from Arduino sketch level)
Like:
HAL_FLASH_OB_Unlock()
HAL_FLASHEx_OBProgram()
See for example https://github.com/STMicroelectronics/STM32CubeL4/tree/master/Projects/NUCLEO-L412KB/Examples/FLASH/FLASH_WriteProtection

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MadZoids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants