From 8537b9c9a53f1a972917f4253526d978cd4660f7 Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Thu, 20 Dec 2018 15:39:32 +0100 Subject: [PATCH] gen_part_base_yaml.cc: Added the possibility to read FAR registers For xc7z boards the Debug bitstream is unavailable. To get the necessary information we can use the FAR addresses present in the perframecrc bitstream. The gen_part_base_yaml tool has been modified to have the possibility to read the FAR addresses depending on a flag setting. Signed-off-by: Alessandro Comodi --- tools/CMakeLists.txt | 2 +- tools/gen_part_base_yaml.cc | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 85023a91..1a0bec1b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -16,8 +16,8 @@ target_link_libraries(gen_part_base_yaml absl::span libprjxray yaml-cpp + gflags ) - add_executable(xc7patch xc7patch.cc) target_link_libraries(xc7patch absl::strings diff --git a/tools/gen_part_base_yaml.cc b/tools/gen_part_base_yaml.cc index 9767bce2..a215e639 100644 --- a/tools/gen_part_base_yaml.cc +++ b/tools/gen_part_base_yaml.cc @@ -6,8 +6,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -15,9 +17,15 @@ #include #include +DEFINE_bool(f, false, "Use FAR registers instead of LOUT ones"); + namespace xc7series = prjxray::xilinx::xc7series; int main(int argc, char* argv[]) { + gflags::SetUsageMessage( + absl::StrCat("Usage: ", argv[0], " [bitfile] [options]")); + gflags::ParseCommandLineFlags(&argc, &argv, true); + if (argc < 2) { std::cerr << "ERROR: no input specified" << std::endl; std::cerr << "Usage: " << basename(argv[0]) << " " @@ -59,8 +67,15 @@ int main(int argc, char* argv[]) { } else if (found_fdri_write && (packet.address() == xc7series::ConfigurationRegister::LOUT) && - packet.data().size() == 1) { + (packet.data().size() == 1) && FLAGS_f == false) { frame_addresses.push_back(packet.data()[0]); + found_fdri_write = false; + } else if (found_fdri_write && + (packet.address() == + xc7series::ConfigurationRegister::FAR) && + (packet.data().size() == 1) && FLAGS_f == true) { + frame_addresses.push_back(packet.data()[0]); + found_fdri_write = false; } } @@ -70,8 +85,9 @@ int main(int argc, char* argv[]) { } if (frame_addresses.empty()) { - std::cerr << "No LOUT writes found. Was " - << "BITSTREAM.GENERAL.DEBUGBITSTREAM set to YES?" + std::cerr << "No LOUT or FAR writes found. Was " + << "BITSTREAM.GENERAL.DEBUGBITSTREAM or " + << "BITSTREAM.GENERAL.PERFRAMECRC set to YES?" << std::endl; return 1; }