aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/core/rfnoc_imagebuilder_args.json3
-rwxr-xr-xhost/utils/bin/rfnoc_image_builder28
-rwxr-xr-xhost/utils/rfnoc/image_builder.py12
3 files changed, 23 insertions, 20 deletions
diff --git a/host/include/uhd/rfnoc/core/rfnoc_imagebuilder_args.json b/host/include/uhd/rfnoc/core/rfnoc_imagebuilder_args.json
index 65ef2dd76..2d76643be 100644
--- a/host/include/uhd/rfnoc/core/rfnoc_imagebuilder_args.json
+++ b/host/include/uhd/rfnoc/core/rfnoc_imagebuilder_args.json
@@ -5,7 +5,8 @@
"copyright": { "type": "string" },
"version": { "type": "number" },
"license": { "type": "string" },
- "device_desc": { "type": "string" },
+ "device": { "type": "string" },
+ "default_target": { "type": "string" },
"rfnoc_version": { "type": "number" },
"chdr_width": { "enum": [64, 256] },
diff --git a/host/utils/bin/rfnoc_image_builder b/host/utils/bin/rfnoc_image_builder
index 0df0d5d3c..731fad0b2 100755
--- a/host/utils/bin/rfnoc_image_builder
+++ b/host/utils/bin/rfnoc_image_builder
@@ -50,7 +50,6 @@ def setup_parser():
config_group.add_argument(
"-r", "--grc_config",
help="Path to grc file to generate config from")
-
parser.add_argument(
"-F", "--fpga-dir",
help="Path directory of the FPGA source tree",
@@ -65,13 +64,11 @@ def setup_parser():
help="Path to where to save the static router hex file. "
"Defaults to the location of the YAML file, filename $device_static_router.hex",
default=None)
-
parser.add_argument(
"-I", "--include-dir",
help="Path directory of the RFNoC Out-of-Tree module",
nargs='+',
default=None)
-
parser.add_argument(
"-b", "--grc-blocks",
help="Path directory of GRC block descriptions (needed for --grc-config only)",
@@ -86,11 +83,13 @@ def setup_parser():
action="store_true")
parser.add_argument(
"-d", "--device",
- help="Device to be programmed [x300, x310, e310, e320, n300, n310, n320]",
- default="x310")
+ help="Device to be programmed [x300, x310, e310, e320, n300, n310, n320]."
+ "Needs to be specified either here, or in the configuration file.",
+ default=None)
parser.add_argument(
"-t", "--target",
- help="Build target (e.g. X310_HG, N320_XG, ...)",
+ help="Build target (e.g. X310_HG, N320_XG, ...). Needs to be specified "
+ "either here, on the configuration file.",
default=None)
parser.add_argument(
"-g", "--GUI",
@@ -115,14 +114,16 @@ def image_config(args):
:return: image configuration as dictionary
"""
if args.yaml_config:
- return rfnoc.yaml_utils.load_config(args.yaml_config, get_config_path()), \
- args.yaml_config
-
+ config = \
+ rfnoc.yaml_utils.load_config(args.yaml_config, get_config_path())
+ device = config.get('device') if args.device is None else args.device
+ target = config.get('default_target') if args.target is None else args.target
+ return config, args.yaml_config, device, target
with open(args.grc_config) as grc_file:
config = yaml.load(grc_file)
logging.info("Converting GNU Radio Companion file to image builder format")
config = rfnoc.image_builder.convert_to_image_config(config, args.grc_blocks)
- return config, args.grc_config
+ return config, args.grc_config, args.device, args.target
def resolve_path(path, local):
@@ -170,7 +171,7 @@ def main():
if args.log_level is not None:
logging.root.setLevel(args.log_level.upper())
- config, source = image_config(args)
+ config, source, device, target = image_config(args)
source_hash = hashlib.sha256()
with open(source, "rb") as source_file:
source_hash.update(source_file.read())
@@ -179,8 +180,8 @@ def main():
config=config,
fpga_path=args.fpga_dir,
config_path=get_config_path(),
- device=args.device,
- target=args.target,
+ device=device,
+ target=target,
generate_only=args.generate_only,
clean_all=args.clean_all,
gui=args.GUI,
@@ -188,6 +189,7 @@ def main():
source_hash=source_hash.hexdigest(),
output_path=args.image_core_output,
router_hex_path=args.router_hex_output,
+ include_paths=args.include_dir,
)
if __name__ == "__main__":
diff --git a/host/utils/rfnoc/image_builder.py b/host/utils/rfnoc/image_builder.py
index 92d8a909d..965b2d454 100755
--- a/host/utils/rfnoc/image_builder.py
+++ b/host/utils/rfnoc/image_builder.py
@@ -461,16 +461,15 @@ def convert_to_image_config(grc, grc_config_path):
return result
-def collect_module_paths(config_path):
+def collect_module_paths(config_path, include_paths):
"""
- Create a list of directorties that contain noc block configuration files.
+ Create a list of directories that contain noc block configuration files.
:param config_path: root path holding configuration files
:return: list of noc block directories
"""
# rfnoc blocks
- result = [os.path.join(config_path, 'rfnoc', 'blocks')]
- # additional OOT blocks
- # TODO parse modules from external includes as well
+ result = [os.path.join(config_path, 'rfnoc', 'blocks')] + \
+ [os.path.join(x, 'blocks') for x in include_paths]
return result
@@ -732,6 +731,7 @@ def build_image(config, fpga_path, config_path, device, **args):
generate_only: Do not build the code after generation.
clean_all: passed to Makefile
GUI: passed to Makefile
+ include_paths: Paths to additional blocks
:return: Exit result of build process or 0 if generate-only is given.
"""
logging.info("Selected device %s", device)
@@ -749,7 +749,7 @@ def build_image(config, fpga_path, config_path, device, **args):
device_conf = IOConfig(device_config(core_config_path, device),
signatures_conf)
- block_paths = collect_module_paths(config_path)
+ block_paths = collect_module_paths(config_path, args.get('include_paths'))
logging.debug("Looking for block descriptors in:")
for path in block_paths:
logging.debug(" %s", os.path.normpath(path))