Skip to content
Juan Gonzalez-Gomez edited this page Apr 13, 2016 · 60 revisions

Libusb Cross-builder

Libusb is a C library that provides generic access to USB devices. It is multiplatform (Linux, OS X, Windows, Android, OpenBSD...)

The source code is located in this github repo

We will compiled it for differente archs (Windows machines, Linux 32 bits, Ubuntu Phone...) from a Linux computer. The package libusb-arch-x.tar.gz will be generated (as well as a program example for testing)

Cross-compiling the libusb library

It has been tested on a Ubuntu 15.10 machine

Follow these steps:

  • Install the git client (if you already do not have it):
$ sudo apt-get install git
  • Clone the libusb-cross-builder repo:
$ git clone https://github.com/FPGAwars/libusb-cross-builder.git
  • Enter into the libusb-cross-builder directory:
$ cd libusb-cross-builder
  • Depending on the target platform, execute the corresponding build script:
Platform Execute
Windows 64 bits $ bash build-windows_x86_64.sh
Windows 32 bits $ bash build-windows_i386.sh
Linux 32 bits $ bash build-linux_i686.sh
Ubuntu Phone $ bash build-ubuntu-phone_armhf.sh

After some time, the packages libusb-ARCH-x.tar.gz, libusb-ARCH-x.zip and listdevs-example-ARCH-x.zip will be generated in the package directory (where ARCH is the target platform and x the version)

For cleaning just execute the same script with the target clean at the end. Ex:

$ bash build-windows_x86_64.sh clean

Testing on Windows 7

Virtual Machine

Copy the listdevs.exe on the Windows 7 virtual machine (or a real one). Open the command line interface and execute the file:

When running on the virtual machine, the list of usb devices will be very small or even none

Real windows machine

This is another screenshot of the program executed on a real windows 7 (64 bits) machine (thanks to Pablo Clemente):

  • [2016/Feb/22] Reported by Carlos Díaz. It works in Windows 10 (64 bits). Thanks for testing!

  • [2016/Feb/26] Reported by Sebastian Gallardo. It works in Windows 7, 32 bits. Thanks for testing!

Icestick NOT connected

Icestick connected:

  • [2016/March/05] Reported by Eladio Delgado. It works in Windows 8 - 64 bits. Thanks for testing!

Testing on Ubuntu phone

Two FPGA boards connected to the Ubuntu phone (using an USB hub): an Icestick and an IceZUM Alhambra

What the listdev program shows:

Author

  • Juan González-Gómez (Obijuan)

Credits

  • Pablo Clemente (Paclema). Testing. Thanks!
  • Carlos Díaz. Testing. Thanks!
  • Sebastián Gallardo. Testing. Thanks!
  • Eladio Delgado. Testing. Thanks!

License

Licensed under Creative Commons Attribution-ShareAlike 4.0 International License