tools/litex_server/litex_term: Add --jtag-chain argument.

This commit is contained in:
Florent Kermarrec 2021-05-06 15:41:25 +02:00
parent 24105f12d5
commit 34ed5672c3
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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: