4 from nmigen
.build
import *
5 from nmigen
.vendor
.lattice_ice40
import *
6 from .resources
import *
7 from .upduino_v1
import UpduinoV1Platform
10 __all__
= ["UpduinoV2Platform"]
13 class UpduinoV2Platform(UpduinoV1Platform
):
14 # Mostly identical to the V1 board, but it has an integrated
15 # programmer and a 12MHz oscillator which is NC by default.
16 resources
= UpduinoV1Platform
.resources
+ [
17 # Solder pin 12 to the adjacent 'J8' osc_out pin to enable.
18 Resource("clk12", 0, Pins("12", dir="i"),
19 Clock(12e6
), Attrs(IO_STANDARD
="SB_LVCMOS")),
22 def toolchain_program(self
, products
, name
):
23 iceprog
= os
.environ
.get("ICEPROG", "iceprog")
24 with products
.extract("{}.bin".format(name
)) as bitstream_filename
:
25 subprocess
.check_call([iceprog
, bitstream_filename
])
28 if __name__
== "__main__":
29 from .test
.blinky
import *
30 UpduinoV2Platform().build(Blinky(), do_program
=True)