Squashed commit of the following:
commit 4012eb78bb37d4e6e6f5607f5221d888b188c1a9
Merge: c174c7b47 fc968d9d6
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Thu Jul 20 12:55:59 2017 -0400
Merge branch 'rtucker-host-fixups'
commit fc968d9d61c3aa4dcd16294de5d8f1c038bf7dcc
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 17:04:06 2017 -0400
bladeRF-cli/printset: add support for bladerf2 GPIOs
commit 259fed535ab8db6a5ca2aca28f191eff107d0ea3
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 17:03:46 2017 -0400
bladeRF-cli/printset: frequency cleanup/consistency
commit 1b2b6c128b9a5385b4eb3f0ff34b494bef6a6036
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 17:02:52 2017 -0400
bladeRF-cli/printset: bandwidth refactor/consistency
commit 4eb522a147318ac3ea13f395bfa2128b24f18945
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 16:12:53 2017 -0400
bladeRF-cli/printset: add semicolons to PRINTSET_DECLs
This is really minor, but it helps with syntax highlighting in editors.
commit 8c0ad320db764f25f5234208f6347e043c0196cc
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 16:11:20 2017 -0400
bladeRF-cli/printset: refactor set_samplerate
commit d7574425755d2e730bec84ac04ee1adf8c5d2312
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 15:10:49 2017 -0400
bladeRF-cli/printset: formatting/consistency cleanup
commit 69fa2b570966b71021239860f6592f007bc788db
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 13:58:45 2017 -0400
bladeRF-cli/printset: create *err alias ptr
This is not strictly necessary, but it cleans up the code a bit and lets
clang-format do its thing w/r/t lining up assignment operators.
commit d06368768ae7ae95b653161494a7538f913b5857
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 13:53:03 2017 -0400
bladeRF-cli/printset: modules -> channels
migrate from modules to channels
also do some incremental formatting/consistency tweaks
commit cbb6ed92ed6be329d229958a0daef0bb5782c3f0
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 13:27:47 2017 -0400
bladeRF-cli: print/set loopback: add AD9361 BIST
commit 6740ff9a8d9760e48109bdc03d38d38e5564b34c
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 13:24:14 2017 -0400
bladeRF-cli: refactor 'set frequency'
commit 18b6bcf2abbb1423557352057a22419252e5d1ef
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 13:10:44 2017 -0400
bladeRF-cli: fix and refactor 'set bandwidth'
Query the specific range permitted by the hardware
DRY the BW changing/printing code
commit 94730399669e8f7208a46d7e2e5d17c034a00430
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 12:16:01 2017 -0400
cli/printset: fix 'set frequency' command
Use the bladerf_get_frequency_range function, use str2uint64_suffix to
be explicit about wanting uint64 freqs
commit 2d9fffbd264add78eee83005047b88275811da10
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 11:51:21 2017 -0400
bladerf2: fix TX frequency range
Turns out that libad9361 does bounds-checking on the frequency, and it
silently enforces 70e6 <= f <= 6000e6.
commit 4494a734542aeab2602ec9abe1f8522e19262e51
Author: Ryan Tucker <ryan.tucker@nuand.com>
Date: Mon Jul 17 11:50:38 2017 -0400
bladerf2: improve commenting on macros
|
||
|---|---|---|
| .. | ||
| cmake | ||
| common | ||
| drivers | ||
| examples | ||
| libraries | ||
| misc | ||
| utilities | ||
| CMakeLists.txt | ||
| README.md | ||
bladeRF Host Source
This directory contains the items outlined in the following table. Note that this structure includes some items planned for future development.
| Directory | Description |
|---|---|
| cmake | CMake scripts and modules |
| drivers | Device drivers for supported operating systems |
| libraries | The main bladeRF support library and supplemental libraries |
| misc | Miscellaneous files |
| utilities | Applications and tools |
Dependencies
libusb
libusb and its development headers are required. >= v1.0.16 is recommended for Linux, and >= v1.0.19 is recommended for Windows.
Ideally, the latest released version is always recommended. Please see the libusb ChangeLog for more information.
(Optional) FX3 SDK - Windows-only
Windows users that wish to use a Cypress driver/library based libbladeRF backend will need to download and install the Cypress FX3 SDK.
CMake
CMake is used to build the items in this directory. >= v2.8.5 is required, but the latest available version is recommended.
pthreads-win32 - Windows-only
Windows users will need to get pthreads-win32, and may (with newer Windows versions) need to build it from scratch.
Build
Linux and OSX
From this directory, create a build directory. This is personal preference, of course. It allows for all build files to be cleaned up via a single rm -r build/ command.
Next, run cmake to configure the build, followed by make and sudo make install to build and install libraries and applications.
mkdir -p build
cd build
cmake [options] ../
make
sudo make install
sudo ldconfig
Fedora Note: By default, libbladeRF will install to /usr/local/{lib,lib64}, which is not listed in /etc/ld.so.conf. On these systems, it is recommended to create a /etc/ld.so.conf.d/local.conf specifying these directories:
sudo tee /etc/ld.so.conf.d/local.conf <<EOF
/usr/local/lib
/usr/local/lib64
EOF
Then, run sudo ldconfig again.
Windows
This process was most recently validated on Windows 10 Enterprise with CMake 3.9.0, libusb 1.0.21, and Microsoft Visual Studio Community 2017 (Version 15.2).
bladeRF
- Create a
builddirectory underhost - Run the CMake GUI, pointing the source location to this
hostdirectory and the build directory to thebuilddirectory you just created. - Click the CMake GUI's "Configure" button. Select the Visual Studio version installed on your system when prompted for a "generator."
- If you run into any failures, check these items, then re-run Configure:
- LIBUSB_PATH (and ENABLE_BACKEND_LIBUSB) - for using libusb
- FX3_SDK_PATH (and ENABLE_BACKEND_CYAPI) - for using the Cypress driver
- LIBPTHREADSWIN32_PATH
- If you run into any failures, check these items, then re-run Configure:
- Adjust options as desired and re-run the "Configure" command as needed. Values in red are new, and should be reviewed before running "Configure" again to get the red out.
- Click the CMake GUI's "Generate" button.
- In the
builddirectory, a Visual Studio solution will now exist. You can click "Open Project" to get there. - Build the solution (right-click
Solution 'bladeRF'and click "Build Solution") - Upon building the solution, build artifacts will be present in:
build\output\<build type><build_type>may refer to Debug or Release, for example
pthreads-win32
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-w32 2.9.1.
-
Get full source tree from pthreads-win32 website, and unpack someplace convenient
-
In Visual Studio, open
pthreads-w32-2-9-1-release\pthreads.2\pthread.dsw(one-way upgrade is OK) -
Right-click the solution, select "Retarget solution", hit OK.
-
Change "Solution Configurations" dropdown to "Release" ("Debug" doesn't work, but that's OK)
-
Edit pthread.h to add
#define HAVE_STRUCT_TIMESPECand#define PTW32_ARCHx64near the top, just below the include guard -
Build the solution
-
Back over in the bladeRF CMake:
- File -> Delete Cache
- Redo the "Configure" dance as before
- Point
LIBPTHREADSWIN32_PATHto thepthreads-w32-2-9-1-release\pthreads.2directory you were just working in
CMake Options and Flags
Below is a list of useful and project-specific CMake options. Please see the CMake documentation for more information.
| Option | Description |
|---|---|
| -DCMAKE_INSTALL_PREFIX=</prefix/path> | Override system-specific path to install output files. Default depends on system; see cmake -L |
| -DCMAKE_BUILD_TYPE=<type> | Set to "Debug" to enable a debug build. Default: "Release" |
| -DBUILD_DOCUMENTATION=<ON/OFF> | Build libbladeRF API documentation and manpages for utilities. Default: OFF |
| -DCMAKE_C_COMPILER=<compiler> | Specify the compiler to use. Otherwise, CMake will determine a default. |
| -DENABLE_GDB_EXTENSIONS=<ON/OFF> | GCC & GDB users may want to set this to use -ggdb3 instead of -g. Default: OFF |
| -DENABLE_BACKEND_LIBUSB=<ON/OFF> | Enables libusb backend in libbladeRF. Default: ON if libusb is available, OFF otherwise. |
| -DENABLE_BACKEND_CYAPI=<ON/OFF>a | Enables (Windows-only) Cypress driver/library based backend in libbladeRF. Default: ON if the FX3 SDK is available, OFF otherwise. |
| -DENABLE_BACKEND_DUMMY=<ON/OFF> | Enables dummy backend support in libbladeRF. Only useful for some developers. Default: OFF |
| -DENABLE_LIBTECLA=<ON/OFF> | Enable libtecla support in the bladeRF-cli program. Default: ON if libtecla is detected, OFF otherwise. |
| -DINSTALL_UDEV_RULES=<ON/OFF> | Install udev rules to /etc/udev/rules.d/. Default: ON for Linux, OFF default otherwise. |
| -DUDEV_RULES_PATH=</path/to/udev/rules> | Override the path for installing udev rules. Default: /etc/udev/rules.d |
| -DBLADERF_GROUP=<group> | Sets the group associated with the bladeRF in the installed udev rules. Default: plugdev |
| -DTREAT_WARNINGS_AS_ERRORS=<ON/OFF> | Treat compiler warnings as errors. Contributors should keep this enabled. Default: ON |
| -DENABLE_LOG_FILE_INFO=<ON/OFF> | Enable source file and line number information in log messages. Default: ON |