Merge the build trees of sayma_amc and sayma_rtm targets.

This also makes them a single artiq_flash target, and a single
conda package.
This commit is contained in:
whitequark 2018-01-27 19:53:43 +00:00
parent 0b9c551962
commit 11a8b84355
10 changed files with 41 additions and 74 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ __pycache__/
/artiq/binaries /artiq/binaries
/artiq/firmware/target/ /artiq/firmware/target/
/misoc_*/ /misoc_*/
/artiq_*/
/artiq/test/results /artiq/test/results
/artiq/examples/*/results /artiq/examples/*/results

View File

@ -31,7 +31,7 @@ def get_argparser():
parser.add_argument("-t", "--target", metavar="TARGET", parser.add_argument("-t", "--target", metavar="TARGET",
type=str, default="kc705", type=str, default="kc705",
help="target to build, one of: " help="target to build, one of: "
"kc705 kasli sayma_rtm sayma_amc") "kc705 kasli sayma")
parser.add_argument("-g", "--build-gateware", parser.add_argument("-g", "--build-gateware",
default=False, action="store_true", default=False, action="store_true",
help="build gateware, not just software") help="build gateware, not just software")
@ -71,14 +71,10 @@ def main():
def build_dir(*path, target=args.target): def build_dir(*path, target=args.target):
return os.path.join("/tmp", target, *path) return os.path.join("/tmp", target, *path)
extra_build_args = []
if args.target == "kc705": if args.target == "kc705":
board_type, firmware = "kc705", "runtime" board_type, firmware = "kc705", "runtime"
elif args.target == "sayma_amc": elif args.target == "sayma":
board_type, firmware = "sayma_amc", "runtime" board_type, firmware = "sayma", "runtime"
extra_build_args += ["--rtm-csr-csv", build_dir("sayma_rtm_csr.csv", target="sayma_rtm")]
elif args.target == "sayma_rtm":
board_type, firmware = "sayma_rtm", None
else: else:
raise NotImplementedError("unknown target {}".format(args.target)) raise NotImplementedError("unknown target {}".format(args.target))
@ -132,6 +128,13 @@ def main():
logger.error(on_failure) logger.error(on_failure)
sys.exit(1) sys.exit(1)
def build(target, *extra_args, output_dir=build_dir()):
build_args = ["python3", "-m", "artiq.gateware.targets." + target, *extra_args]
if not args.build_gateware:
build_args.append("--no-compile-gateware")
build_args += ["--output-dir", output_dir]
command(*build_args, on_failure="Build failed")
def flash(*steps): def flash(*steps):
lock() lock()
@ -147,13 +150,11 @@ def main():
for action in args.actions: for action in args.actions:
if action == "build": if action == "build":
logger.info("Building target") logger.info("Building target")
if args.target == "sayma":
build_args = ["python3", "-m", "artiq.gateware.targets." + args.target] build("sayma_rtm", output_dir=build_dir("rtm"))
if not args.build_gateware: build("sayma_amc", "--rtm-csr-csv", build_dir("rtm", "rtm_csr.csv"))
build_args.append("--no-compile-gateware") else:
build_args += ["--output-dir", build_dir()] build(args.target)
build_args += extra_build_args
command(*build_args, on_failure="Build failed")
elif action == "clean": elif action == "clean":
logger.info("Cleaning build directory") logger.info("Cleaning build directory")

View File

