Added qemu toolchain and created zynq ps targets

Signed-off-by: Joppe Blondel <joppe@blondel.nl>
This commit is contained in:
2022-09-09 13:54:55 +02:00
parent 15d7e8b801
commit e18a0c1762
18 changed files with 1394 additions and 36 deletions

View File

@ -1,12 +1,15 @@
#!/usr/bin/env python3
import configparser
from re import sub
import sys
import signal
def log(*args):
print(*args)
sys.stdout.flush()
def print_help():
log("Unified FPGA synthesizer frontend\r\n(c) Joppe Blondel - 2022\r\n")
log(f"Usage: {sys.argv[0]} [ OPTIONS ] target ...")
@ -45,31 +48,38 @@ if __name__=="__main__":
subprocesses = []
try:
def sighandler(num, frame):
if num==signal.SIGINT:
log("\rStopping rbuild")
for p in subprocesses:
p.terminate()
signal.alarm(4)
elif num==signal.SIGALRM:
log("Force killing subprocesses")
for p in subprocesses:
p.kill()
exit(0)
for target in targets:
signal.signal(signal.SIGINT, sighandler)
signal.signal(signal.SIGALRM, sighandler)
log("Target", target)
for target in targets:
toolchain = config.get(f'target.{target}', 'toolchain', fallback='NONE')
if toolchain=='NONE':
log("ERROR: No toolchain specified for target")
exit(1)
try:
exec(f"from remotesyn.toolchains.{toolchain} import do")
except ImportError:
log(f"ERROR: Unknown toolchain '{toolchain}'")
exit(1)
log("Target", target)
ret = do(config, target, log, subprocesses)
toolchain = config.get(f'target.{target}', 'toolchain', fallback='NONE')
if toolchain=='NONE':
log("ERROR: No toolchain specified for target")
exit(1)
try:
exec(f"from remotesyn.toolchains.{toolchain} import do")
except ImportError:
log(f"ERROR: Unknown toolchain '{toolchain}'")
exit(1)
if ret!=0:
log("ERROR: toolchain returned with", ret)
exit(ret)
ret = do(config, target, log, subprocesses)
except KeyboardInterrupt:
log("\rStopping rbuild")
for p in subprocesses:
p.kill()
exit(0)
if ret!=0:
log("ERROR: toolchain returned with", ret)
exit(ret)

View File

@ -7,6 +7,7 @@ import base64
import struct
import os
import json
import signal
def cmd(cmd, channel):
channel.exec_command(base64.encodebytes(cmd))
@ -145,6 +146,19 @@ if __name__=="__main__":
exit(1)
subprocesses = []
stopped = False
def sighandler(num, frame):
global stopped
if num==signal.SIGINT:
print("\rStopping rbuild")
stopped = True
for p in subprocesses:
p.terminate()
exit(0)
signal.signal(signal.SIGINT, sighandler)
signal.signal(signal.SIGALRM, sighandler)
try:
# Send project identification
@ -153,6 +167,8 @@ if __name__=="__main__":
cmd(b'cf' + sstr(json.dumps({s:dict(config.items(s)) for s in config.sections()})), channel)
for target in targets:
if stopped:
break
print("Target", target)
@ -193,14 +209,10 @@ if __name__=="__main__":
print("ERROR: toolchain returned with", ret)
exit(ret)
cmd(b'ex', channel)
except paramiko.ssh_exception.SSHException as e:
print("ERROR: Connection error...", e)
for p in subprocesses:
p.kill()
exit(0)
except KeyboardInterrupt:
print("\rStopping rmbuild")
for p in subprocesses:
p.kill()
exit(0)

View File

@ -100,7 +100,6 @@ class SSHServer(paramiko.ServerInterface):
for t in self.threads:
if type(t) is not NoneType:
t.stop()
t.join()
def check_channel_request(self, kind, chanid):
if kind == 'session':
@ -143,7 +142,7 @@ class SSHServer(paramiko.ServerInterface):
# Exit
elif cmd==b'ex':
print('<', self.identifier)
self.event.set()
self.stop()
# Config
elif cmd==b'cf':
@ -245,9 +244,10 @@ class Connection(threading.Thread):
time.sleep(0.2)
else:
print("Connection", self.addr, "closed")
if server.identifier!='':
pass
shutil.rmtree(server.identifier, True)
print("Deleting directory")
shutil.rmtree(server.identifier, True)
transport.close()
def print_help():