Skip to main content
ADEVL.1
Associate
January 8, 2020
Question

openOCD by STM

  • January 8, 2020
  • 10 replies
  • 9094 views

Hello,

Is there a version of openOCD compiled by STM which contains all the latest cards (notably the NUCLEO-G071RB) and is it possible to obtain the command generated by STM32CubeIDE configured with openOCD.

Because I would like to use another IDE (CLION) and I have relative difficulty in configuring openOCD.

Thank you.

Alexis

This topic has been closed for replies.

10 replies

KnarfB
Super User
January 8, 2020

openocd is installed as a plugin during STM32CubeIDE install. You could use that.

When I select openOCD in STM32CubeIde for debugging, the Windows Task-Manager tells the command line:

C:\ST\STM32CubeIDE_1.1.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.openocd.win32_1.1.0.201910081157\tools\bin\openocd.exe -f "Hello_STM32L432_NUCLEO Debug.cfg" -s C:/Users/live/STM32CubeIDE/workspace/Hello_STM32L432_NUCLEO -s C:/ST/STM32CubeIDE_1.1.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.debug_1.1.0.201910101207/resources/openocd/st_scripts -c "gdb_port 3333" -c "tcl_port 6666" -c "telnet_port 4444"

hth

KnarfB

ADEVL.1
ADEVL.1Author
Associate
January 8, 2020

I modified the command you give me, it seems to work,

/opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.linux64_1.1.0.201910081157/tools/bin/openocd -f /home/alexis/Documents/test/test/st_nucleo_g0.cfg -s /home/alexis/Documents/test/test/ -s /opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.debug_1.1.0.201910101207/resources/openocd/st_scripts -c "gdb_port 3333" -c "tcl_port 6666" -c "telnet_port 4444"

but I'm not sure that it downloads my program.

ADEVL.1
ADEVL.1Author
Associate
January 8, 2020

The command will allow me to advance a little more however I work on linux and I do not know if I can use the plugin.

Thank you so much.

There is no downloadable version of openOCD ?

KnarfB
Super User
January 8, 2020

Same under Linux, but use ps aux | grep ocd :

/opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.linux64_1.1.0.201910081157/tools/bin/openocd -f Hello_L432 Debug.cfg -s /home/frank/STM32CubeIDE/workspace_1.1.0/Hello_L432 -s /opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.debug_1.1.0.201910101207/resources/openocd/st_scripts -c gdb_port 3333 -c tcl_port 6666 -c telnet_port 4444

Andreas Bolsch
Lead III
January 8, 2020

I'm afraid you'll have to pick the relevant patches from http://openocd.zylin.com/#/q/status:open and (re-) build openocd for your platform.

E.g. for G0-series http://openocd.zylin.com/#/c/4807/.

ADEVL.1
ADEVL.1Author
Associate
January 8, 2020

I tried with another source but it doesn't seem to work, I'm going to try again, Thx

ADEVL.1
ADEVL.1Author
Associate
January 8, 2020

I tried with another source but it doesn't seem to work, I'm going to try again, Thx

ADEVL.1
ADEVL.1Author
Associate
January 8, 2020

ok it works using the plugin integrated in STM32CubeIDE and configure where is the library and projet generate by STM32CubeMX

/opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.externaltools.openocd.linux64_1.1.0.201910081157/tools/bin/openocd \
-f /home/$USER/Documents/test/test/st_nucleo_g0.cfg \
-s /home/$USER/Documents/test/test/ \
-s /opt/st/stm32cubeide_1.1.0/plugins/com.st.stm32cube.ide.mcu.debug_1.1.0.201910101207/resources/openocd/st_scripts \
-c "gdb_port 3333" -c "tcl_port 6666" -c "telnet_port 4444" \
-c "program \"/home/$USER/Documents/test/test/cmake-build-debug/test.elf\"" \
-c reset

Uwe Bonnes
Chief
January 8, 2020

BMP (Bl*ck M*g*c Debug probe) https://github.com/blacksphere/bl*ckmagic can be an alternative. Compiled via "make PROBE_HOST=pc-stlinkv2" you can run on an unmodified Stlinkv2 with recent firmware. You either start the resulting executable and connect to port :2000 to debug or you can do some flash modifications on the command line. E.g. "bl*ckm*g*ic_stlinkv2 bla.bin" loads the binary to 0x08000000". Look with -h for more options.

Dominik Lorych
Associate III
January 14, 2020

Hi,

for everyone using Windows, there is a precompiled openocd for windows on https://gnutoolchains.com/arm-eabi/openocd/ which includes files for the Nucleo G0 (working for me with the Nucleo-G071RB).

ADEVL.1
ADEVL.1Author
Associate
January 15, 2020

I use Linux, but thanks, for the other projects it will be really useful.

KnarfB
Super User
January 15, 2020
ADEVL.1
ADEVL.1Author
Associate
January 15, 2020

Thank you,

but I do not believe that this deposit allows you to receive the NUCLEO-G071RB card (or others G0 MCUs).

turboscrew
Senior III
January 16, 2020

Doesn't any openOCD do? You just need to have the configuration files for the board (chip + interface). See ...openocd/scripts/...

Eclipse is written in Java and it doesn't matter on which OS you run it.

I think Eclipse has a plugin (gnu-mcu-eclipse) that needs to be installed...

the "-f" swithes need to be added to tell the openOCD which configuration files you use.

I'm using Linux (Mint and Debian), but I don't have the development environment installed on this computer I'm using now, so can't check.

https://elinux.org/OpenOCD_Config_File_Paths

Andreas Bolsch
Lead III
January 16, 2020

You need the flash driver for the particular family and device. Although the flash module for the G0 and the L4 are quite similar, they're not identical. And each and every device has its subtypes, each of which in turn has its own odds. Moreover: the L4 core instructions set is a superset of that for the G0, so a "downgrade" of the flash loader is necessary ... The configuration files are only the cake's topping.

turboscrew
Senior III
January 17, 2020

Funny, how I've been using just Linux, Eclipse, OpenOCD and ST-link mini to play with "blue pill"...

Well, the ST-link (mini) requires the right (Linux) USB-driver.

https://github.com/ntfreak/openocd/blob/master/tcl/target/stm32f1x.cfg

Note that J-TAG or SWD access the system through the processor (the debug-HW).

turboscrew
Senior III
January 17, 2020

Maybe this is of help?

https://gnu-mcu-eclipse.github.io/debug/openocd/

Note that there are new pages, where, you can get a newer precompiled OpenOCD.