aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2025-09-13 19:57:43 -0400
committerIan McIntyre <me@mciantyre.dev>2025-09-13 20:05:35 -0400
commit92205fb928150245c1683abdf8171fb89a99d629 (patch)
treee67b80524c750e025817ba1174380ee1256411b4
parent7e24efe2f6e95afddd0c1b56f1a9423c48caa472 (diff)
Add Alchitry CuV2 boardHEADmain
Once flashed, the J11 LED alternate blinks with all the other LEDs. If you hold the button, all LEDs blink in unison. The board definition is otherwise incomplete. The iceprog '-u' flag is available in my icestorm fork. This needs a bunch of environment variables to build and run. Make sure you have all the other Amaranth things installed. Here's a very manual way to set the env vars, just in case you haven't put anything on your path. YOSYS=yowasp-yosys \ NEXTPNR_ICE40=yowasp-nextpnr-ice40 \ ICEPACK=path/to/your/icepack \ ICEPROG=path/to/your/iceprog \ python3 -m amaranth_boards.alchitry_cuv2
-rw-r--r--amaranth_boards/alchitry_cuv2.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/amaranth_boards/alchitry_cuv2.py b/amaranth_boards/alchitry_cuv2.py
new file mode 100644
index 0000000..e6bb7ce
--- /dev/null
+++ b/amaranth_boards/alchitry_cuv2.py
@@ -0,0 +1,50 @@
+import os
+import subprocess
+
+from amaranth import *
+from amaranth.build import *
+from amaranth.vendor import LatticeICE40Platform
+from .resources import *
+
+
+class AlchitryCuV2Platform(LatticeICE40Platform):
+ device = "iCE40HX8K"
+ package = "CB132"
+ speed = "1"
+ default_clk = "clk100"
+ resources = [
+ Resource(
+ "clk100", 0, Pins("P7", dir="i"), Clock(100e6), Attrs(GLOBAL=True,
+ IO_STANDARD="SB_LVCMOS")
+ ),
+
+ Resource("usb", 0,
+ Subsignal("usb_tx", Pins("P14", dir="o")),
+ Subsignal("usb_rx", Pins("M9", dir="i")),
+ Attrs(IO_STANDARD="LVCMOS")
+ ),
+
+ *SPIFlashResources(0,
+ cs_n="P13", clk="P12", copi="M11", cipo="P11",
+ attrs=Attrs(IO_STANDARD="SB_LVCMOS")
+ ),
+
+ *LEDResources(
+ pins="J11 K11 G12 H12 K14 J12 L14 K12", attrs=Attrs(IO_STANDARD="SB_LVCMOS")
+ ),
+
+ *ButtonResources(pins="P8"),
+ ]
+ connectors = [
+ # TODO(mciantyre) define these.
+ ]
+
+ 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, "-u", "-b", bitstream_filename])
+
+
+if __name__ == "__main__":
+ from .test.blinky import Blinky
+ AlchitryCuV2Platform().build(Blinky(), do_program=True)