Skip to content

Getting Started: Windows

Rey Tucker edited this page Oct 16, 2017 · 57 revisions

Table of Contents

Using an Installer

Building from source

Warning

NOTE!!: This document is out-of-date... see host/README.md for more specific info, and also https://github.com/Nuand/bladeRF/issues/528 ... Visual Studio 2017 works just fine with the pthread modifications mentioned above.

Tools and Dependencies

Installing git for Windows

  1. Download and install msysgit. If you plan to submit patches to the bladeRF project, please select the Checkout as-is, commit Unix-style line endings option in the installer.
  2. Download and install tortoisegit.
For more information, see the mysysgit and tortoisegit wiki pages about their install procedures.

Installing Visual Studio Community 2017 for Windows Desktop

  1. Download Visual Studio Community 2017 for Windows Desktop from Microsoft, which can be found at https://www.visualstudio.com/downloads/
  2. Follow the installation instructions, including any post-install updates.
Note: Visual Studio Community 2017 is also known as Visual Studio 15.2.

Installing libusb

  1. Download the latest Windows binary release of libusb, which also include development headers. As of this writing, version 1.0.21 is the latest
    1. Note: you may need to download and install 7-zip from 7-zip.org to open this file.
  2. Extract the contents to a location of your choice. Make note of this location so that you can later provide it to CMake. The default configuration assumes that files will be in C:/Program Files (x86)/libusb-1.0.21 If you wish to change the directory, use the -DLIBUSB_PATH= option for CMake.
  3. Get the device driver installer (zadig): http://zadig.akeo.ie (older versions: http://sourceforge.net/projects/libwdi/files/zadig/)
  4. Open Zadig.
  5. If the bladeRF is not already listed in the dropdown box, go to Device->Create New Device, type a device name (i.e., "bladeRF") in the text box, and specify the VID/PID (2cf0/5246) in the USB ID fields.
  6. In the driver spinbox, select libusbK.
  7. Click "Install Driver"
  8. Open Device Manager. A new device called bladeRF should show up. If there is a yellow bang next to it in device manager:
    1. Right-click on the bladeRF entry and select "Update Driver Software...".
      1. Choose "Browse my computer for driver software"
      2. "Let me pick from a list of device drivers on my computer".
      3. Click "Have Disk..." and point it to the location that Zadig installed the driver to (C:\usb_driver).
      4. Select "bladeRF" and continue through the wizard.
  9. Device Manager should now show bladeRF under libusbK USB Devices.

Installing pthreads-win32

The pthreads library is required to build libbladeRF and its utilities. A few steps are required to install this pthreads implementation. See the pthreads-win32 website for more information.

  1. Download the latest release. Currently this is version 2.9.1.
  2. Extract the contents of the release zip.
  3. Copy the contents of the Pre-built.2 directory to C:\Program Files (x86)\pthreads-win32

pthreads-win32 patch and recompile

If you are using a newer version of Windows / Visual Studio and are getting error C0211: 'timespec': 'struct' type redefinition when trying to build bladeRF, you will need to rebuild pthreads-win32. The below process seems to work with pthreads-win32 2.9.1.

  1. Get full source tree from the pthreads-win32 website, and unpack someplace convenient
  2. In Visual Studio, open pthreads-w32-2-9-1-release\pthreads.2\pthread.dsw (if prompted, a one-way upgrade is OK)
  3. Right-click the solution, select "Retarget solution", hit OK.
  4. Change "Solution Configurations" dropdown to "Release" ("Debug" doesn't work, but that's OK)
  5. Edit pthread.h to add #define HAVE_STRUCT_TIMESPEC and #define PTW32_ARCHx64 near the top, just below the include guard
  6. Build the solution
  7. If you've already tried building bladeRF, CMake will need attention:
    1. File -> Delete Cache
    2. Redo the "Configure" dance as before
    3. Point LIBPTHREADSWIN32_PATH to the pthreads-w32-2-9-1-release\pthreads.2 directory you were just working in

Installing CMake

Download and install CMake for Windows: http://www.cmake.org/cmake/resources/software.html

Building with CMake and Visual Studio 2013

Cloning the bladeRF git repository

  1. Right click on the Desktop and click "Git clone..."
  2. Paste https://github.com/Nuand/bladeRF.git into the URL field
  3. Select your preferred directory to clone the repository to. TortoiseGit requires this to be an empty folder.
  4. Click OK and let it run. The bladeRF code is now on your computer.

Configuring with CMake

  1. Run the CMake GUI utility.
  2. Under "Where is the source code", browse to [preferred_directory]/bladeRF/host.
  3. Create a new directory, [preferred_directory]/bladeRF/host/build.
  4. Under "Where to build the binaries", browse to the newly created [preferred_directory]/bladeRF/host/build. Click the Configure button.
  5. Select your appropriate version of Visual Studio. For Visual Studio 2013, select "Visual Studio 12" or "Visual Studio 12 Win64". Select "Use default native compilers", then click "Finish". (TODO: Verify this setting with VS2017/15.2)
  6. If the configuration fails, double check the values for LIBUSB_PATH and LIBPTHREADSWIN32_PATH, and re-run the configuration.
  7. Click on the Generate button.
  8. A Visual Studio solution should now be available, host/build/bladeRF.sln

Compiling

  1. CMake has created a bladeRF.sln file. Open Visual Studio, and open this file.
  2. A number of projects should show up in the Solution Explorer, including:
    1. bladeRF-cli
    2. bladeRF-fsk
    3. libbladerf_shared
  3. Select Debug or Release build from the drop down menu at the top
  4. Run Build -> Build Solution
  5. After the build completes, you should see an host/build/output directory in the build directory, containing either a Debug or Release subdirectory. These directories will contain generated executables, libraries, and will contain copies of the required DLLs.

Verifying basic functionality

Open up a cmd.exe window and navigate to the output directory associated with your build:

C:\Users\jon\Documents\projects\bladeRF\host\build\host\output\Debug>dir

10/19/2013  05:36 PM           122,880 bladeRF-cli.exe
10/19/2013  05:36 PM           139,776 bladeRF.dll

... Snipped out some other items ...

10/19/2013  05:35 PM            92,160 libusb-1.0.dll
10/19/2013  05:35 PM            55,808 pthreadVC2.dll

Note the presence of the libusb-1.0.dll and pthreadVC2.dll in this directory. These are placed here so that the bladeRF-cli and other tests may be run from this directory.

From here, you can continue on with the Getting Started: Verifying Basic Device Operation wiki page. If you encounter any errors or warnings, please see the Troubleshooting guide.

Clone this wiki locally