Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Jun 10, 2021
1 parent a6d9e70 commit d5d966e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions python/tvm/micro/contrib/zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ def __init__(self, base_dir, startup_timeout_sec=5.0, qemu_debugger=None, **kwar
self.pipe_dir = None
self.qemu_debugger = qemu_debugger
self._queue = queue.Queue()
self._qemu_ready_msg = "Qready"

def timeouts(self):
return TransportTimeouts(
Expand Down Expand Up @@ -714,15 +713,27 @@ def _qemu_check_stdout(self):
line = str(line)
_LOG.debug(line)
if "[QEMU] CPU" in line:
self._queue.put(self._qemu_ready_msg)
return
self._queue.put(True)
continue
else:
line = re.sub('[^a-zA-Z0-9 \n]', '', line)
pattern = r'recipe for target (\w*) failed'
if re.search(pattern, line, re.IGNORECASE):
self._queue.put("make failed")
self._queue.put("EOF")

def _wait_for_qemu(self):
threading.Thread(target=self._qemu_check_stdout, daemon=True).start()
while True:
item = self._queue.get()
if item == self._qemu_ready_msg:
return True
try:
item = self._queue.get(timeout=120)
except:
_LOG.error("QEMU setup timeout.")

if item == True:
return
elif item == "make failed" or item == "EOF":
raise RuntimeError("QEMU setup failed.")


class ZephyrDebugger(debugger.GdbDebugger):
Expand Down

0 comments on commit d5d966e

Please sign in to comment.