Skip to content

Commit 8c02e84

Browse files
committed
xlx: change xlx xsdb client behaviour
Change the implementation of the xlx xsdb command to more intuitive and as internally discussed to get a interactive mode.
1 parent 1849594 commit 8c02e84

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

labgrid/driver/xsdbdriver.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"Xilinx System Debugger (XSDB) driver"
22
import attr
3+
import subprocess
34

45
from .common import Driver
56
from ..factory import target_factory
@@ -31,17 +32,22 @@ def __attrs_post_init__(self):
3132
self.xsdb_bin = 'xsdb'
3233

3334
@Driver.check_active
34-
@step(args=['tcl_cmds'])
35-
def run(self, tcl_cmds):
35+
@step(args=['tcl_cmds', 'interactive'])
36+
def run(self, tcl_cmds, interactive=False):
3637
url = self.interface.agent_url.split(":")
3738
if not url[1]:
3839
url[1] = self.interface.host
3940

4041
tcl_cmd = "connect -url {}; ".format(":".join(url))
41-
tcl_cmd += "; ".join(tcl_cmds) + "; disconnect"
42+
tcl_cmd += "; ".join(tcl_cmds)
43+
if not interactive:
44+
tcl_cmd += '; disconnect'
4245

4346
cmd = [self.xsdb_bin, "-eval", tcl_cmd]
44-
return processwrapper.check_output(cmd)
47+
if interactive:
48+
cmd.append('-interactive')
49+
50+
subprocess.run(cmd, check=True)
4551

4652
@Driver.check_active
4753
@step(args=['filename'])

labgrid/remote/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,11 +1307,10 @@ def _get_xlx(self, name):
13071307
return drv
13081308

13091309
def xlx_run_xsdb(self):
1310-
drv = self._get_xlx(self.args.name)
1310+
_, drv = self._get_xlx(self.args.name)
13111311

1312-
processwrapper.enable_print()
1313-
drv.run([self.args.tcl_cmds])
1314-
processwrapper.disable_print()
1312+
drv.run([self.args.tcl_cmds],
1313+
interactive = self.args.interactive or not bool(self.args.tcl_cmds))
13151314

13161315
def xlx_program_bitstream(self):
13171316
drv = self._get_xlx(self.args.name)
@@ -1912,8 +1911,9 @@ def main():
19121911
metavar="SUBCOMMAND",
19131912
)
19141913

1915-
xlx_subparser = xlx_subparsers.add_parser('xsdb', help="run XSDB")
1916-
xlx_subparser.add_argument('tcl_cmds', help="Tcl commands")
1914+
xlx_subparser = xlx_subparsers.add_parser('xsdb', help="run XSDB and connect to Vivado hardware server")
1915+
xlx_subparser.add_argument('tcl_cmds', nargs='?', default='', help="Tcl command to execute")
1916+
xlx_subparser.add_argument('-i', '--interactive', action='store_true', help="enter interactive mode after executing Tcl command")
19171917
xlx_subparser.set_defaults(func=ClientSession.xlx_run_xsdb)
19181918

19191919
xlx_subparser = xlx_subparsers.add_parser('program-bitstream', help="program bitstream")

0 commit comments

Comments
 (0)