Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistyping device definition leads to unclear errors. #337

Closed
jchidley opened this issue Mar 17, 2020 · 0 comments
Closed

Mistyping device definition leads to unclear errors. #337

jchidley opened this issue Mar 17, 2020 · 0 comments
Labels
Milestone

Comments

@jchidley
Copy link

Mistyping the device value (in this example ICE40UP5K instead of iCE40UP5K) leads to unclear error messages on platform.build

blinky.py

from nmigen import *
import os
import subprocess

from nmigen.build import *
from nmigen.vendor.lattice_ice40 import *
from nmigen_boards.resources import *

class board(LatticeICE40Platform):
    device      = "ICE40UP5K"
    package     = "SG48"
    resources   = [
        *LEDResources(pins="41", attrs=Attrs(IO_STANDARD="SB_LVCMOS")),
    ]

    connectors  = []

    def toolchain_program(self, products, name):
        iceprog = os.environ.get("ICEPROG", "iceprog")
        with products.extract("{}.bin".format(name)) as bitstream_filename:
            subprocess.check_call([iceprog, "-S", bitstream_filename])

class Blinky(Elaboratable):
    def elaborate(self, platform):
        led   = platform.request("led", 0)
        timer = Signal(20)

        m = Module()
        m.domains.sync = sync = ClockDomain()
        m.submodules.osc = Instance(
            "SB_HFOSC",
            p_CLKHF_DIV="0b00",
            o_CLKHF=sync.clk,
        )

        m.d.sync += timer.eq(timer + 1)
        m.d.comb += led.o.eq(timer[-1])
        return m


if __name__ == "__main__":

    platform = board()
    platform.build(Blinky(), do_program=False)

Error output:

ERROR: Unable to place cell 'osc_OSC' of type 'ICESTORM_HFOSC'
ERROR: Packing design failed.
0 warnings, 2 errors
Traceback (most recent call last):
  File "/home/jack/nmigen/examples/board/01_blinky.py", line 51, in <module>
    platform.build(Blinky(), do_program=False)
  File "/home/jack/.local/lib/python3.8/site-packages/nmigen/build/plat.py", line 82, in build
    products = plan.execute_local(build_dir)
  File "/home/jack/.local/lib/python3.8/site-packages/nmigen/build/run.py", line 98, in execute_local
    subprocess.check_call(["sh", "{}.sh".format(self.script)])
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
@whitequark whitequark added this to the 0.3 milestone Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants