From 18720e29cc4c03207816b79112132f971f43eb19 Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Tue, 5 Mar 2024 21:42:59 +0000 Subject: [PATCH] build/openocd: Fix tap name for zynq_7000 zynq_7000 have a special tap name fpr PL defined in openocd config file. Just hardcode it here. Signed-off-by: Jiaxun Yang --- litex/build/openocd.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/litex/build/openocd.py b/litex/build/openocd.py index 8518a586c..166fb2e26 100644 --- a/litex/build/openocd.py +++ b/litex/build/openocd.py @@ -40,6 +40,12 @@ class OpenOCD(GenericProgrammer): ]) self.call(["openocd", "-f", config, "-c", script]) + def get_tap_name(self, config): + cfg_str = open(config).read() + if "zynq_7000" in cfg_str: + return "zynq_pl.bs" + return "$_CHIPNAME.tap" + def get_ir(self, chain, config): cfg_str = open(config).read() # Lattice ECP5. @@ -98,6 +104,7 @@ class OpenOCD(GenericProgrammer): - TX valid : bit 9 """ config = self.find_config() + tap_name = self.get_tap_name(config) ir = self.get_ir(chain, config) endstate = self.get_endstate(config) cfg = """ @@ -186,8 +193,8 @@ proc jtagstream_serve {tap port} { script = "; ".join([ "init", "poll off", - "irscan $_CHIPNAME.tap {:d}".format(ir), - "jtagstream_serve $_CHIPNAME.tap {:d}".format(port), + "irscan {} {:d}".format(tap_name, ir), + "jtagstream_serve {} {:d}".format(tap_name, port), "exit", ]) self.call(["openocd", "-f", config, "-f", "stream.cfg", "-c", script])