From d25614e6ae3504f34afe7f330ce1e0079fa7ab52 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 2 Aug 2019 11:00:37 -0700 Subject: B200: Add command to query bootloader status Updated b2xx_fx3_utils to add a --query_bootloader option to check if the bootloader is loaded or not. Signed-off-by: michael-west --- host/utils/b2xx_fx3_utils.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp index c94badc9d..e495262be 100644 --- a/host/utils/b2xx_fx3_utils.cpp +++ b/host/utils/b2xx_fx3_utils.cpp @@ -334,7 +334,8 @@ int32_t main(int32_t argc, char* argv[]) "load-fpga,L", po::value(&fpga_file), "Load a FPGA (bin) file into the FPGA.")( "load-bootloader,B", po::value(&bl_file), - "Load a bootloader (img) file into the EEPROM"); + "Load a bootloader (img) file into the EEPROM")( + "query-bootloader,Q", "Check if bootloader is loaded."); // Hidden options provided for testing - use at your own risk! po::options_description hidden("Hidden options"); @@ -666,6 +667,13 @@ int32_t main(int32_t argc, char* argv[]) std::cerr << "Exception while resetting FX3: " << e.what() << std::endl; return EXIT_FAILURE; } + } else if (vm.count("query-bootloader")) { + auto signature = b200->read_eeprom(0x0, 0x0, 4); + if (signature != NEW_EEPROM_SIGNATURE) { + std::cout << "No bootloader found on device" << std::endl; + return EXIT_FAILURE; + } + std::cout << "Bootloader is present" << std::endl; } std::cout << "Operation complete! I did it! I did it!" << std::endl; -- cgit v1.2.3