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.
Mistyping the
devicevalue (in this exampleICE40UP5Kinstead ofiCE40UP5K) leads to unclear error messages onplatform.buildblinky.pyError output: