forked from M-Labs/artiq
1
0
Fork 0

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/firmware/target/
/misoc_*/
/artiq_*/
/artiq/test/results
/artiq/examples/*/results

View File

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

View File

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

View File

@ -439,12 +439,13 @@ def main():
description="Sayma AMC gateware and firmware builder")
builder_args(parser)
soc_sdram_args(parser)
parser.set_defaults(output_dir="artiq_sayma")
parser.add_argument("-V", "--variant", default="standalone",
help="variant: "
"standalone/master/satellite "
"(default: %(default)s)")
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)")
parser.add_argument("--without-sawg",
default=False, action="store_true",

View File

@ -190,7 +190,7 @@ class SaymaRTM(Module):
def main():
parser = argparse.ArgumentParser(
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 "
"source files and binaries")
parser.add_argument("--no-compile-gateware", action="store_true",
@ -205,11 +205,11 @@ def main():
top = SaymaRTM(platform)
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))
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__":

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:
name: artiq-sayma_rtm
name: artiq-sayma-standalone
version: {{ environ.get("GIT_DESCRIBE_TAG", "") }}
source:
@ -20,4 +20,4 @@ requirements:
about:
home: https://m-labs.hk/artiq
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