Saturday, April 29, 2017

Installing OpenOCD on Windows WSL Ubuntu

While working on my OpenDPS Project I needed to use OpenOCD onw Windows. I cheated and used the one that came with VisualGDB running in a DOS Window:

from the \openocd\scripts directory:

C:\Users\gojimmypi\AppData\Local\VisualGDB\EmbeddedDebugPackages\com.sysprogs.arm.openocd\bin\openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg

but really, I want to have OpenOCD in Ubuntu.

So I downloaded it from https://launchpad.net/ubuntu/+source/openocd or specifically:

wget https://launchpad.net/ubuntu/+archive/primary/+files/openocd_0.9.0.orig.tar.gz

and unzipped it:

tar -xzvf openocd_0.9.0.orig.tar.gz 

There's an INSTALL file that gives basic instructions:

./configure
make
sudo make install

if you don't use "sudo" on that last command, you'll get this wonderfully intuitive error:


(ho - and people wonder why Windows is so popular.. but I digress...)

Now from the /openocd/scripts directory, this command:

openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg

or simply:

./run-openocd.sh

from the /openocd directory.

well, it does not find my ST-LINK, or any other USB devices. It seems WSL does not recognize any of my USB ports.

$ lsusb
unable to initialize libusb: -99

On to installing the toolchain in a Debian VM....


If there are problems, well there's

https://answers.launchpad.net/ubuntu/
https://github.com/Microsoft/BashOnWindows/issues/

1 comment:

  1. Run everything in WSL except openocd, that runs from the DOS prompt.

    ReplyDelete

comments are welcome, but I prefer not to allow links to promotions or other unrelated services.

Find gojimmypi at gojimmypi.github.io

I'm currently working on my new blog home at  gojimmypi.github.io After implementing a variety of features such as dark mode , syntax hi...