diff --git a/doc/setup.rst b/doc/setup.rst index 606229b..2f6473b 100644 --- a/doc/setup.rst +++ b/doc/setup.rst @@ -51,12 +51,9 @@ yosys internally, it is best to install the full version (not amaranth-yowasp). easiest way to do that is to install `oss-cad-suite `__. If you only want to develop for Lattice ECP5, you are now done. -If you want to develop for Xilinx Zynq, you additionally need to install Vivado. -The naps cli can handle Vivado inside docker, which is handy for example on macOS -(see `this repo `_ for an example on how to do this). -For this, you need to supply the environment variable ``NAPS_BUILD_DOCKER_IMAGE`` -and ``NAPS_BUILD_DOCKER_ARGS``. If you have vivado installed natively, you have to supply -the environment variable ``AMARANTH_ENV_VIVADO``. +If you want to develop for Xilinx Zynq, you need Vivado. If amaranth cant find a Vivado installation +naps will download and use a docker container containing Vivado. Note that this container is very large +(>15GB extracted; >5GB download) and downloading it for the first time is very slow. For using the ``JTAGSoc`` you also need to install openocd. The current platforms assume that you use a jlink JTAG probe but that can easily be changed (just search for diff --git a/naps/soc/cli.py b/naps/soc/cli.py index 635900e..480c0cc 100644 --- a/naps/soc/cli.py +++ b/naps/soc/cli.py @@ -11,6 +11,7 @@ from datetime import timedelta from amaranth import Fragment +from amaranth._toolchain import require_tool, ToolNotFound from amaranth.vendor import LatticePlatform from amaranth.build.run import LocalBuildProducts, BuildPlan @@ -170,15 +171,18 @@ def cli(top_class): # build the gateware timer.start_task("vendor toolchain build") - - if "NAPS_BUILD_DOCKER_IMAGE" in os.environ: - docker_image = os.environ["NAPS_BUILD_DOCKER_IMAGE"] - docker_args = shlex.split(os.environ["NAPS_BUILD_DOCKER_ARGS"]) + + if platform.toolchain == "Vivado" and not platform.has_required_tools(): + print("using vivado in docker") + docker_image = "siliconbootcamp/xilinx-vivado:stable" + docker_args = [ + "--entrypoint=", + "-e", "PATH=/tools/Xilinx/Vivado/2021.1/bin:/tools/Xilinx/Vivado/2021.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "-e", "LD_PRELOAD=/lib/x86_64-linux-gnu/libudev.so.1" + ] build_products = build_plan.execute_local_docker( root=gateware_build_dir, image=docker_image, docker_args=docker_args ) - else: - build_products = build_plan.execute_local(gateware_build_dir) # we write the cache key file in the end also as a marking that the build was successful cache_key_path.write_text(elaborated_repr)