Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions doc/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/YosysHQ/oss-cad-suite-build>`__.
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 <https://github.com/ichi4096/vivado-on-silicon-mac>`_ 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
Expand Down
16 changes: 10 additions & 6 deletions naps/soc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
Loading