How to flash an STM32L081 using West Tools, OpenOCD and JLink
Hello,
I've made a custom board using the Zephyr SDK and a STM32L081 soc. I would like to flash my board using a JLink Debug prog with OpenOCD and GDB.
Compiling works fine but when it comes to using my openocd.cfg file as support for my board, I get this result
Info : Device: STM32L0xx (Cat.5)
Info : STM32L flash has dual banks. Bank (0) size is 96kb, base address is 0x8000000
Warn : target was in unknown state when halt was requested
Info : SWD DPIDR 0x0bc11477
Error: error writing to flash at address 0x08000000 at offset 0x00000000
auto erase enabledI attached the full output below.
I made the open ocd config file based on the one from the ST NUCLEO-L011K4 board.
source [find interface/jlink.cfg]
transport select swd
# source [find target/stm32l0.cfg]
source [find target/stm32l0_dual_bank.cfg]
# There is only system reset line and JTAG/SWD command can be issued when SRST
reset_config srst_only
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}I know the problem doesn't come from the hardware since I can launch a debug session with STM32CubeIDE and the same JLink probe without error.
Thank you for your help.
