Trying to load program into HiFive1 from Linux FreedomStudio

Hi, I’m unable to load a program into my new HiFive1, using OpenOCD and FreedomStudio on Ubuntu 17.04. When I try to launch the Debug session, OpenOCD fails with code (127) and refers me to the openocd console.
The console says:
/home/bruce/Documents/RISC-V/FreedomStudio/SiFive/riscv-openocd-20170612-x86_64-linux-centos6/bin/openocd: error while loading shared libraries: libusb-0.1.so.4: cannot open shared object file: No such file or directory

Does this error mean openOCD can’t find a libusb shared library, or that openOCD can’t find the object file supposedly built with Eclipse?

“make upload” also fails, even as sudo. But I would like to get openOCD from Eclipse working.

I can start ‘screen’ and see the SiFive logo, so the USB serial connection is working OK. And I can build a program in Eclipse so I think that install went OK. I used an older version of Eclipse a long time ago when we were doing a lot of embedded Java development so I’m comfortable with Eclipse. I have no experience with openOCD. Yet.

In FreedomStudio/SiFive/Misc is a file sifive-freedom-e300-hifive1.cfg - but is has nothing about libusb. I looked in that folder since that is where libusb drivers are in the Windows install.

There’s no mention of libusb with Linux in the SiFive Freedom Studio Manual v1p1. How am I supposed to install and setup libusb with Linux, so that FreedomStudio can access it? I’m new to Linux so please be gentle.

Thanks in advance. In the meantime I will have a go with a Windows 10 machine: update I was able to get a build and debug perspective to open on Windows… still stuck on Linux.

Update: I have libusb-1.0.21 installed:

bruce@ASUS-UN62:~$ dpkg -l libusb-1.0*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                     Version           Architecture      Description
+++-========================-=================-=================-=====================================================
ii  libusb-1.0-0:amd64       2:1.0.21-1        amd64             userspace USB programming library

I built the program again and got no errors:

21:36:21 **** Incremental Build of configuration Debug for project led_fade ****
make all 
Invoking: GNU RISC-V Cross Print Size
riscv64-unknown-elf-size --format=berkeley "led_fade.elf"
   text	   data	    bss	    dec	    hex	filename
   5666	   1072	   2052	   8790	   2256	led_fade.elf
Finished building: led_fade.siz
21:36:21 Build Finished (took 68ms)

but did get four warnings, such as:
Description Resource Path Location Type
Invalid project path: Include path not found (/home/bruce/Documents/RISC-V/freedom-e-sdk/FreedomStudio/HiFive1/led_fade/bsp/drivers).
I’m using the examples in the freedom-e-sdk folder, not from the ZIP file in FreedomStudio and indeed the files that exist are under led_fade/Debug, so maybe that is my problem.

How did you install OpenOCD? What version are you using?

Just using the OpenOCD which comes with FreedomStudio, configured with eclipse per the instructions in FreedomStudio_Manual.v1p1.pdf

Can you try installing the older libusb package?

sudo apt-get install libusb-0.1-4

That makes a positive difference. Now (within FreedomStudio) I can load the led_fade program and open a debug perspective. The board needed a hardware reset button in order to actually execute the program. And I still get these four warnings:

Glad to hear things are working.

The include paths are safe to ignore. See this thread for details: