Hi, the commit that changed the assembly helper is http://openocd.zylin.com/4036/ What you report as the "working" version is actually bugged. It uses Cortex-M3 assembly that causes errors on the Cortex-M0 (or M0+ ?) of STM32L031 Due to the assembly error, the code falls-back to a slow C implementation for flash write that in turn succeeds writing.
I don't know why the new assembly fails in your case. I don't have a stm32l0 for testing. As a quick workaround, disable the workarea! This will make it impossible to run the assembly and the code will fall-back to the same slow C implementation. E.g., if you are using the config file tcl/board/stm32l0discovery.cfg, edit it and change the line set WORKAREASIZE 0x2000 with set WORKAREASIZE 0 Regards, Antonio On Thu, Jun 17, 2021 at 2:53 PM ali tekin <alitekin...@gmail.com> wrote: > > Hello, I can't flash to STM32L031 with the version of openocd-0.10.0-3 and > later. I have checked the difference and I saw that flash write code was > changed with openocd-0.10.0-3. I think there is a problem with the new code. > It works when I change the hex array inside of the stm32lx.inc file acording > to the openocd-0.10.0. > > # Latest version of the stm32lx.inc file (Not working) > /* Autogenerated with ../../../../src/helper/bin2char.sh */ > 0x92,0x00,0x8a,0x18,0x01,0xe0,0x08,0xc9,0x08,0xc0,0x91,0x42,0xfb,0xd1,0x00,0xbe, > > # Here is the error output when I try to flash to the STM32L031 > ** Programming Started ** > Info : Device: STM32L0xx (Cat. 2) > Info : STM32L flash size is 32kb, base address is 0x8000000 > Warn : target was in unknown state when halt was requested > Info : SWD DPIDR 0x0bc11477 > Info : SWD DPIDR 0x0bc11477 > Error: error writing to flash at address 0x08000000 at offset 0x00000000 > ** Programming Failed ** > > # Latest version of the stm32lx.inc file (Working) > /* Autogenerated with ../../../../src/helper/bin2char.sh */ > 0x00,0x23,0x04,0xe0,0x51,0xf8,0x04,0xcb,0x40,0xf8,0x04,0xcb,0x01,0x33,0x93,0x42,0xf8,0xd3,0x00,0xbe > > # Here is the output when I try to flash to the STM32L031 with fixed hex array > ** Programming Started ** > Info : Device: STM32L0xx (Cat. 2) > Info : STM32L flash size is 32kb, base address is 0x8000000 > Error: stm32l0.cpu -- clearing lockup after double fault > Warn : Couldn't use loader, falling back to page memory writes > ** Programming Finished ** >