3

I'm trying to use OpenOCD together with my ST discovery board, following this tutorial: https://japaric.github.io/discovery/README.html. When verifying the OpenOCD installation I get the following error:

output of command

I've tried providing absolute paths to all files, it does not work. I also tried using the script files found in the scripts/board folder. They showed similar issues, the files cannot be found. Any pointers on solving this would be great.

My host computer is running Windows 10.

Simon Carlson
  • 1,919
  • 5
  • 24
  • 35
  • What's the directory you've installed OpenOCD to? Seems that you're using bash for Win10. What does `which openocd` print? – Kirill Dmitrenko Oct 10 '17 at 18:41
  • Im using cygwin, and OpenOCD is under C:\OpenOCD. In my path I have C:\OpenOCD\bin. However `which openocd` shows `/cygdrive/c/OpenOCD/bin/openocd`. So I guess the command should be `openocd -s \cygdrive\c\OpenOCD\share\openocd\scripts`? – Simon Carlson Oct 10 '17 at 18:44
  • Yep, but with forward slashes: `openocd -s /cygdrive/c/OpenOCD/share/openocd/scripts` – Kirill Dmitrenko Oct 10 '17 at 18:46
  • `$ openocd -s /cygdrive/c/OpenOCD/share/openocd/scripts -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg Open On-Chip Debugger 0.9.0 (2015-08-15-12:41) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html embedded:startup.tcl:60: Error: Can't find interface/stlink-v2-1.cfg in procedure 'script' at file "embedded:startup.tcl", line 60` – Simon Carlson Oct 10 '17 at 18:49
  • @KirillDmitrenko seems to be the exact same error message as in the original question. Do I need to change the paths after the -f somehow? – Simon Carlson Oct 10 '17 at 18:51
  • Let's get simplest theories out of the way: what does `file /cygdrive/c/OpenOCD/share/openocd/scripts/interface/stlink-v2-1.cfg` print? – Kirill Dmitrenko Oct 11 '17 at 12:48
  • @KirillDmitrenko it prints `ASCII text`. I have found a solution though, if I ´cd´ to the scripts folder before executing the command it successfully finds the files. I'll post it as an answer. Thank you for helping out. – Simon Carlson Oct 11 '17 at 15:30

2 Answers2

0

cd to /cygdrive/c/OpenOCD/share/openocd/scripts and then execute openocd -f file1 -f file2.

Alternatively, command shown in the picture of the question seems to work in the normal windows command prompt no matter the current working directory.

Simon Carlson
  • 1,919
  • 5
  • 24
  • 35
0

I had exactly same error. I solved it by specifying the path of the scripts. It can be done either by adding the openocd into your Path or by launching openocd from the scripts folder and providing the .cfg files with relative paths.

openocd -f ../../../interface/stlink.cfg -f ../../../board/stm32f429discovery.cfg

If you want to use openocd and gdb with vs-code then you can checkout my github-gist