1

I'm searching a way to exit from bootloader after having successfully programmed my flash. Is it possible to jump to the flash program holding the boot0 pin always high? I have done some attempts using STM32_Programmer_CLI.exe specifying the start address (option -s from command line) of my ResetHandler function which is in flash at address 0x8000970. It seems that this doesn't work and it needs to switch boot0 pin at a low level to make it works.

Just to explain my setup: I'm using the STM32_Programmer_CLI.exe program as following:

STM32_Programmer_CLI.exe -c port=USB1 -w myprog.bin 0x8000000 -s 0x8000970

Do you have some suggests? Thank you!

  • there would need to be a feature in the bootloader, did you extract the bootloader commands (the st bootloader has a command to list the supported commands) and from that list do any of them solve this problem? otherwise you have to use an swd debugger, or you need to change the boot pins and reset. – old_timer Jul 19 '21 at 13:29
  • Thank you old_timer! I finally understood what I was doing wrong. First error was with the start address: it needs to specify the first location of the interrupt vector table. So the correct address was 0x8000000. The CLI take the 0x8000004 address to get the address where to jump. 2nd problem was to understand why my flash program crashed quite immediately. it needed to decomment in the system_stm32g4xx.c the following define: #define USER_VECT_TAB_ADDRESS otherwise the pointer to the interrupt vector table (SCB->VTOR) keeps pointing to the bootloader interrupt vector table. – Franco Valma Jul 20 '21 at 09:55
  • yes these are known things but as written not sure how any of us would have known this was where your problem was... – old_timer Jul 20 '21 at 10:59
  • Technically the core reads from 0x00000000, 0x00000004, the chip mirrors that from the flash in a certain boot mode (boot pins), then if properly written the code is linked for 0x08000000, which gives a 0x0800xxxx result for the 0x00000004 read. and then it executes from that 0x08000000 space – old_timer Jul 20 '21 at 11:00

0 Answers0