From 6ed6a01784a5846a462fdef92b1bcd6c1f1c90d9 Mon Sep 17 00:00:00 2001 From: Paul David Date: Tue, 14 Mar 2017 19:35:50 -0400 Subject: Utils: Added X3xx support for reading FPGA images --- host/utils/uhd_image_loader.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'host/utils') diff --git a/host/utils/uhd_image_loader.cpp b/host/utils/uhd_image_loader.cpp index 5ea789ee2..5f5ed2871 100644 --- a/host/utils/uhd_image_loader.cpp +++ b/host/utils/uhd_image_loader.cpp @@ -1,5 +1,5 @@ // -// Copyright 2015 Ettus Research LLC +// Copyright 2015-2017 Ettus Research // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -56,17 +56,16 @@ void sigint_handler(int){ int UHD_SAFE_MAIN(int argc, char *argv[]){ - std::string fw_path = ""; - std::string fpga_path = ""; - po::options_description desc("Allowed options"); desc.add_options() ("help", "help message") ("args", po::value()->default_value(""), "Device args, optional loader args") - ("fw-path", po::value(&fw_path)->default_value(""), "Firmware path (uses default if none specified)") - ("fpga-path", po::value(&fpga_path)->default_value(""), "FPGA path (uses default if none specified)") + ("fw-path", po::value()->default_value(""), "Firmware path (uses default if none specified)") + ("fpga-path", po::value()->default_value(""), "FPGA path (uses default if none specified)") + ("out-path", po::value()->default_value(""), "Output path/filename of the downloaded FPGA .bit file") ("no-fw", "Don't burn firmware") - ("no-fpga", "Don't burn FPGA") + ("no-fpga", "Don't Burn FPGA") + ("download", "Download an image to a bit/bin file") ; po::variables_map vm; @@ -86,10 +85,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ // Convert user options uhd::image_loader::image_loader_args_t image_loader_args; image_loader_args.args = vm["args"].as(); - image_loader_args.load_firmware = (vm.count("no-fw") == 0); - image_loader_args.load_fpga = (vm.count("no-fpga") == 0); + image_loader_args.load_firmware = (vm.count("no-fw") == 0); + image_loader_args.load_fpga = (vm.count("no-fpga") == 0); + image_loader_args.download = (vm.count("download") != 0); image_loader_args.firmware_path = vm["fw-path"].as(); image_loader_args.fpga_path = vm["fpga-path"].as(); + image_loader_args.out_path = vm["out-path"].as(); // Force user to specify a device if(not image_loader_args.args.has_key("type")){ @@ -113,6 +114,14 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ #endif /* UHD_PLATFORM_WIN32 */ image_loader_args.fpga_path = fs::absolute(image_loader_args.fpga_path).string(); } + if(image_loader_args.out_path != ""){ + #ifndef UHD_PLATFORM_WIN32 + if(image_loader_args.out_path.find("~") == 0){ + image_loader_args.out_path.replace(0,1,getenv("HOME")); + } + #endif /* UHD_PLATFORM_WIN32 */ + image_loader_args.out_path = fs::absolute(image_loader_args.out_path).string(); + } // Detect which type of device we're working with device_type = image_loader_args.args.get("type",""); -- cgit v1.2.3