diff options
-rw-r--r-- | host/python/uhd/imgbuilder/__init__.py (renamed from host/utils/rfnoc/__init__.py) | 0 | ||||
-rwxr-xr-x | host/python/uhd/imgbuilder/image_builder.py (renamed from host/utils/rfnoc/image_builder.py) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/chdr_xb_sep_transport.v.mako (renamed from host/utils/rfnoc/templates/modules/chdr_xb_sep_transport.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/connect_clk_domains.v.mako (renamed from host/utils/rfnoc/templates/modules/connect_clk_domains.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/connect_io_ports.v.mako (renamed from host/utils/rfnoc/templates/modules/connect_io_ports.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/ctrl_crossbar.v.mako (renamed from host/utils/rfnoc/templates/modules/ctrl_crossbar.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako (renamed from host/utils/rfnoc/templates/modules/device_io_ports.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/device_transport.v.mako (renamed from host/utils/rfnoc/templates/modules/device_transport.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/drive_unused_ports.v.mako (renamed from host/utils/rfnoc/templates/modules/drive_unused_ports.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako (renamed from host/utils/rfnoc/templates/modules/rfnoc_block.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/sep_xb_wires.v.mako (renamed from host/utils/rfnoc/templates/modules/sep_xb_wires.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/static_router.v.mako (renamed from host/utils/rfnoc/templates/modules/static_router.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako (renamed from host/utils/rfnoc/templates/modules/stream_endpoints.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako (renamed from host/utils/rfnoc/templates/rfnoc_image_core.v.mako) | 0 | ||||
-rw-r--r-- | host/python/uhd/imgbuilder/yaml_utils.py (renamed from host/utils/rfnoc/yaml_utils.py) | 0 | ||||
-rw-r--r-- | host/utils/CMakeLists.txt | 45 | ||||
-rw-r--r-- | host/utils/rfnoc/CMakeLists.txt | 18 | ||||
-rw-r--r-- | host/utils/rfnoc/templates/CMakeLists.txt | 16 | ||||
-rw-r--r-- | host/utils/rfnoc/templates/modules/CMakeLists.txt | 24 | ||||
-rwxr-xr-x | host/utils/rfnoc_image_builder.py (renamed from host/utils/bin/rfnoc_image_builder) | 21 |
20 files changed, 21 insertions, 103 deletions
diff --git a/host/utils/rfnoc/__init__.py b/host/python/uhd/imgbuilder/__init__.py index e69de29bb..e69de29bb 100644 --- a/host/utils/rfnoc/__init__.py +++ b/host/python/uhd/imgbuilder/__init__.py diff --git a/host/utils/rfnoc/image_builder.py b/host/python/uhd/imgbuilder/image_builder.py index 4f5f416d6..4f5f416d6 100755 --- a/host/utils/rfnoc/image_builder.py +++ b/host/python/uhd/imgbuilder/image_builder.py diff --git a/host/utils/rfnoc/templates/modules/chdr_xb_sep_transport.v.mako b/host/python/uhd/imgbuilder/templates/modules/chdr_xb_sep_transport.v.mako index 0862a1ac1..0862a1ac1 100644 --- a/host/utils/rfnoc/templates/modules/chdr_xb_sep_transport.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/chdr_xb_sep_transport.v.mako diff --git a/host/utils/rfnoc/templates/modules/connect_clk_domains.v.mako b/host/python/uhd/imgbuilder/templates/modules/connect_clk_domains.v.mako index df055645c..df055645c 100644 --- a/host/utils/rfnoc/templates/modules/connect_clk_domains.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/connect_clk_domains.v.mako diff --git a/host/utils/rfnoc/templates/modules/connect_io_ports.v.mako b/host/python/uhd/imgbuilder/templates/modules/connect_io_ports.v.mako index c37697d88..c37697d88 100644 --- a/host/utils/rfnoc/templates/modules/connect_io_ports.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/connect_io_ports.v.mako diff --git a/host/utils/rfnoc/templates/modules/ctrl_crossbar.v.mako b/host/python/uhd/imgbuilder/templates/modules/ctrl_crossbar.v.mako index 5872e270e..5872e270e 100644 --- a/host/utils/rfnoc/templates/modules/ctrl_crossbar.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/ctrl_crossbar.v.mako diff --git a/host/utils/rfnoc/templates/modules/device_io_ports.v.mako b/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako index abfb86c98..abfb86c98 100644 --- a/host/utils/rfnoc/templates/modules/device_io_ports.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/device_io_ports.v.mako diff --git a/host/utils/rfnoc/templates/modules/device_transport.v.mako b/host/python/uhd/imgbuilder/templates/modules/device_transport.v.mako index 3d752ce13..3d752ce13 100644 --- a/host/utils/rfnoc/templates/modules/device_transport.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/device_transport.v.mako diff --git a/host/utils/rfnoc/templates/modules/drive_unused_ports.v.mako b/host/python/uhd/imgbuilder/templates/modules/drive_unused_ports.v.mako index dfa1e7eb6..dfa1e7eb6 100644 --- a/host/utils/rfnoc/templates/modules/drive_unused_ports.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/drive_unused_ports.v.mako diff --git a/host/utils/rfnoc/templates/modules/rfnoc_block.v.mako b/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako index ee4a811a8..ee4a811a8 100644 --- a/host/utils/rfnoc/templates/modules/rfnoc_block.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/rfnoc_block.v.mako diff --git a/host/utils/rfnoc/templates/modules/sep_xb_wires.v.mako b/host/python/uhd/imgbuilder/templates/modules/sep_xb_wires.v.mako index 4aa7d56bb..4aa7d56bb 100644 --- a/host/utils/rfnoc/templates/modules/sep_xb_wires.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/sep_xb_wires.v.mako diff --git a/host/utils/rfnoc/templates/modules/static_router.v.mako b/host/python/uhd/imgbuilder/templates/modules/static_router.v.mako index 3649c278b..3649c278b 100644 --- a/host/utils/rfnoc/templates/modules/static_router.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/static_router.v.mako diff --git a/host/utils/rfnoc/templates/modules/stream_endpoints.v.mako b/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako index f8ecccb77..f8ecccb77 100644 --- a/host/utils/rfnoc/templates/modules/stream_endpoints.v.mako +++ b/host/python/uhd/imgbuilder/templates/modules/stream_endpoints.v.mako diff --git a/host/utils/rfnoc/templates/rfnoc_image_core.v.mako b/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako index a18ff53a1..a18ff53a1 100644 --- a/host/utils/rfnoc/templates/rfnoc_image_core.v.mako +++ b/host/python/uhd/imgbuilder/templates/rfnoc_image_core.v.mako diff --git a/host/utils/rfnoc/yaml_utils.py b/host/python/uhd/imgbuilder/yaml_utils.py index e64556334..e64556334 100644 --- a/host/utils/rfnoc/yaml_utils.py +++ b/host/python/uhd/imgbuilder/yaml_utils.py diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 958bffb97..08ace6a0c 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -26,6 +26,18 @@ foreach(util_source ${util_runtime_sources}) UHD_INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT utilities) endforeach(util_source) +set(CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}") +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/rfnoc_image_builder.py" + "${CMAKE_CURRENT_BINARY_DIR}/rfnoc_image_builder" +) +UHD_INSTALL(PROGRAMS + ${CMAKE_CURRENT_BINARY_DIR}/rfnoc_image_builder + RENAME rfnoc_image_builder + DESTINATION ${RUNTIME_DIR} + COMPONENT utilities +) + ######################################################################## # Utilities that get installed into the share path ######################################################################## @@ -105,6 +117,7 @@ UHD_INSTALL(PROGRAMS DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) + if(LINUX) UHD_INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/uhd_images_downloader.py @@ -158,38 +171,6 @@ if(ENABLE_USRP2) endif(ENABLE_USRP2) ######################################################################## -# Python rfnoc package -######################################################################## -set(RFNOC_PKG_FILES "") -add_subdirectory(rfnoc) - -set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") -set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") -set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") -set(CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}") - -# construct site-package folder from install prefix -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "from __future__ import print_function; from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE RFNOC_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE -) - -configure_file(${SETUP_PY_IN} ${SETUP_PY}) -# rfnoc_image_builder uses RFNOC_PACKAGE_DIR to find python package location -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/rfnoc_image_builder" "${CMAKE_CURRENT_BINARY_DIR}/bin/rfnoc_image_builder") - -add_custom_command(OUTPUT ${OUTPUT} - COMMENT "build rfnoc package" - COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -DBINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" -P ${CMAKE_CURRENT_SOURCE_DIR}/copy_python_module.cmake - COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build - COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - DEPENDS ${RFNOC_PKG_FILES}) -add_custom_target(rfnoc ALL DEPENDS ${OUTPUT}) - -get_filename_component(SETUP_FOLDER ${SETUP_PY} DIRECTORY) -install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --force --prefix ${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${SETUP_FOLDER})") - -######################################################################## # Other files that are not utilities or executables ######################################################################## if(WIN32) diff --git a/host/utils/rfnoc/CMakeLists.txt b/host/utils/rfnoc/CMakeLists.txt deleted file mode 100644 index baf65f7e7..000000000 --- a/host/utils/rfnoc/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2019 Ettus Research, A National Instrument Brand -# -# SPDX-License-Identifier: GPL-3.0-or-later -# - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES}) -set(RFNOC_PKG_TOP_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ${CMAKE_CURRENT_SOURCE_DIR}/image_builder.py - ${CMAKE_CURRENT_SOURCE_DIR}/yaml_utils.py -) -list(APPEND RFNOC_PKG_FILES ${RFNOC_PKG_TOP_FILES}) -add_subdirectory(templates) -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES} PARENT_SCOPE) diff --git a/host/utils/rfnoc/templates/CMakeLists.txt b/host/utils/rfnoc/templates/CMakeLists.txt deleted file mode 100644 index 88c5e3bd4..000000000 --- a/host/utils/rfnoc/templates/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright 2019 Ettus Research, A National Instrument Brand -# -# SPDX-License-Identifier: GPL-3.0-or-later -# - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES}) -set(RFNOC_PKG_TOP_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rfnoc_image_core.v.mako -) -list(APPEND RFNOC_PKG_FILES ${RFNOC_PKG_TOP_FILES}) -add_subdirectory(modules) -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES} PARENT_SCOPE) diff --git a/host/utils/rfnoc/templates/modules/CMakeLists.txt b/host/utils/rfnoc/templates/modules/CMakeLists.txt deleted file mode 100644 index ee69b63b5..000000000 --- a/host/utils/rfnoc/templates/modules/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2017 Ettus Research, National Instruments Company -# -# SPDX-License-Identifier: GPL-3.0-or-later -# - -######################################################################## -# This file included, use CMake directory variables -######################################################################## -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES}) -set(RFNOC_PKG_TOP_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/chdr_xb_sep_transport.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/connect_io_ports.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/ctrl_crossbar.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/device_io_ports.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/device_transport.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/drive_unused_ports.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/rfnoc_block.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/sep_xb_wires.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/static_router.v.mako - ${CMAKE_CURRENT_SOURCE_DIR}/stream_endpoints.v.mako -) -list(APPEND RFNOC_PKG_FILES ${RFNOC_PKG_TOP_FILES}) -set(RFNOC_PKG_FILES ${RFNOC_PKG_FILES} PARENT_SCOPE) diff --git a/host/utils/bin/rfnoc_image_builder b/host/utils/rfnoc_image_builder.py index e221787c1..a031621ca 100755 --- a/host/utils/bin/rfnoc_image_builder +++ b/host/utils/rfnoc_image_builder.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Copyright 2019 Ettus Research, A National Instrument Brand @@ -27,13 +27,9 @@ import re import yaml logging.basicConfig(format='[%(levelname).3s] %(message)s') -# CMAKE will dump final site-package folder into this to allow the script find -# its package folder -sys.path.insert(0, "@RFNOC_PACKAGE_DIR@") -#pylint : disable = wrong - import - position -import rfnoc.image_builder -import rfnoc.yaml_utils +from uhd.imgbuilder import image_builder +from uhd.imgbuilder import yaml_utils def setup_parser(): """ @@ -114,15 +110,14 @@ def image_config(args): :return: image configuration as dictionary """ if args.yaml_config: - config = \ - rfnoc.yaml_utils.load_config(args.yaml_config, get_config_path()) + config = 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) + config = image_builder.convert_to_image_config(config, args.grc_blocks) return config, args.grc_config, args.device, args.target @@ -164,7 +159,7 @@ def get_config_path(): def main(): """ - Wrapper for rfnoc.image_builder.build_image. + Wrapper for image_builder.build_image. :return: exit code """ args = setup_parser().parse_args() @@ -176,7 +171,7 @@ def main(): with open(source, "rb") as source_file: source_hash.update(source_file.read()) - rfnoc.image_builder.build_image( + image_builder.build_image( config=config, fpga_path=args.fpga_dir, config_path=get_config_path(), @@ -193,4 +188,4 @@ def main(): ) if __name__ == "__main__": - exit(main()) + sys.exit(main()) |