cancel
Showing results for 
Search instead for 
Did you mean: 

Reset after flashing emtpy STM32G041 always jumps to bootloader instead of application, until power-cycle.

CLieb.1
Associate

When an empty STM32G041 (others may have the same problem, couldn'T test) is flashed with an application, an real power-cylce is needed to actually start the application. Until this power-cycle, ever reset (HW or SW) will jump to the bootloader.

After a power-cycle each an every reset will jump to the application.

This can be reproduced with Erase-All and then PowerCycling.

When starting a debug-session, application is called (by the debugger?), but the VTOR-Reg points still to 0x1FFFxxxx causing a freeze on the first IRQ (i.e. SysTick).

Tested with CubeIDE and IAR, aswell as with a JLINK and a STLINK/v2.

Any comments/solutions/help?

Thanks and regards!

2 REPLIES 2
TDK
Guru

Working as intended. You can launch option bytes to reset the "empty flash" flag. Otherwise, need to do a reset power cycle.

https://community.st.com/s/article/Empty-check-mechanism-on-SMT32

If you feel a post has answered your question, please click "Accept as Solution".

Yes, this is a known behaviour.

It goes to ease of programming blank devices in newly manufactured boards, and a means of protecting against glitching and other mechanisms to break device security.

Your code can set the VTOR / memory mapping in the Reset_Handler, supposed also to be doing it in SystemInit() if following proper CMSIS guidelines any way.

ST in the past has had code snippets in startup.s for some CM0 parts, where VTOR isn't implemented, and they enable the SYSCFG clock, and set the FLASH mapping.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..