Replace subprocess.run(..., check=True) with subprocess.check_call().
[nmigen-boards.git] / nmigen_boards / kc705.py
1 import os
2 import subprocess
3
4 from nmigen.build import *
5 from nmigen.vendor.xilinx_7series import *
6 from .dev import *
7
8
9 __all__ = ["KC705Platform"]
10
11
12 class KC705Platform(Xilinx7SeriesPlatform):
13 device = "xc7k325t"
14 package = "ffg900"
15 speed = "2"
16 resources = [
17 Resource("clk156", 0, DiffPairs("K28", "K29", dir="i"),
18 Clock(156e6), Attrs(IOSTANDARD="LVDS_25")),
19
20 Resource("user_led", 0, Pins("AB8", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
21 Resource("user_led", 1, Pins("AA8", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
22 Resource("user_led", 2, Pins("AC9", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
23 Resource("user_led", 3, Pins("AB9", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
24 Resource("user_led", 4, Pins("AE26", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
25 Resource("user_led", 5, Pins("G19", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
26 Resource("user_led", 6, Pins("E18", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
27 Resource("user_led", 7, Pins("F16", dir="o"), Attrs(IOSTANDARD="LVCMOS15")),
28
29 UARTResource(0,
30 rx="M19", tx="K24",
31 attrs=Attrs(IOSTANDARD="LVCMOS33")
32 ),
33 ]
34 connectors = []
35
36 def toolchain_program(self, products, name):
37 openocd = os.environ.get("OPENOCD", "openocd")
38 with products.extract("{}.bit".format(name)) as bitstream_filename:
39 subprocess.check_call([openocd,
40 "-c", "source [find board/kc705.cfg]; init; pld load 0 {}; exit"
41 .format(bitstream_filename)
42 ])
43
44
45 if __name__ == "__main__":
46 from ._blinky import build_and_program
47 build_and_program(KC705Platform, "clk156")