Commit graph

466 commits

Author SHA1 Message Date
Martin Braun
d997c235b8 image builder: Add ability to pick up extra Makefile.srcs from YAMLS
The blocks that are neither OOT, nor core blocks (like the DDC/DUC,
etc.) require additional info to find their appropriate Makefile.srcs
files. We don't include them in every build, to avoid building IP for
the FFT, FIR, and other blocks when they're not needed. However, those
blocks are in-tree, and don't follow the same directory structure as
out-of-tree modules, either.

We therefore allow the YAML files for those blocks (which are shipped
with UHD) to contain a path hint to their appropriate Makefile.srcs. The
image builder uses those paths to amend the `make` command
appropriately.
2019-11-26 12:21:33 -08:00
Martin Braun
4693f9d1f0 utils: image builder: Factor out some data to top of image_builder.py
For easier maintenance, some constants like paths and maps were moved to
the top of the Python file.
2019-11-26 12:21:33 -08:00
Martin Braun
98a510d68e rfnoc: image builder: Fix include paths
The -I option was broken in multiple ways:
- Multiple -I options would only keep the last one
- The call to make did not actually append RFNOC_OOT_MAKEFILE_SRCS
2019-11-26 12:21:33 -08:00
Wade Fife
73911aca19 utils: blocktool: Fix blocktool
- Fix mako paths to run from anywhere
- Correct code errors and clean up generated code
- Add support for port parameters
- Add support for axis_data interface
- Fix NoC shell reset handling
- Replace Python functions with Verilog $clog2
- Allow input and output to share port name
2019-11-26 12:21:33 -08:00
Wade Fife
4e6177ed55 utils: image_builder: Support parameterized number of ports on blocks 2019-11-26 12:21:32 -08:00
Martin Braun
2a7e69d862 rfnoc: image_builder: Fix -I, allow devices/targets to bet set in YAML
- The -I switch now allows pointing to an OOT
- The image core file may now contain keys 'device' and
  'default_target', which the image builder can use as default values.
  Command line switches --device and --target are still honoured.
2019-11-26 12:21:32 -08:00
Sugandha Gupta
3e2cceeaed utils: image_builder: Fix ordering of noc_blocks, ports
The ports in the fpga need to be ordered to make correct
connections in verilog. This also keeps generated verilog
constant across runs.
2019-11-26 12:21:32 -08:00
Martin Braun
d3a16b7022 uhd: Replace all occurrences of boost::bind with std::bind
Note: Replacing everything with a lambda would be even better, but that
can't be easily scripted so we'll do this as a first step to reduce the
Boost footprint.

This also removes occurences of #include <boost/bind.hpp>, and makes
sure all usages of std::bind have an #include <functional>. clang-format
wasn't always applied to minimize the changeset in this commit, however,
it was applied to the blocks of #includes.

Due to conflicts with other Boost libraries, the placeholders _1, _2,
etc. could not be directly used, but had to be explicitly called out
(as std::placeholders::_1, etc.). This makes the use of std::bind even
uglier, which serves as another reminder that using std::bind (and even
more so, boost::bind) should be avoided.

nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It
was not possible to remove it by simply doing a search and replace, so
it will be removed in a separate commit.
2019-11-26 12:21:32 -08:00
Martin Braun
1fe98e8701 uhd: Replace usage of boost smart pointers with C++11 counterparts
This removes the following Boost constructs:
- boost::shared_ptr, boost::weak_ptr
- boost::enable_shared_from_this
- boost::static_pointer_cast, boost::dynamic_pointer_cast

The appropriate includes were also removed. All C++11 versions of these
require #include <memory>.
Note that the stdlib and Boost versions have the exact same syntax, they
only differ in the namespace (boost vs. std). The modifications were all
done using sed, with the exception of boost::scoped_ptr, which was
replaced by std::unique_ptr.

References to boost::smart_ptr were also removed.

boost::intrusive_ptr is not removed in this commit, since it does not
have a 1:1 mapping to a C++11 construct.
2019-11-26 12:21:32 -08:00
Alex Williams
28a1d079a7 images: Fix THIS_PORTID calculation to offset from num ctrl_seps
THIS_PORTID was calculating the block port ID via the number of SEPs
in the design, but it should be smaller when not all SEPs have a ctrl
port. This commit fixes that calculation.
2019-11-26 12:21:31 -08:00
Martin Braun
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Martin Braun
1ac6e6f561 utils: Add RFNoC-specific features to uhd_usrp_probe
- --interactive-reg-shell $BLOCKID will let you peek and poke registers
  in an RFNoC block
- Blocks and static connections are printed
2019-11-26 12:16:25 -08:00
Ciro Nishiguchi
1c79742231 utils: remove thread priority elevation
Remove UHD call to elevate thread priority to realtime from utils, and
add warning in documentation of set_thread_priority function. Setting
all threads to the same realtime priority can cause the threads to not
share access to the network interface fairly, which adversely affects
operation of the worker threads in UHD.
2019-11-26 11:49:34 -08:00
Lars Amsel
914fbdbcb2 rfnoc: Add a new builder script for FPGA images based on eRFNoC.
The builder has two major jobs:
 * generate an image core file which reflects the FPGA image
   configuration given by the user
 * invoke Xilinx toolchain to actually build the FPGA image

For this purpose it needs to know where to find the FPGA source tree.
This tree can be give by the -F option.

The code that represents the user configurable part of the image is
written to a file called <device>_rfnoc_sandbox.v. To generate the file
these configuration files are needed:
 * io_signatures.yml: A file describing the known IO signatures. This file
                      is global for all devices and contains the superset
                      of all signatures (not all signatures are used by all
                      devices). It resides in usrp3/top/ of the tree given
                      by -F.
* bsp.yml: A file describing interfaces of a specific device such as AXIS
           transport interfaces or IO ports as well as device specific
           settings. It resides in usrp3/top/<device> of the tree given by -F.
* <image>.yml: a file provided by the user with freely chosen name.
               It describes which elements the image should contain
               (RFNoC blocks, streaming endpoints, IO ports) and how
               to connect them. The file also contains image setting
               such as the CHDR width to be used.

The script uses mako templates to generate the sandbox file. Before the
template engine is invoked sanity checks are executed to ensure the
configuration is synthactic correct. The script also build up structures
to ease Verilog code generation in the template engine. The engine should
not invoke more Python than echoing variables or iterating of lists or
dictionaries. This eases debugging as errors in the template engine are
hard to track and difficult to read for the user.

All Python code is placed in a package called rfnoc. The templates used
by the builder are also part of this package. image_builder.py contains
a method called build_image which is the main entry point for the builder.
It can also be utilized by other Python programs. To align with the
existing uhd_image_builder there is also a wrapper in bin called
rfnoc_image_builder which expects similar commands as the uhd_image_builder.

For debugging purpuse the script can be invoked from host/utils using
$ PYTHONPATH=. python bin/rfnoc_image_builder <options>

When installed using cmake/make/make install the builder installs to
${CMAKE_INSTALL_PREFIX}bin and can be invoked without specifying a
PYTHONPATH.

One can also install the package using pip from host/utils
$ pip install .

Image config generation can also be done from  GNU Radio Companion
files. The required GRC files are merged into gr-ettus.

Example usage:

$ rfnoc_image_builder -F ~/src/fpgadev -d x310 \
    -r path/to/x310_rfnoc_image_core.grc \
    -b path/to/gr-ettus/grc

Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Martin Braun <martin.braun@ettus.com>
2019-11-26 11:49:32 -08:00
Lars Amsel
752fdd2692 rfnoc: add eRFNoC block builder to generate boiler plate Verilog
This is an initial generator for eRFNoC block.
The script generates the top level block, the shell module, a testbench, and a
Makefile as well as a Makefile.srcs.
To build a block from a yml file one has to invoke

python -c <config> -d <destination folder>

destination folder should be an in tree module folder located in
uhd-fpga/usrp3/lib/erfnoc/blocks
The build tool supports all interface types for control as well as data.

For each interface type there are three templates to generate the variable
block in the top level block and the shell

 * declare the wires
 * connect the wires
 * instantiate the modules

The first two are used in the shell module as well as in the top level block.
The last is for the shell only.
2019-11-26 11:49:14 -08:00
Martin Braun
428288bbea utils: query_gpsdo_sensors: Fix ref_lock wait loop
The old loop didn't have any output, and had an inaccurate timeout. We
now use a timer for a 30 second timeout, and print a . every time we
poll the sensor.
2019-11-21 15:02:32 -08:00
michael-west
d25614e6ae B200: Add command to query bootloader status
Updated b2xx_fx3_utils to add a --query_bootloader option to check if
the bootloader is loaded or not.

Signed-off-by: michael-west <michael.west@ettus.com>
2019-08-06 12:06:49 -07:00
Martin Braun
7ecb721807 utils: converter_benchmark: Fix scaling for sc16->fc32 2019-07-20 14:41:00 -07:00
Martin Braun
3e4ee07581 convert: benchmark: Make converter benchmark Py3k compatible 2019-07-20 14:41:00 -07:00
Sugandha Gupta
178b35569b e310/e320: Move E310 to MPM architecture and refactor
- Turns the E310 into an MPM device (like N3xx, E320)
- Factor out common code between E320 and E310, maximize sharing between
  the two devices
- Remove all pre-MPM E310 code that is no longer needed
- Modify MPM to remove all existing overlays before applying new ones
  (this is necessary to enable idle image mode for E310)

Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2019-05-01 15:17:23 -07:00
Nick Foster
79b4a5253d utils: Add X300/X310 reset program 2019-04-24 11:52:14 -07:00
Mark Meserve
2bdad498e3 b200: enable usage of custom bootloader
- Update MB EEPROM
- Add bootloader load command to fx3 util
2019-04-11 17:10:50 -07:00
Brent Stapleton
431deb855b uhd: mpm: update all license header w/ "-or-later"
Updating all SPDX license identifiers to include "-or-later"
2019-03-08 00:43:07 +01:00
Mark Meserve
3665242c33 uhd: set tx gain to max for rx iq cal
- The other cal utilities (TX IQ and TX DC) already do this.
- This fixes calibration for certain frequencies on N320/N321.
- Old calibration data is still valid after this change.
2019-02-21 16:16:06 -08:00
Alex Williams
93e7a22ae6 utils: Deny positional options in uhd_image_loader
This change prevents invalid positional options from being accepted into
uhd_image_loader. Previously, if a user forgot to specify the option
type, uhd_image_loader would proceed and look like it succeeded, but the
intended image may not have been loaded.
2019-02-13 15:57:38 -08:00
michael-west
8c6becc521 utils: Add check for gdb_eeprom before accessing
Signed-off-by: michael-west <michael.west@ettus.com>
2019-01-29 09:19:36 -08:00
Brent Stapleton
967be2a4e8 uhd: mpm: apply clang-format to all files
Applying formatting changes to all .cpp and .hpp files in the following
directories:
```
find host/examples/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/tests/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/neon/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/magnesium/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/device3/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/mpmd/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/x300/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/utils/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find mpm/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Also formatted host/include/, except Cpp03 was used as a the language
standard instead of Cpp11.
```
sed -i 's/ Cpp11/ Cpp03/g' .clang-format
find host/include/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Formatting style was designated by the .clang-format file.
2019-01-16 11:40:23 -08:00
Brent Stapleton
601e0ed87b examples: utils: skip formatting program options
Turning off clang formatting around the program option declarations.
clang-format makes them looks bad an unreadable because it thinks the
options are function calls or something.
2019-01-16 11:40:23 -08:00
Brent Stapleton
8bd7498ed9 uhd: skip formatting misc arrays, maps, etc.
Various data structures are nicely formatted to be human-readable.
clang-format makes these structures harder to read, so we can skip
formatting these sections.
2019-01-16 11:40:23 -08:00
Mark Meserve
a490455abc uhd: update cal utilities to support rhodium 2019-01-09 11:47:07 -08:00
michael-west
46bd88639e utils: Improve query_gpsdo_sensors
- Sets time source before checking ref_locked
  (E310 uses time source for PLL)
- Checks for existence of "gpsdo" time and clock sources before setting
- Only attempts to set them if they exist
- Does not fall back on external sources
- Returns with error if neither can be set to "gpsdo"
2018-12-20 19:18:49 -08:00
Michael Dickens
8651511082 responder: Better "abs()" compiler compatibility
Use "std::abs" instead of "abs" for better compiler compatibility
2018-12-12 19:23:21 -08:00
Brent Stapleton
0b93b32b60 utils: specify the downloader's Python executable
Change the uhd_images_downloader's first line to execute with a runtime
Python interpreter, as determined at UHD build time. Users can still
use an arbitrary Python executable by calling
`python uhd_images_downloader`

This will fix our embedded products by ensuring that we call Python3
when running uhd_images_downloader in embedded mode.
2018-11-26 18:00:30 -08:00
Martin Braun
c3680008cf utils: uhd_images_downloader: Add --http-proxy option
This lets the user specify a HTTP proxy. The environment variable
HTTP_PROXY is still usable, but --http-proxy will override it. Example:

    $ uhd_images_downloader \
            --http-proxy http://user:pass@10.20.30.40:3128 \
	    -t x310

Here, the tool will download all the images matching 'x310' using
a proxy at 10.20.30.40.
2018-11-16 14:04:13 -08:00
Martin Braun
a69ab0c23a cmake: Update coding style to use lowercase commands
Also updates our coding style file.

Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code (with GNU compliant sed):

cmake --help-command-list | grep -v "cmake version" | while read c; do
  echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done > convert.sed \
&& git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \
'*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed

(Make sure the backslashes don't get mangled!)
2018-11-14 14:10:09 -08:00
Martin Braun
07b0cc1b14 utils: Fix downloader return value for main()
This is effectively a refactoring: The main() function now returns True
on success. This fixes a bug where one branch would simply return (None)
instead of returning a value.
2018-11-13 12:12:09 -08:00
Martin Braun
4f2e5b645c utils: Downloader stall on error for Windows users
If platform.system() is 'Windows', the Python script will stall on
error before terminating, e.g., when an import is missing or when an
unexpected Exception occurred during the execution.
The rationale is that many Windows users run this script directly,
without a shell, and wouldn't have a way to see error messages from the
script in that case.
2018-11-13 12:12:09 -08:00
Martin Braun
49f9e44966 utils: uhd_images_downloader: Remove archive type
Since the uhd_images_downloader is so tightly integrated into our
infrastructure, we've dropped support for .tar.gz and .tar.xz file for
this particular purpose. Note that UHD releases still receive images in
all three formats.
2018-11-13 12:12:09 -08:00
Martin Braun
0392a16d13 utils: uhd_images_downloader: Refactor the tool
No functional changes. The main effort was to reduce the length of
main() and reduce the number of Pylint warnings.
2018-11-13 12:12:09 -08:00
Martin Braun
e360bc9942 utils: Allow downloader to ship non-zip files
Note: All archives shipped using this tool are zip files. However, this
allows us to ship other types of files, which will be downloaded and
sorted into the images directory as-is.
2018-11-13 12:12:09 -08:00
Martin Braun
9d10ae463f utils: uhd_images_downloader: Add download limit
This download limit prevents users from accidentally downloading really
large files. The default limit is 100 MiB. When a file is selected for
download that exceeds this size, the user is prompted if she really
wants to download that file.

By specifying --yes (or -y), this can can be bypassed. Example:

    $ uhd_images_downloader --yes -t sdimg

Will match all files that match 'sdimg', which are typically larger than
100 MiB, without interaction.
2018-11-13 12:12:09 -08:00
Martin Braun
a6943f00f9 utils: uhd_images_downloader: Add --yes option
This will answer 'yes' to all questions that are asked and allows to
script the downloader. Example:

    $ uhd_images_downloader -t sdimg -y

Any interaction that the script will have with the user will be skipped.
2018-11-13 12:12:09 -08:00
Martin Braun
1e6d22398f utils: add downloader printing fetchable URLs
Running

    $ uhd_images_downloader -l

will now print the full URL of the target. By specifying

    $ uhd_images_downloader -l --url-only

It will *only* print the URLs, nothing else, making this suitable for
scripting. The list will always go to stdout, whereas the logging is
going to stderr and thus can easily be siphoned off.
2018-11-13 12:12:09 -08:00
Martin Braun
e3bf5dc34c utils: Make uhd_images_downloader log to stderr 2018-11-13 12:12:09 -08:00
Martin Braun
09ac6991c3 utils: Factor wait_for_lo_lock() out of cal utils 2018-08-29 15:50:30 -07:00
Brent Stapleton
87e7d712d9 uhd: utils: Add Zip test to downloader
Users can supply the --test/-T option to test the downloaded archive
before extracting it, using the Python zipfile.testzip() function.
2018-08-28 15:04:17 -07:00
Brent Stapleton
05564d67f0 uhd: utils: Downloader logs no targets selected
uhd_images_downloader: Adding INFO message when there is no target
selected to download, as when the user misspells a target name.
2018-08-28 15:04:17 -07:00
Brent Stapleton
840c518f3c utils: fixup for downloader inventory management
uhd_images_downloader was mismanaging the image inventory- image
packages entries were not being deleted when the images were
overwritten. Now, each target is saved as a single entry in the
inventory, which is overwritten when a new image package is
downloaded.
2018-08-21 13:35:45 -07:00
Martin Braun
0303f1ed55 lib: Purge all references to boost::this_thread::sleep()
Replace with std::this_thread::sleep_for().
2018-04-30 17:10:26 -07:00
Trung N Tran
fc67052345 utils: fix 30s timeout in query_gpsdo_sensors 2018-04-30 17:02:57 -07:00