OpenOCD fails for STM32L152D

I downloaded OpenOCD v0.6.1 from Freddie Chopin’s website but am having issue with STM32L152D. I can successfully connect using the

/openocd-0.6.1/scripts/board/stm32ldiscovery.cfg file, but I am unable to successfully issue the commands to do a mass erase.

Issuing the command

flash probe 0

I get:

flash size = 6423kbytes
flash size = 6423kbytes
flash 'stm32lx' found at 0x08000000

So, the flash size is completely off (a bug perhaps??).

However, when I try

stm32lx mass_erase 0  <=== invalid command
stm32x mass_erase 0 <==== deprecated command

I am not sure where to go from here since I have to be able to erase the flash

to be able to load the file. Any idea?

This issue has been seen a couple of times, seems related to the flash size register on the stm32l being incorrect.

Could you enable the debug log and post here ?

Cheers

Spen