aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/usrp_n2xx_simple_net_burner.cpp
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-07-15 09:32:18 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2015-07-15 09:32:18 -0700
commit0595900eccfffee9e944dc53466337b44655caac (patch)
tree7db7ee8e908b604236b04cf49f3d8d978e386543 /host/utils/usrp_n2xx_simple_net_burner.cpp
parent012381d999c4a895593412aaf06e73432b458810 (diff)
downloaduhd-0595900eccfffee9e944dc53466337b44655caac.tar.gz
uhd-0595900eccfffee9e944dc53466337b44655caac.tar.bz2
uhd-0595900eccfffee9e944dc53466337b44655caac.zip
Added uhd::image_loader class and uhd_image_loader utility
* Single class for loading firmware/FPGA images onto devices instead of multiple utilities * Loading functions are registered for each device, corresponding to their --args="type=foo" name * Deprecation warnings added to all product-specific image loading utilities
Diffstat (limited to 'host/utils/usrp_n2xx_simple_net_burner.cpp')
-rw-r--r--host/utils/usrp_n2xx_simple_net_burner.cpp57
1 files changed, 56 insertions, 1 deletions
diff --git a/host/utils/usrp_n2xx_simple_net_burner.cpp b/host/utils/usrp_n2xx_simple_net_burner.cpp
index 642e9a407..b105e9cb6 100644
--- a/host/utils/usrp_n2xx_simple_net_burner.cpp
+++ b/host/utils/usrp_n2xx_simple_net_burner.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2012-2014 Ettus Research LLC
+// Copyright 2012-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
@@ -184,6 +184,59 @@ void list_usrps(){
/***********************************************************************
* Find USRP N2XX with specified IP address and return type
**********************************************************************/
+void print_image_loader_warning(const std::string &fw_path,
+ 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
+
+ std::string uhd_image_loader = str(boost::format("uhd_image_loader --args=\"type=usrp2,addr=%s")
+ % vm["addr"].as<std::string>());
+ if(vm.count("auto-reboot") > 0)
+ uhd_image_loader += ",reset";
+ if(vm.count("overwrite-safe") > 0)
+ uhd_image_loader += ",overwrite-safe";
+ if(vm.count("dont-check-rev") > 0)
+ uhd_image_loader += ",dont-check-rev";
+
+ uhd_image_loader += "\"";
+
+ if(vm.count("no-fw") == 0){
+ uhd_image_loader += str(boost::format("%s--fw-path=\"%s\"")
+ % nl % fw_path);
+ }
+ else{
+ uhd_image_loader += str(boost::format("%s--no-fw")
+ % nl);
+ }
+
+ if(vm.count("no-fpga") == 0){
+ uhd_image_loader += str(boost::format("%s--fpga-path=\"%s\"")
+ % nl % fpga_path);
+ }
+ else{
+ uhd_image_loader += str(boost::format("%s--no-fpga")
+ % nl);
+ }
+
+ 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;
+}
+
+/***********************************************************************
+ * Find USRP N2XX with specified IP address and return type
+ **********************************************************************/
boost::uint32_t find_usrp(udp_simple::sptr udp_transport, bool check_rev){
boost::uint32_t hw_rev;
bool found_it = false;
@@ -627,6 +680,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
fw_image_size = read_fw_image(fw_path);
}
+ print_image_loader_warning(fw_path, fpga_path, vm);
+
std::cout << "Will burn the following images:" << std::endl;
if(burn_fw) std::cout << boost::format(" * Firmware: %s\n") % fw_path;
if(burn_fpga) std::cout << boost::format(" * FPGA: %s\n") % fpga_path;