Skip to main content
Visitor
October 16, 2026
Question

STM32G0B1RCTb Prefetch failure when branching across flash memory banks

Hi everyone, 

I am encountering an issue with the STM32G0B1RCTB microcontroller, specifically related to the "errata" concerning its dual-bank memory architecture.

My project uses firmware structured as follows: a bootloader located at the beginning of the flash (0x08000000), an application located at 0x08006000, and a CRC data section—generated during the post-build process to ensure firmware integrity—placed at the end of the flash (0x0803F000).

I need to keep the prefetch feature enabled; however, due to a known issue inherent to this microcontroller, the system crashes once the firmware exceeds a certain size.

To resolve this, I decided to modify the option bytes to set the device to "single-bank" mode, which would allow me to keep the prefetch feature enabled.

However, when the microcontroller resets (triggered by `FLASH->CR |= FLASH_CR_OBL_LAUNCH;`) to apply the new option bytes, the bootloader executes correctly (as it is located at the start of the flash), but the jump to the application fails, leaving the system stuck in an unused memory region. It does not trigger a "Hard Fault." I suspect this occurs because the microcontroller’s default state is "dual-bank" mode, which changes how the flash memory is mapped and interpreted.

Could you suggest a way to resolve this? Unfortunately, the project is at a very advanced stage, and I cannot switch to a different microcontroller family.

Thank you in advance for your help;