From 3814e07606514a650b99e4909bd2fb1bdfadc2e2 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 15 Aug 2018 14:11:59 -0700 Subject: x300: Improve firmware compat error message Now matches the FPGA error message (go download, then run uhd_image_loader). --- host/lib/usrp/x300/x300_impl.cpp | 49 ++++++++++++++++++++++++++++------------ host/lib/usrp/x300/x300_impl.hpp | 2 +- 2 files changed, 35 insertions(+), 16 deletions(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 9b0fe9a51..ad8bb91cf 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -658,7 +658,7 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) //check compat numbers //check fpga compat before fw compat because the fw is a subset of the fpga image this->check_fpga_compat(mb_path, mb); - this->check_fw_compat(mb_path, mb.zpu_ctrl); + this->check_fw_compat(mb_path, mb); mb.fw_regmap = boost::make_shared(); mb.fw_regmap->initialize(*mb.zpu_ctrl.get(), true); @@ -1744,23 +1744,42 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(const std::string &a * compat checks **********************************************************************/ -void x300_impl::check_fw_compat(const fs_path &mb_path, wb_iface::sptr iface) -{ - uint32_t compat_num = iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_COMPAT_NUM)); - uint32_t compat_major = (compat_num >> 16); - uint32_t compat_minor = (compat_num & 0xffff); +void x300_impl::check_fw_compat( + const fs_path &mb_path, + const mboard_members_t &members +) { + auto iface = members.zpu_ctrl; + const uint32_t compat_num = + iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_COMPAT_NUM)); + const uint32_t compat_major = (compat_num >> 16); + const uint32_t compat_minor = (compat_num & 0xffff); + + if (compat_major != X300_FW_COMPAT_MAJOR) { + const std::string image_loader_path = + (fs::path(uhd::get_pkg_path()) / "bin" / "uhd_image_loader").string(); + const std::string image_loader_cmd = + str(boost::format("\"%s\" --args=\"type=x300,%s=%s\"") + % image_loader_path + % (members.xport_path == "eth" ? "addr" + : "resource") + % members.get_pri_eth().addr); - if (compat_major != X300_FW_COMPAT_MAJOR) - { throw uhd::runtime_error(str(boost::format( - "Expected firmware compatibility number %d.%d, but got %d.%d:\n" - "The firmware build is not compatible with the host code build.\n" - "%s" - ) % int(X300_FW_COMPAT_MAJOR) % int(X300_FW_COMPAT_MINOR) - % compat_major % compat_minor % print_utility_error("uhd_images_downloader.py"))); + "Expected firmware compatibility number %d, but got %d:\n" + "The FPGA/firmware image on your device is not compatible with this host code build.\n" + "Download the appropriate FPGA images for this version of UHD.\n" + "%s\n\n" + "Then burn a new image to the on-board flash storage of your\n" + "USRP X3xx device using the image loader utility. " + "Use this command:\n\n%s\n\n" + "For more information, refer to the UHD manual:\n\n" + " http://files.ettus.com/manual/page_usrp_x3x0.html#x3x0_flash" + ) % int(X300_FW_COMPAT_MAJOR) % compat_major + % print_utility_error("uhd_images_downloader.py") + % image_loader_cmd)); } - _tree->create(mb_path / "fw_version").set(str(boost::format("%u.%u") - % compat_major % compat_minor)); + _tree->create(mb_path / "fw_version") + .set(str(boost::format("%u.%u") % compat_major % compat_minor)); } void x300_impl::check_fpga_compat(const fs_path &mb_path, const mboard_members_t &members) diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 2e0bebded..20c54c6a7 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -230,7 +230,7 @@ private: const uhd::usrp::mboard_eeprom_t & ); - void check_fw_compat(const uhd::fs_path &mb_path, uhd::wb_iface::sptr iface); + void check_fw_compat(const uhd::fs_path &mb_path, const mboard_members_t &members); void check_fpga_compat(const uhd::fs_path &mb_path, const mboard_members_t &members); /// More IO stuff -- cgit v1.2.3