Skip to content

Commit 73f2238

Browse files
committed
Add icesugar_pro platform file from #197, also pin markupsafe version to avoid pallets/markupsafe#282
1 parent 2d0a23b commit 73f2238

File tree

2 files changed

+151
-0
lines changed

2 files changed

+151
-0
lines changed

amaranth_boards/icesugar_pro.py

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# iCESugar-pro Platform
2+
# See: https://github.com/wuxx/icesugar-pro
3+
4+
import subprocess
5+
6+
from amaranth.build import *
7+
from amaranth.vendor.lattice_ecp5 import *
8+
from amaranth_boards.resources import *
9+
10+
__all__ = ["ICESugarProPlatform"]
11+
12+
13+
class ICESugarProPlatform(LatticeECP5Platform):
14+
name = "IceSugar Pro v1.3"
15+
device = "LFE5U-25F"
16+
package = "BG256"
17+
speed = "6"
18+
default_clk = "clk25"
19+
20+
resources = [
21+
Resource("clk25", 0, Pins("P6", dir="i"),
22+
Clock(25e6), Attrs(IO_TYPE="LVCMOS33")),
23+
24+
RGBLEDResource(0, r="B11", g="A11", b="A12", attrs=Attrs(IO_TYPE="LVCMOS33")),
25+
26+
UARTResource(0, rx="A9", tx="N4",
27+
attrs=Attrs(IO_TYPE="LVCMOS33", PULLUP=1)
28+
),
29+
]
30+
31+
# https://github.com/wuxx/icesugar-pro/tree/master/schematic
32+
connectors = [
33+
Connector("io", 0, {
34+
"41:": "A8",
35+
"42:": "P11",
36+
"44:": "P12",
37+
"46:": "N12",
38+
"48:": "P13",
39+
"49:": "B8",
40+
"50:": "N13",
41+
"51:": "A7",
42+
"52:": "P14",
43+
"54:": "M12",
44+
"57:": "B7",
45+
"58:": "M13",
46+
"59:": "A6",
47+
"60:": "L14",
48+
"61:": "B6",
49+
"62:": "L13",
50+
"63:": "A5",
51+
"64:": "K14",
52+
"65:": "B5",
53+
"66:": "K13",
54+
"67:": "A4",
55+
"68:": "J14",
56+
"69:": "B4",
57+
"70:": "J13",
58+
"71:": "A3",
59+
"72:": "H14",
60+
"73:": "B3",
61+
"74:": "H13",
62+
"75:": "A2",
63+
"76:": "G14",
64+
"77:": "B1",
65+
"78:": "G13",
66+
"79:": "B2",
67+
"80:": "F14",
68+
"81:": "C1",
69+
"82:": "F13",
70+
"83:": "C2",
71+
"84:": "E14",
72+
"85:": "D1",
73+
"86:": "E13",
74+
"87:": "D3",
75+
"88:": "E12",
76+
"89:": "E1",
77+
"90:": "C13",
78+
"91:": "E2",
79+
"92:": "D13",
80+
"93:": "F1",
81+
"94:": "C12",
82+
"95:": "F2",
83+
"96:": "D12",
84+
"97:": "G1",
85+
"98:": "C11",
86+
"99:": "G2",
87+
"100:": "D11",
88+
"101:": "H2",
89+
"102:": "C10",
90+
"103:": "J1",
91+
"104:": "D10",
92+
"109:": "J2",
93+
"110:": "C9",
94+
"111:": "K1",
95+
"112:": "D9",
96+
"113:": "K2",
97+
"114:": "C8",
98+
"115:": "L1",
99+
"116:": "D8",
100+
"117:": "L2",
101+
"118:": "C7",
102+
"119:": "M1",
103+
"120:": "D7",
104+
"121:": "M2",
105+
"122:": "C6",
106+
"123:": "N1",
107+
"124:": "D6",
108+
"125:": "N3",
109+
"126:": "C5",
110+
"127:": "P1",
111+
"128:": "D5",
112+
"129:": "P2",
113+
"130:": "C4",
114+
"131:": "R1",
115+
"132:": "D4",
116+
"133:": "R2",
117+
"134:": "C3",
118+
"135:": "T2",
119+
"136:": "E4",
120+
"137:": "R3",
121+
"138:": "E3",
122+
"139:": "T3",
123+
"140:": "F4",
124+
"141:": "R4",
125+
"142:": "F3",
126+
"143:": "T4",
127+
"144:": "G4",
128+
"145:": "R5",
129+
"146:": "G3",
130+
"147:": "R6",
131+
"148:": "H3",
132+
"149:": "T6",
133+
"150:": "J4",
134+
"151:": "P7",
135+
"152:": "J3",
136+
"153:": "R7",
137+
"154:": "K4",
138+
"155:": "R8",
139+
"156:": "K3",
140+
})
141+
]
142+
143+
def toolchain_program(self, products, name):
144+
with products.extract("{}.bit".format(name)) as bitstream_filename:
145+
subprocess.check_call(["icesprog", bitstream_filename])
146+
147+
148+
if __name__ == "__main__":
149+
from amaranth_boards.test.blinky import *
150+
ICESugarProPlatform().build(Blinky(), do_program=True)

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def local_scheme(version):
2323
install_requires=[
2424
"amaranth>=0.2,<0.5",
2525
"importlib_metadata; python_version<'3.8'",
26+
"markupsafe==2.0.1",
2627
],
2728
packages=find_packages(),
2829
project_urls={

0 commit comments

Comments
 (0)