artiq_devtool: add reset action.

This commit is contained in:
whitequark 2017-03-07 14:37:08 +00:00
parent 5bbb05362b
commit b391598c87
1 changed files with 8 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 hotswap clean") "build reset boot boot+log connect hotswap clean")
return parser return parser
@ -117,6 +117,13 @@ def main():
if os.path.isdir(target_dir): if os.path.isdir(target_dir):
shutil.rmtree(target_dir) shutil.rmtree(target_dir)
elif action == "reset":
logger.info("Resetting device")
artiq_flash = run_command(
"{env} artiq_flash start" +
(" --target-file " + args.config if args.config else ""))
drain(artiq_flash)
elif action == "boot" or action == "boot+log": elif action == "boot" or action == "boot+log":
logger.info("Uploading firmware") logger.info("Uploading firmware")
get_sftp().mkdir("/tmp/{tmp}".format(tmp=tmp)) get_sftp().mkdir("/tmp/{tmp}".format(tmp=tmp))