Skip to content

Commit 9055090

Browse files
committedApr 12, 2020
build.plat: don't check for toolchain presence if do_build=False.
1 parent 0e40dc0 commit 9055090

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

Diff for: ‎nmigen/build/plat.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,19 @@ def build(self, elaboratable, name="top",
7171
build_dir="build", do_build=True,
7272
program_opts=None, do_program=False,
7373
**kwargs):
74-
if self._toolchain_env_var not in os.environ:
74+
# The following code performs a best-effort check for presence of required tools upfront,
75+
# before performing any build actions, to provide a better diagnostic. It does not handle
76+
# several corner cases:
77+
# 1. `require_tool` does not source toolchain environment scripts, so if such a script
78+
# is used, the check is skipped, and `execute_local()` may fail;
79+
# 2. if the design is not built (do_build=False), most of the tools are not required and
80+
# in fact might not be available if the design will be built manually with a different
81+
# environment script specified, or on a different machine; however, Yosys is required
82+
# by virtually every platform anyway, to provide debug Verilog output, and `prepare()`
83+
# may fail.
84+
# This is OK because even if `require_tool` succeeds, the toolchain might be broken anyway.
85+
# The check only serves to catch common errors earlier.
86+
if do_build and self._toolchain_env_var not in os.environ:
7587
for tool in self.required_tools:
7688
require_tool(tool)
7789

1 commit comments

Comments
 (1)

whitequark commented on Apr 12, 2020

@whitequark
MemberAuthor
Please sign in to comment.