@ -51,7 +51,7 @@ Prerequisites:
help="SSH host where the development board is located") help="SSH host where the development board is located")
parser.add_argument("-t", "--target", default="kc705", parser.add_argument("-t", "--target", default="kc705",
help="target board, default: %(default)s, one of: " help="target board, default: %(default)s, one of: "
"kc705 kasli sayma_amc sayma_rtm") "kc705 kasli sayma")
parser.add_argument("-V", "--variant", default=None, parser.add_argument("-V", "--variant", default=None,
help="board variant") help="board variant")
parser.add_argument("-I", "--preinit-command", default=[], action="append", parser.add_argument("-I", "--preinit-command", default=[], action="append",
@ -263,7 +263,7 @@ def main():
"storage": ("spi0", 0x440000), "storage": ("spi0", 0x440000),
"firmware": ("spi0", 0x450000), "firmware": ("spi0", 0x450000),
}, },
"sayma_amc": { "sayma": {
"programmer": ProgrammerSayma, "programmer": ProgrammerSayma,
"variants": ["standalone", "master", "satellite"], "variants": ["standalone", "master", "satellite"],
"gateware": ("spi0", 0x000000), "gateware": ("spi0", 0x000000),
@ -271,10 +271,6 @@ def main():
"storage": ("spi1", 0x040000), "storage": ("spi1", 0x040000),
"firmware": ("spi1", 0x050000), "firmware": ("spi1", 0x050000),
}, },
"sayma_rtm": {
"programmer": ProgrammerSayma,
"gateware": ("spi1", 0x150000),
},
}[args.target] }[args.target]
variant = args.variant variant = args.variant
@ -332,10 +328,9 @@ def main():
firmware_fbi = artifact_path("software", firmware, firmware + ".fbi") firmware_fbi = artifact_path("software", firmware, firmware + ".fbi")
programmer.write_binary(*config["firmware"], firmware_fbi) programmer.write_binary(*config["firmware"], firmware_fbi)
elif action == "load": elif action == "load":
if args.target == "sayma_rtm": if args.target == "sayma":
gateware_bit = artifact_path("top.bit") rtm_gateware_bit = artifact_path("rtm", "rtm.bit")
programmer.load(gateware_bit, 0) programmer.load(rtm_gateware_bit, 0)
elif args.target == "sayma_amc":
gateware_bit = artifact_path("gateware", "top.bit") gateware_bit = artifact_path("gateware", "top.bit")
programmer.load(gateware_bit, 1) programmer.load(gateware_bit, 1)
else: else:

View File

