greatscottgadgets / luna

Amaranth HDL framework for monitoring, hacking, and developing USB devices
https://greatscottgadgets.com/cynthion/
BSD 3-Clause "New" or "Revised" License
991 stars 171 forks source link

[DOC] please give example how to run luna/examples #258

Open hstarmans opened 5 months ago

hstarmans commented 5 months ago

Thank for your effort and keeping this repo up to date, I get several warning when using code from the repo and I am not sure how to use it anymore. How do I run the blinky test? I now do the following

git clone https://github.com/greatscottgadgets/luna.git
cd luna/
python3 -m venv .venv
source .venv/bin/activate
pip install .
pip install cynthion
pip install git+https://github.com/amaranth-lang/amaranth-boards
pip install yowasp-nextpnr-ecp5
pip install yowasp-yosys
export NEXTPNR_ECP5=yowasp-nextpnr-ecp5
export ECPPACK=yowasp-ecppack
export YOSYS=yowasp-yosys
export LUNA_PLATFORM=cynthion.gateware.platform.cynthion_r0_4:CynthionPlatformRev0D4
python examples/blinky/blinky.py --dry-run

This fails, also for more recent boards.

INFO    | __init__    | Building for Cynthion r0.4...
ERROR: Module `\SGSR' referenced in module `\top.cd_sync' in cell `\U$$2' is not part of the design.
Traceback (most recent call last):
  File "/home/hstarmans/python/luna/examples/blinky/blinky.py", line 41, in <module>
    top_level_cli(Blinky)
  File "/home/hstarmans/python/luna/.venv/lib/python3.10/site-packages/luna/__init__.py", line 113, in top_level_cli
    products = platform.build(fragment,
  File "/home/hstarmans/python/luna/.venv/lib/python3.10/site-packages/amaranth/build/plat.py", line 109, in build
    products = plan.execute_local(build_dir)
  File "/home/hstarmans/python/luna/.venv/lib/python3.10/site-packages/amaranth/build/run.py", line 104, in execute_local
    subprocess.check_call(["sh", f"{self.script}.sh"],
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 1.

Debug_spi seems still broken https://github.com/greatscottgadgets/luna/issues/101


INFO    | __init__    | Building for Cynthion r0.4...
/home/hstarmans/python/luna/.venv/lib/python3.10/site-packages/luna/gateware/utils/cdc.py:40: DriverConflict: Signal '(sig output__sdo__o)' is driven from multiple fragments: top, top.<unnamed #3>; hierarchy will be flattened
  output = Record.like(signal)
ERROR: Module `\SGSR' referenced in module `\top.cd_sync' in cell `\U$$2' is not part of the design.
Traceback (most recent call last):
``
miek commented 5 months ago

I couldn't reproduce the issue when running the commands you posted:

INFO    | __init__    | Building for Cynthion r0.4...
Preparing to run yowasp-yosys. This might take a while...
Preparing to run yowasp-nextpnr-ecp5. This might take a while...
Preparing to run yowasp-ecppack. This might take a while...
INFO    | __init__    | Build complete.

Could try running blinky.py again with AMARANTH_verbose=1 and post the output?