Skip to content

Commit b60d978

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

File tree

2 files changed

+154
-1
lines changed

2 files changed

+154
-1
lines changed

amaranth_boards/icesugar_pro.py

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

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ def local_scheme(version):
2121
license="BSD",
2222
setup_requires=["wheel", "setuptools", "setuptools_scm"],
2323
install_requires=[
24-
"amaranth>=0.2,<0.5",
24+
"amaranth>=0.2,<0.6",
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)