[[debugging amaranth toolchain]], [[Glasgow Notes]]
from `software/glasgow/target/hardware.py`, line 114 (in `class GlasgowBuildPlan`):
```python
def execute(self, build_dir=None, *, debug=False):
if build_dir is None:
build_dir = tempfile.mkdtemp(prefix="glasgow_")
try:
products = self.lower.execute_local(build_dir)
bitstream = products.get("top.bin")
except:
if debug:
logger.info("keeping build tree as %s", build_dir)
raise
finally:
if not debug:
shutil.rmtree(build_dir)
return bitstream
```
By default it stores its files in a temp directory, and deletes it after running
But if you run it in debug mode, it will keep the build directory and tell you where it is
It looks like build arguments for yosys/nextpnr are set here in line 87 (in `class GlasgowHardwareTarget`):
```python
def build_plan(self, **kwargs):
overrides = {
"synth_opts": "-abc9",
"nextpnr_opts": "--placer heap",
}
overrides.update(kwargs)
return GlasgowBuildPlan(self.platform.prepare(self, **overrides))
```
more arguments are added by Amaranth, see [[debugging amaranth toolchain]]
i tried adding `--routed-svg "test.svg"` here to get the visual render but no luck.
Glasgow build arguments:
```bash
optional arguments:
-h, --help show this help message and exit
--override-required-revision
(advanced) override applet revision requirement
--rev REVISION board revision
--trace include applet analyzer
-t TYPE, --type TYPE artifact to build (one of: archive rtlil bitstream, default: bitstream)
-f FILENAME, --filename FILENAME
file to save artifact to (default: <applet-name>.{zip,il,bin})
```