From 34ed5672c3e609ac0ce2759670d17b38b32c149c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 6 May 2021 15:41:25 +0200 Subject: [PATCH] tools/litex_server/litex_term: Add --jtag-chain argument. --- litex/tools/litex_server.py | 3 ++- litex/tools/litex_term.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/litex/tools/litex_server.py b/litex/tools/litex_server.py index 56e222885..89a5d8085 100755 --- a/litex/tools/litex_server.py +++ b/litex/tools/litex_server.py @@ -178,6 +178,7 @@ def main(): # JTAG arguments parser.add_argument("--jtag", action="store_true", help="Select JTAG interface") parser.add_argument("--jtag-config", default="openocd_xc7_ft232.cfg", help="OpenOCD JTAG configuration file") + parser.add_argument("--jtag-chain", default=1, help="JTAG chain") # UDP arguments parser.add_argument("--udp", action="store_true", help="Select UDP interface") @@ -212,7 +213,7 @@ def main(): elif args.jtag: from litex.tools.litex_term import JTAGUART from litex.tools.remote.comm_uart import CommUART - bridge = JTAGUART(config=args.jtag_config) + bridge = JTAGUART(config=args.jtag_config, chain=int(args.jtag_chain)) bridge.open() print("[CommUART] port: JTAG / ", end="") comm = CommUART(os.ttyname(bridge.name), debug=args.debug) diff --git a/litex/tools/litex_term.py b/litex/tools/litex_term.py index 9b7a92fad..473886965 100755 --- a/litex/tools/litex_term.py +++ b/litex/tools/litex_term.py @@ -133,9 +133,10 @@ class BridgeUART: from litex.build.openocd import OpenOCD class JTAGUART: - def __init__(self, config="openocd_xc7_ft2232.cfg", port=20000): + def __init__(self, config="openocd_xc7_ft2232.cfg", port=20000, chain=1): self.config = config self.port = port + self.chain = chain def open(self): self.file, self.name = pty.openpty() @@ -156,7 +157,7 @@ class JTAGUART: def jtag2tcp(self): prog = OpenOCD(self.config) - prog.stream(self.port) + prog.stream(self.port, self.chain) def pty2tcp(self): while True: @@ -540,6 +541,7 @@ def _get_args(): parser.add_argument("--jtag-name", default="jtag_uart", help="JTAG UART type: jtag_uart (default), jtag_atlantic") parser.add_argument("--jtag-config", default="openocd_xc7_ft2232.cfg", help="OpenOCD JTAG configuration file for jtag_uart") + parser.add_argument("--jtag-chain", default=1, help="JTAG chain.") return parser.parse_args() def main(): @@ -560,7 +562,7 @@ def main(): term.payload_length = 128 term.delay = 1e-6 elif args.jtag_name == "jtag_uart": - bridge = JTAGUART(config=args.jtag_config) + bridge = JTAGUART(config=args.jtag_config, chain=int(args.jtag_chain)) bridge.open() port = os.ttyname(bridge.name) else: