Is there an app note on the debugger interaction with the option bytes?
I am trying to figure out how the debugger interacts with the option bytes, or seems to.
I am using the STM32G030C6 and have included programming the option bytes into the source code and linker file. This is in one of my source files:
const uint32_t __attribute__((section (".option_bytes")))
OPTION_BYTES[10] __attribute__((used))
= { 0xDFFE81AA, 0x20017E55,
0xFFFFFFFF, 0x00000000,
0x00FF0000, 0xFF00FFFF,
0xFF00FF3F, 0x00FF00C0,
0xFF00FF3F, 0x00FF00C0};and these are in the linker file:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 28K
OPTION (r) : ORIGIN = 0x1FFF7800, LENGTH = 40
}
SECTIONS
{
...
.option_bytes :
{
. = ALIGN(8);
KEEP(*(.option_bytes))
. = ALIGN(8);
} >OPTIONWhat I am finding is that when I run the debugger, the flash memory locations show the default values for the option bytes and the FLASH option register (FLASH_OPTR) also shows the defaults but the code acts erratically. I changed the defaults so the IWDG is set to hardware and reset should be generated for standby and stop modes.
But if I download this file with STM32CubeIDE and look at the flash memory locations for the option bytes, the values I set in my source code are there. The unit seems to run fine but I have only gotten into this today.
So, it seems the debugger is overriding the values I am setting in my source code but I am getting erratic behavior. As the question states, is there a app note that address this?
Thanks,
