line = listenfile.readline()
if not line:
time.sleep(1)
- if "Listening on port 5555" in line:
+ match = re.match(r"^Listening on port (\d+)$", line)
+ if match:
done = True
+ self.port = int(match.group(1))
+ print "Using port %d for JTAG VPI" % self.port
def __del__(self):
try:
# line, since they are executed in order.
cmd[1:1] = ["--command", "gdb_port %d" % self.port]
+ env = os.environ.copy()
+ env['JTAG_VPI_PORT'] = str(otherProcess.port)
+
logfile = open(Openocd.logname, "w")
logfile.write("+ %s\n" % " ".join(cmd))
logfile.flush()
self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE,
- stdout=logfile, stderr=logfile)
+ stdout=logfile, stderr=logfile, env=env)
# Wait for OpenOCD to have made it through riscv_examine(). When using
# OpenOCD to communicate with a simulator this may take a long time,