forked from M-Labs/artiq
1
0
Fork 0

artiq_devtool: add hotswap action.

This commit is contained in:
whitequark 2017-03-07 06:49:02 +00:00
parent 795a3e24d8
commit cce1481fac
1 changed files with 12 additions and 1 deletions

View File

@ -44,7 +44,7 @@ def get_argparser():
parser.add_argument("actions", metavar="ACTION", parser.add_argument("actions", metavar="ACTION",
type=str, default=[], nargs="+", type=str, default=[], nargs="+",
help="actions to perform, sequence of: " help="actions to perform, sequence of: "
"build boot boot+log connect clean") "build boot boot+log connect hotswap clean")
return parser return parser
@ -182,6 +182,17 @@ def main():
"{env} python3 flterm.py {serial} --output-only") "{env} python3 flterm.py {serial} --output-only")
drain(flterm) drain(flterm)
elif action == "hotswap":
logger.info("Hotswapping firmware")
try:
subprocess.check_call(["python3",
"-m", "artiq.frontend.artiq_coreboot",
"/tmp/{target}/software/{firmware}/{firmware}.bin"
.format(target=args.target, firmware=firmware)])
except subprocess.CalledProcessError:
logger.error("Build failed")
sys.exit(1)
else: else:
logger.error("Unknown action {}".format(action)) logger.error("Unknown action {}".format(action))
sys.exit(1) sys.exit(1)