diff options
Diffstat (limited to 'host/utils/usrp_x3xx_fpga_burner.cpp')
-rw-r--r-- | host/utils/usrp_x3xx_fpga_burner.cpp | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/host/utils/usrp_x3xx_fpga_burner.cpp b/host/utils/usrp_x3xx_fpga_burner.cpp index 3c6225531..704b291be 100644 --- a/host/utils/usrp_x3xx_fpga_burner.cpp +++ b/host/utils/usrp_x3xx_fpga_burner.cpp @@ -1,5 +1,5 @@ // -// Copyright 2013-2014 Ettus Research LLC +// Copyright 2013-2015 Ettus Research LLC // // 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 @@ -54,7 +54,7 @@ extern "C" { } #define X300_FPGA_BIN_SIZE_BYTES 15877916 -#define X300_FPGA_BIT_MAX_SIZE_BYTES 15878022 +#define X300_FPGA_BIT_MAX_SIZE_BYTES 15878032 #define X300_FPGA_PROG_UDP_PORT 49157 #define X300_FLASH_SECTOR_SIZE 131072 #define X300_PACKET_SIZE_BYTES 256 @@ -195,6 +195,71 @@ void extract_from_lvbitx(std::string lvbitx_path, std::vector<char> &bitstream){ bitstream.swap(decoded_bitstream); } +void print_image_loader_warning(const std::string &fpga_path, const po::variables_map &vm){ + + // Newline + indent + #ifdef UHD_PLATFORM_WIN32 + const std::string nl = " ^\n "; + #else + const std::string nl = " \\\n "; + #endif + + // Generate equivalent uhd_image_loader command + std::string uhd_image_loader = "uhd_image_loader --args=\"type=x300"; + + if(vm.count("addr") > 0){ + uhd_image_loader += str(boost::format(",addr=%s") + % vm["addr"].as<std::string>()); + + if(vm.count("configure") > 0){ + uhd_image_loader += ",configure"; + } + + if(vm.count("verify") > 0){ + uhd_image_loader += ",verify"; + } + } + else{ + uhd_image_loader += str(boost::format(",resource=%s") + % vm["resource"].as<std::string>()); + + /* + * Since we have a default value, vm.count("rpc-port") will + * always be > 0, so only add the option if a different port + * is given. + */ + if(vm["rpc-port"].as<std::string>() != "5444"){ + uhd_image_loader += str(boost::format(",rpc-port=%s") + % vm["rpc-port"].as<std::string>()); + } + } + + if(vm.count("type") > 0){ + uhd_image_loader += str(boost::format(",fpga=%s") + % vm["type"].as<std::string>()); + } + + uhd_image_loader += "\""; + + /* + * The --type option overrides any given path, so only add an FPGA path + * if there was no --type argument. + */ + if(vm.count("type") == 0){ + uhd_image_loader += str(boost::format("%s--fpga-path=\"%s\"") + % nl % fpga_path); + } + + std::cout << "************************************************************************************************" << std::endl + << "WARNING: This utility will be removed in an upcoming version of UHD. In the future, use" << std::endl + << " this command:" << std::endl + << std::endl + << uhd_image_loader << std::endl + << std::endl + << "************************************************************************************************" << std::endl + << std::endl; +} + void ethernet_burn(udp_simple::sptr udp_transport, std::string fpga_path, bool verify){ boost::uint32_t max_size; std::vector<char> bitstream; @@ -479,6 +544,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ throw std::runtime_error("The image filename must end in .bin, .bit, or .lvbitx."); } + print_image_loader_warning(fpga_path, vm); + std::signal(SIGINT, &sig_int_handler); if(vm.count("addr")){ udp_simple::sptr udp_transport = udp_simple::make_connected(ip_addr, BOOST_STRINGIZE(X300_FPGA_PROG_UDP_PORT)); |