STM32 boot option bytes


I have a board where I am using the STM32G051.

I have code running on the eval board. When I work in the target, I get a hard fault.

I think it is since I have not tied the BOOT0 pin down, and I am using SWCLK on the same pin (PA14).

In a google search this is mentioned:

I am using STM32cube IDE. Anyone know how to set the Option bytes to run from flash and ignore the BOOT0 pin?



1 Like

Section 2.5 references FLASH_SECR register


Take a look at section 3.7.21

if you’d like to use the HAL driver:

Many thanks for the help, Manny.

I eventually found that the hard fault was due to something else than the option bytes.

Hi Klaus,
What was it? RCC initialization issue?


Accessing a peripheral that did not exist, it seems. Downgraded the project to a smaller controller, and it worked (could also be a memory issue)