arm-usb-ocd + linux STM32 flash erase/write takes two shots

Hi,

I’m using an Olimex arm-usb-ocd from a linux host.

I’m targeting an Olimex STM32H103

My openocd reports version

Open On-Chip Debugger 1.0 (2009-02-04-14:20) svn:1366

I’m using the open source FTDI library.

What’s going on is that when I do an ```
stm32x mass_erase 0

flash write_bank 0 filename 0


<LIST><LI>error executing stm32x flash write algorithm

flash writing failed with error code: 0xfffffc7a

error writing to flash at address 0x08000000 at offset 0x00000000 (-902)

called at file "command.c", line 456

called at file "embedded:startup.tcl", line 89

called at file "embedded:startup.tcl", line 93</LI></LIST>

The weird thing about this is, when I rerun the mass_erase and flash program command, it always succeeds on the 2nd try. I must always re-run the mass_erase command, not just retry the flash write.

If I simply run the mass_erase command twice before trying the flash write_bank, it still usually fails!

It's been pretty consistent like this. Just wondered if this is happening to anyone else, and if theres a fix or any information about it.

Thanks,

Alex

Hi,

Well, now it seems that I can just try the flash write_bank again, without having to do the stm32x mass_erase.

I’m pretty sure it was reliably requiring another mass_erase between the attempts yesterday. I’ve changed no settings, but my code size today is only around 5k compared to 8 and 20k before.

Alex

I have compiled the program for the same board in ubuntu and the exectution stops with the same msg as yours.what do you think i should do now?

Hi,

Sorry, I have no idea. I’ve been using the serial bootloader almost exclusively now.

You might check that you’ve got the most recent version of OpenOCD.

good luck,

Alex