forked from M-Labs/artiq
1
0
Fork 0

add runelf debug utility

This commit is contained in:
Sebastien Bourdeauducq 2014-10-15 16:11:47 +08:00
parent 0c9632d71b
commit 7110f3640e
1 changed files with 28 additions and 0 deletions

28
frontend/runelf Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import argparse
from artiq.devices import corecom_serial
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()
with corecom_serial.CoreCom() as com:
runtime_env = com.get_runtime_env()
if args.e:
print(runtime_env)
com.load(binary)
com.run(args.f)
com.serve(dict(), dict())
if __name__ == "__main__":
main()