@ -439,12 +439,13 @@ def main():
description="Sayma AMC gateware and firmware builder") description="Sayma AMC gateware and firmware builder")
builder_args(parser) builder_args(parser)
soc_sdram_args(parser) soc_sdram_args(parser)
parser.set_defaults(output_dir="artiq_sayma")
parser.add_argument("-V", "--variant", default="standalone", parser.add_argument("-V", "--variant", default="standalone",
help="variant: " help="variant: "
"standalone/master/satellite " "standalone/master/satellite "
"(default: %(default)s)") "(default: %(default)s)")
parser.add_argument("--rtm-csr-csv", parser.add_argument("--rtm-csr-csv",
default=os.path.join("artiq_sayma_rtm", "sayma_rtm_csr.csv"), default=os.path.join("artiq_sayma", "rtm", "rtm_csr.csv"),
help="CSV file listing remote CSRs on RTM (default: %(default)s)") help="CSV file listing remote CSRs on RTM (default: %(default)s)")
parser.add_argument("--without-sawg", parser.add_argument("--without-sawg",
default=False, action="store_true", default=False, action="store_true",

View File

@ -190,7 +190,7 @@ class SaymaRTM(Module):
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="ARTIQ device binary builder for Kasli systems") description="ARTIQ device binary builder for Kasli systems")
parser.add_argument("--output-dir", default="artiq_sayma_rtm", parser.add_argument("--output-dir", default="artiq_sayma/rtm",
help="output directory for generated " help="output directory for generated "
"source files and binaries") "source files and binaries")
parser.add_argument("--no-compile-gateware", action="store_true", parser.add_argument("--no-compile-gateware", action="store_true",
@ -205,11 +205,11 @@ def main():
top = SaymaRTM(platform) top = SaymaRTM(platform)
os.makedirs(args.output_dir, exist_ok=True) os.makedirs(args.output_dir, exist_ok=True)
with open(os.path.join(args.output_dir, "sayma_rtm_csr.csv"), "w") as f: with open(os.path.join(args.output_dir, "rtm_csr.csv"), "w") as f:
f.write(get_csr_csv(top.csr_regions)) f.write(get_csr_csv(top.csr_regions))
if not args.no_compile_gateware: if not args.no_compile_gateware:
platform.build(top, build_dir=args.output_dir) platform.build(top, build_dir=args.output_dir, build_name="rtm")
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -0,0 +1,13 @@
#!/bin/bash
SOC_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq/binaries/sayma-standalone
mkdir -p $SOC_PREFIX
$PYTHON -m artiq.gateware.targets.sayma_rtm
cp artiq_sayma/rtm_gateware/rtm.bit $SOC_PREFIX
$PYTHON -m artiq.gateware.targets.sayma_amc -V standalone \
--rtm-csr-csv artiq_sayma/rtm/sayma_rtm_csr.csv
cp artiq_sayma/gateware/top.bit $SOC_PREFIX
cp artiq_sayma/software/bootloader/bootloader.bin $SOC_PREFIX
cp artiq_sayma/software/runtime/runtime.{elf,fbi} $SOC_PREFIX

View File

@ -1,5 +1,5 @@
package: package:
name: artiq-sayma_rtm name: artiq-sayma-standalone
version: {{ environ.get("GIT_DESCRIBE_TAG", "") }} version: {{ environ.get("GIT_DESCRIBE_TAG", "") }}
source: source:
@ -20,4 +20,4 @@ requirements:
about: about:
home: https://m-labs.hk/artiq home: https://m-labs.hk/artiq
license: LGPL license: LGPL
summary: 'Bitstream and CSR map for Sayma RTM' summary: 'AMC and RTM bitstream, BIOS and runtime for stand-alone Sayma AMC'

View File

@ -1,9 +0,0 @@
#!/bin/bash
SOC_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq/binaries/sayma_amc-standalone
mkdir -p $SOC_PREFIX
V=1 $PYTHON -m artiq.gateware.targets.sayma_amc -V standalone --rtm-csr-csv $SP_DIR/artiq/binaries/sayma_rtm/sayma_rtm_csr.csv
cp misoc_standalone_sayma_amc/gateware/top.bit $SOC_PREFIX
cp misoc_standalone_sayma_amc/software/bootloader/bootloader.bin $SOC_PREFIX
cp misoc_standalone_sayma_amc/software/runtime/runtime.{elf,fbi} $SOC_PREFIX

View File

@ -1,24 +0,0 @@
package:
name: artiq-sayma_amc-standalone
version: {{ environ.get("GIT_DESCRIBE_TAG", "") }}
source:
git_url: ../..
build:
noarch: python
ignore_prefix_files: True
number: {{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}
string: py_{{ environ.get("GIT_DESCRIBE_NUMBER", 0) }}+git{{ environ.get("GIT_FULL_HASH", "")[:8] }}
requirements:
build:
- artiq-dev {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
- artiq-sayma_rtm {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
run:
- artiq {{ "{tag} py_{number}+git{hash}".format(tag=environ.get("GIT_DESCRIBE_TAG"), number=environ.get("GIT_DESCRIBE_NUMBER"), hash=environ.get("GIT_FULL_HASH", "")[:8]) if "GIT_DESCRIBE_TAG" in environ else "" }}
about:
home: https://m-labs.hk/artiq
license: LGPL
summary: 'Bitstream, BIOS and runtime for stand-alone Sayma AMC'

View File

@ -1,11 +0,0 @@
#!/bin/bash
BUILD_SETTINGS_FILE=$HOME/.m-labs/build_settings.sh
[ -f $BUILD_SETTINGS_FILE ] && . $BUILD_SETTINGS_FILE
SOC_PREFIX=$PREFIX/lib/python3.5/site-packages/artiq/binaries/sayma_rtm
mkdir -p $SOC_PREFIX
$PYTHON -m artiq.gateware.targets.sayma_rtm
cp artiq_sayma_rtm/top.bit $SOC_PREFIX
cp artiq_sayma_rtm/sayma_rtm_csr.csv $SOC_PREFIX