2014-10-15 16:11:47 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import argparse
|
2014-10-19 23:51:49 +08:00
|
|
|
from artiq.coredevice import comm_serial
|
2014-10-15 16:11:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser(description="Core device ELF loading tool")
|
|
|
|
parser.add_argument("-e", default=False, action="store_true",
|
|
|
|
help="show environment")
|
|
|
|
parser.add_argument("-f", default="run",
|
|
|
|
help="function to run")
|
|
|
|
parser.add_argument("file",
|
|
|
|
help="ELF binary to load")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
with open(args.file, "rb") as f:
|
|
|
|
binary = f.read()
|
2014-12-01 15:24:38 +08:00
|
|
|
with comm_serial.Comm() as comm:
|
2014-10-19 23:51:49 +08:00
|
|
|
runtime_env = comm.get_runtime_env()
|
2014-10-15 16:11:47 +08:00
|
|
|
if args.e:
|
|
|
|
print(runtime_env)
|
2014-10-19 23:51:49 +08:00
|
|
|
comm.load(binary)
|
|
|
|
comm.run(args.f)
|
|
|
|
comm.serve(dict(), dict())
|
2014-10-15 16:11:47 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|