SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By newly-embedded
#194987
New user here. Much searching/reading/experimenting.

Have ST "STML4 Discovery kit for STM32L476 MCU" board and Linux system. Can connect to board over USB using https://github.com/texane/stlink code but having GDB problems and not sure if working correctly. Would like to try OpenOCD.

Have built https://sourceforge.net/projects/openoc ... cd/0.10.0/ but can't connect using those .cfg files. Closest was:
Code: Select all
$ openocd \
>   -s /usr/local/share/openocd/scripts \
>   -f board/stm32ldiscovery.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 300 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : clock speed 240 kHz
Error: open failed
in procedure 'init' 
in procedure 'ocd_bouncer'
Found https://github.com/arduino/OpenOCD/blob ... covery.cfg which has:
Code: Select all
$ diff scripts/board/stm32ldiscovery.cfg  site/scripts/board/stm32l4discovery.cfg 
1,2c1,5
< # This is an STM32L discovery board with a single STM32L152RBT6 chip.
< # http://www.st.com/internet/evalboard/product/250990.jsp
---
> # Explicitly for the STM32L476 discovery board:
> # http://www.st.com/web/en/catalog/tools/PF261635
> # but perfectly functional for any other STM32L4 board connected via
> # an stlink-v2-1 interface.
> # This is for STM32L4 boards that are connected via stlink-v2-1.
4c7
< source [find interface/stlink-v2.cfg]
---
> source [find interface/stlink-v2-1.cfg]
8,9c11
< set WORKAREASIZE 0x4000
< source [find target/stm32l1.cfg]
---
> source [find target/stm32l4x.cfg]
So using v2.1 and 32l4x which I suspect are closer matches to the hardware. That seems to get further, but still fails:
Code: Select all
$ openocd \
>   -s /usr/local/share/openocd/site/scripts \
>   -s /usr/local/share/openocd/scripts \
>   -f board/stm32l4discovery.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : clock speed 480 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v11 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.242133
Error: init mode failed (unable to connect to the target)
in procedure 'init' 
in procedure 'ocd_bouncer'
And suggestions -- including "Buy a SparkFun board" ;) -- welcome.