OpenOCD compiles with no debug interfaces?

I’m attempting to build the latest OpenOCD under linux. I’ve checked out the source from sourceforge and am running the usual workflow:

./bootstrap
./configure --prefix=/usr --enable-maintainer-mode --enable-stlink
make 
sudo make install

I’ve enabled the stlink interface explicitly because that’s the interface I’m using (the stm32f0 discovery board)

When I attempt to run openocd using the stm32f0discovery.cfg that is provided in the boards directory, I get this:

Open On-Chip Debugger 0.6.0-dev-00599-ga21affa (2012-06-08-22:07)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: The specified debug interface was not found (stlink)
The following debug interfaces are available:
Runtime Error: /usr/local/share/openocd/scripts/interface/stlink-v2.cfg:5: 
in procedure 'script' 
at file "embedded:startup.tcl", line 58
at file "stm32f0discovery.cfg", line 4
in procedure 'interface' called at file "/usr/local/share/openocd/scripts/interface/stlink-v2.cfg", line 5

Does that mean that I didn’t get any debug interfaces compiled in? I thought a bunch of them were enabled by default, and if not, I at least enabled the stlink. Why is the list of interfaces empty, and more importantly, why can’t it find the one for my stlink? I am under the impression that this error means that the interface requested wasn’t compiled in, but I checked over the configure files and the logs, and it looks like at least the makefiles were generated for the stlink subtree, so I’m sort of confused.

Appreciative of any help I can get!

Hi,

According to my experience, if u want to use a particular adapter, then u have to specify or enable openocd for adapter.

example : i have configured buspirate board using follwoing command for configure

$ ./configure --enable-buspirate --enable-maintainer-mode

when u installing u have to enable the adaapter.Thanks.

Nuwan

That looks a lot like the config I recently used, which worked fine.

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by openocd configure 0.6.0-dev, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  $ ./configure --prefix=/home/hfs2/local --program-suffix=-060 --enable-ft2232_libftdi --enable-rlink --enable-stlink

I didn’t --enable-maintainer-mode, but it doesn’t sound as if Nuwan found any bugs with that. (I put it in ~/local/ because I didn’t want to mess up my 0.5.0 install.)

I believe Nuwan is correct that you have to specify any interfaces you need when you ./configure. Not sure how it behaves if you just make without bothering to configure.

I am enabling the adapter I want though when I configure, with the --enable-stlink … or at least I should be. The output of the configure script seems to acknowledge my choice, but still, I don’t seem to get a working configuration once everything is built. Still a mystery to me…

Yeah, that is bizarre and mysterious. I uploaded my entire build directory to

http://www.overtracks.com/sos/20120709/openocd.tar.bz2 (31MB)

You might be able to compare config files or some such and figure something out.

ryansturmer:
I am enabling the adapter I want though when I configure, with the --enable-stlink … or at least I should be. The output of the configure script seems to acknowledge my choice, but still, I don’t seem to get a working configuration once everything is built. Still a mystery to me…

very strange indeed.

can you upload your build config.log ?

Cheers

Spen

I’m also having exactly the same problem: the stlink interface doesn’t seem to be compiled in to my openocd build.

My difference to OP’s situation is that I’m just using a standard macports build of openocd, because I didn’t think I’d have to opt-in to support a common controller like the st-link. (plus I don’t know how to modify the configure of a port install … though i presume it’s possible?)

The interface_list command lists only the ft2232 interface, which I don’t think is compatible with the st-link.

I’m very motivated to sort this out, but I’m at a bit of a loss as to how to proceed. I’m about to try re-config-build the openocd macport with –enable-stlink config, but OP makes me wonder if it would be worth it… Any other ideas?

Sorry to somewhat hijack this post to bring macports into the fold, but I figure it might help someone else in a similar position.

So I added an stlink “variant” to my openocd Portfile, in order to add the –enable-stlink configure argument for the build:

variant stlink description {Enable building support for the STM ST-LINK programmer} {
    configure.args-append --enable-stlink
}

Then I installed openocd with:

sudo port install openocd +stlink +dummy

But the interfaces list (openocd -c “interface_list”) only contains ft2232 and dummy interfaces!

Digging into the config script in the actual openocd src tar file, I see no mention of the enable-stlink option, although there are plenty of references to other interfaces (dummy, jlink, etc). Further, in the src/jtag/drivers dir there’s no stlink.c file, which I’d expect to exist, given the naming convention in that directory…

Has stlink support ever been in the mainline openocd? Perhaps 0.5.0 has ripped it out for some reason, or it got accidentally dropped in a flurry of merges? :o

It looks as though openocd 0.6.0 contains code for driving an stlink, and it seems likely that it’s been added after 0.5.0 was released.

Hello aaaidan,

You’re right - 0.6.0 is the first version to support st-link, whether mac, windows, or linux. ST-link has been a proprietary interface, and now it… Well, I don’t know. I guess it has a sort of weird quasi-proprietary status. AFAIK, no official documentation on the interface has been released, but my understanding is that this [GDB client was created by members of the ST MCU applications team. I’m not sure what the licensing agreement is with the OpenOCD project.](GitHub - stlink-org/stlink: Open source STM32 MCU programming toolset)

Right, cheers for the reply! I figured it was probably proprietary in the end by its lack of support in open tools like openocd!

So I think I’ve managed to completely derail this post then, as OP was using an 0.6.0 build! No idea what his troubles were caused by, but I’ve managed to get stlink support by building the latest openocd source.

Ryan,

Have you come across a solution yet? I am having the same problem. When I compiled OpenOCD 0.6.0 (the exact version listed in my openocd is 0.6.0-dev-00626-g10fd274 (2012-07-23-17:14)), I ran the following configuration:

./configure --enable-maintainer-mode --disable-werror --enable-ft2232_ftd2xx **--enable-stlink** --with-ftd2xx-win32-zipdir=../../ftd2xx --build=i686-pc-cygwin --host=i686-pc-mingw32

As per the instructions at (http://www.tincantools.com/wiki/Compili … _Win7_D2XX), but with ‘–enable-stlink’ added. I’m using an ST-LINK/V2, but I couldn’t find a V2 specific option anywhere in the configuration script.

When I run:

openocd -f C:\openocd-0.6.0_pre\board\stm32f4discovery.cfg

I get the following output:

C:\openocd-0.6.0_pre>openocd -f C:\openocd-0.6.0_pre\board\stm32f4discovery.cfg
Open On-Chip Debugger 0.6.0-dev-00626-g10fd274 (2012-07-23-17:14)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: The specified debug interface was not found (stlink)
The following debug interfaces are available:
1: ft2232
Runtime Error: interface/stlink-v2.cfg:5:
in procedure 'script'
at file "embedded:startup.tcl", line 58
at file "C:\openocd-0.6.0_pre\board\stm32f4discovery.cfg", line 4
in procedure 'interface' called at file "interface/stlink-v2.cfg", line 5

I’m on windows 7, and I’m using the ST-LINK/V2 that came on my STM32F4Discovery board. I can use the ST-LINK/V2 directly from CooCox CoIDE, as well as the ST-LINK utility from ST. I also have an Olimex ARM-USB-TINY but it was unplugged at the time (not sure why OpenOCD listed the ‘1: ft2232’).

I initially built openocd without the --enable-stlink, as I was just following the instructions in the link I mentioned. I then rebuild with the --enable-stlink when I couldn’t connect to my discovery board. I did not take any steps to delete any of the build files before rebuilding. Is it possible this caused problems? Do you know if there an easy way to do a ‘clean build’ in cygwin?

Let me know if you ever resolved this,

-Liam