-
-
Save kmcallister/e01d6dff906cf4b8f8cb30ef157ae2da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
from nmigen.build import * | |
from nmigen.vendor.lattice_ice40 import * | |
from .resources import * | |
__all__ = ["AlchitryCuPlatform"] | |
class AlchitryCuPlatform(LatticeICE40Platform): | |
device = "iCE40HX8K" | |
package = "CB132" | |
default_clk = "clk12" | |
resources = [ | |
Resource("clk12", 0, Pins("J3", dir="i"), | |
Clock(12e6), Attrs(GLOBAL=True, IO_STANDARD="SB_LVCMOS")), | |
*LEDResources( | |
pins="J11 K11 K12 K14 L12 L14 M12 N14", | |
attrs=Attrs(IO_STANDARD="SB_LVCMOS") | |
), | |
UARTResource(0, | |
rx="M9", tx="P14", | |
attrs=Attrs(IO_STANDARD="SB_LVCMOS", PULLUP=1), | |
role="dce" | |
), | |
*SPIFlashResources(0, | |
cs_n="P13", clk="P12", copi="M11", cipo="P11", | |
attrs=Attrs(IO_STANDARD="SB_LVCMOS") | |
), | |
] | |
connectors = [ | |
# TODO | |
] | |
def toolchain_program(self, products, name): | |
iceprog = os.environ.get("ICEPROG", "iceprog") | |
with products.extract("{}.bin".format(name)) as bitstream_filename: | |
# TODO: this should be factored out and made customizable | |
subprocess.check_call([iceprog, "-S", bitstream_filename]) | |
if __name__ == "__main__": | |
from .test.blinky import * | |
AlchitryCuPlatform().build(Blinky(), do_program=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keegan@chlorophyllum:~/fpga-tools/nmigen/examples/board$ PYTHONPATH=~/fpga-tools/nmigen:~/fpga-tools/nmigen-boards python3 ./01_blinky.py | |
ERROR: BEL 'X0/Y18/io1' has no global buffer connection available | |
ERROR: Packing design failed. | |
0 warnings, 2 errors | |
Traceback (most recent call last): | |
File "./01_blinky.py", line 21, in <module> | |
platform.build(Blinky(), do_program=True) | |
File "/home/keegan/fpga-tools/nmigen/nmigen/build/plat.py", line 99, in build | |
products = plan.execute_local(build_dir) | |
File "/home/keegan/fpga-tools/nmigen/nmigen/build/run.py", line 98, in execute_local | |
subprocess.check_call(["sh", "{}.sh".format(self.script)]) | |
File "/usr/lib/python3.7/subprocess.py", line 347, in check_call | |
raise CalledProcessError(retcode, cmd) | |
subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment