Skip to main content
Visitor II
August 12, 2021
Solved

[SOLVED] Crash if BOOT0 pin is high

  • August 12, 2021
  • 2 replies
  • 2482 views

Hello Dear Experts,

I have strange behavior on my STM3210 board.

I flash my binary using STLink and it works well.

Then I toggle BOOT0 pin in order to use the standard bootloader in the system memory and I reset the system.

The bootloader starts and listens UART.

I send the "GO" command over UART from the CubeProgrammer app (no flashing/reading, only "GO" command).

In debugger I see that it jumps to the main() function as expected.

BUT after calling a few functions it crashes somewhere and the PC register becomes "0x1fffeade".

If I disable the BOOT0 pin and restart - everything works well again.

I've no idea how to debug that, please help.

Thank you.

UPD: Thanks to @Community member​ just realized that "0x1fffeade" address is in the system memory region => Looks like the "crash" is actually "restart".

By why does it restart?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    >>I don't enable it in my code.

    But your code isn't starting the device is it? If you inherit the watchdog, you're going to have to keep kicking it otherwise the CPU will restart and reenter the ROM based on the BOOT0 pin state.

    >>..and is not disabled automatically?

    As I understand the functionality you specifically CAN'T disable it

    Make sure you get SCB->VTOR set early in your code, the ROM is mapped at zero, the default for SCB->VTOR is zero, and you want it pointing at FLASH at 0x08000000

    >>STM3210 board

    ?? One of the early series F103 EVAL boards (C, D, E..)

    2 replies

    Graduate II
    August 12, 2021

    Might need to kick the watchdog

    winotixAuthor
    Visitor II
    August 12, 2021

    Do you mean the IWDG? I don't enable it in my code.

    Or is there another watchdog that is activated for the bootloader and is not disabled automatically?

    In the doc I see the following

    0693W00000D2LbEQAV.png

    Graduate II
    August 12, 2021

    >>I don't enable it in my code.

    But your code isn't starting the device is it? If you inherit the watchdog, you're going to have to keep kicking it otherwise the CPU will restart and reenter the ROM based on the BOOT0 pin state.

    >>..and is not disabled automatically?

    As I understand the functionality you specifically CAN'T disable it

    Make sure you get SCB->VTOR set early in your code, the ROM is mapped at zero, the default for SCB->VTOR is zero, and you want it pointing at FLASH at 0x08000000

    >>STM3210 board

    ?? One of the early series F103 EVAL boards (C, D, E..)

    winotixAuthor
    Visitor II
    August 12, 2021

    Thanks a lot @Community member​ !

    Fixed by enabling the USER_VECT_TAB_ADDRESS that forces initialization of SCB->VTOR with the base FLASH address in SystemInit() function.