artiq_devtool: flash gateware if -g is passed.

This commit is contained in:
whitequark 2018-03-15 08:33:53 +00:00
parent 9ea7d7a804
commit 5cb2602021
1 changed files with 12 additions and 8 deletions

View File

@ -36,9 +36,9 @@ def get_argparser():
parser.add_argument("-V", "--variant", metavar="VARIANT", parser.add_argument("-V", "--variant", metavar="VARIANT",
type=str, default=None, type=str, default=None,
help="variant to build, dependent on the target") help="variant to build, dependent on the target")
parser.add_argument("-g", "--build-gateware", parser.add_argument("-g", "--gateware",
default=False, action="store_true", default=False, action="store_true",
help="build gateware, not just software") help="build/flash gateware, not just software")
parser.add_argument("--args", metavar="ARGS", parser.add_argument("--args", metavar="ARGS",
type=shlex.split, default=[], type=shlex.split, default=[],
help="extra arguments for gateware/firmware build") help="extra arguments for gateware/firmware build")
@ -144,7 +144,7 @@ def main():
def build(target, *extra_args, output_dir=build_dir(), variant=variant): def build(target, *extra_args, output_dir=build_dir(), variant=variant):
build_args = ["python3", "-m", "artiq.gateware.targets." + target, *extra_args] build_args = ["python3", "-m", "artiq.gateware.targets." + target, *extra_args]
if not args.build_gateware: if not args.gateware:
build_args.append("--no-compile-gateware") build_args.append("--no-compile-gateware")
if variant: if variant:
build_args += ["--variant", variant] build_args += ["--variant", variant]
@ -183,15 +183,19 @@ def main():
flash("start") flash("start")
elif action == "flash": elif action == "flash":
logger.info("Flashing and booting firmware") gateware = ["gateware"] if args.gateware else []
flash("bootloader", "firmware", "start")
logger.info("Flashing and booting")
flash(*gateware, "bootloader", "firmware", "start")
elif action == "flash+log": elif action == "flash+log":
logger.info("Flashing firmware") gateware = ["gateware"] if args.gateware else []
flash("bootloader", "firmware")
logger.info("Flashing")
flash(*gateware, "bootloader", "firmware")
flterm = client.spawn_command(["flterm", serial, "--output-only"]) flterm = client.spawn_command(["flterm", serial, "--output-only"])
logger.info("Booting firmware") logger.info("Booting")
flash("start") flash("start")
client.drain(flterm) client.drain(flterm)