2020-05-22 10:56 AM
I'm trying to debug an error I get when I try to flash internal flash on my stm32f4 board. I first use the flash_erase command to do a mass erase using openocd:
flash erase_address unlock 0x08000000 0x100000
Then use the flash_write command to flash the binary:
flash write_image erase my_app.elf
I get intermittent errors with messages such as:
Info : device id = 0x30006441
Info : flash size = 1024kbytes
Error: flash write algorithm aborted by target
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0x0800053e msp: 0x2001dbf8
Error: error executing stm32x flash write algorithm
Error: error writing to flash at address 0x08000000 at offset 0x0000c000
Error: flash write algorithm aborted by target
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0xa1000003 pc: 0x0800c386 msp: 0x20011ca0
Error: error executing stm32x flash write algorithm
Error: flash memory write protected
Error: flash write failed = 000000b0
Error: error writing to flash at address 0x08000000 at offset 0x0000c000
It turns out that the program gets stuck in the window watchdog, at-least in the second case where the pc is 0x0800c386. the symbol at that location is "WWDG_irq + 22 in section .text"
I'm unsure how it got set. May be it is not the root cause. But I only observe this after I mass erase the flash. Any ideas to further debug this?