2025-09-15 12:12 AM
Hello,
I am working on custom bootloader + application setup on a STM32G070CBT6
Currently, I need to store bootloader flag that indicate whether the MCU should jump to the bootloader code or to the application code.
My questions are:
1. Can I use Option Bytes memory area to store the custom flag?
2. If Option Bytes memory area are not suitable ,is there another small memory area(apart from flash)
that is recommended for storing such a small boot flag?
I need only one bit for this flag, but dedicating a full 2KB flash feel inefficient.
2025-09-15 3:46 AM
Thanks, that’s a good point. In my case, I need the bootloader flag to survive a full power cycle as well, not just a reset.
2025-09-15 3:51 AM
@bhagat wrote:
Thanks, that’s a good point. In my case, I need the bootloader flag to survive a full power cycle as well, not just a reset.
Along the discussion, you didn't mention any case the Power Cycle, you mentioned only Reset. Which make a big difference here.
Next time, please be more accurate in the description to avoid unnecessary ping pongs.
Thank you.
2025-09-15 4:08 AM
Apologies for not being precise in my initial description. Thank you for highlighting the distinction between reset and power cycle.
2025-09-15 4:12 AM - edited 2025-09-15 4:13 AM
> Along the discussion, you didn't mention any case the Power Cycle, you mentioned only Reset. Which make a big difference here.
Yes, exactly. This is a totally different issue.
Except for your very much disliked Flash/EEPROM option you have two alternatives, unless you consider another MCU. But both involve additiona hardware.
One option is a backup battery, and to utilize a RAM / registers in the backup area of the MCU.
The second one is external NVM, like serial EEPROM or Flash via I2C or SPI, or FRAM.
My company mostly uses the second option, since the respective controller/ECU board is just a small component in a larger system, and this system needs persistent settings anyway.
Consider keeping your EEPROM/Flash method, and add some further persistent data.
2025-09-15 4:51 AM
> @bhagat only said it needs to survive reset:
From all he said I had a good guess that it was not so! :D