Skip to content

Commit 3d09446

Browse files
committed
make.py: Avoid having to list board manually and use CamelCase name in --board=.
1 parent 884e0db commit 3d09446

File tree

3 files changed

+23
-70
lines changed

3 files changed

+23
-70
lines changed

boards.py

+3
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def __init__(self):
530530
})
531531

532532
# Schoko support -----------------------------------------------------------------------------------
533+
533534
class Schoko(Board):
534535
soc_kwargs = {"l2_size" : 8192}
535536
def __init__(self):
@@ -547,6 +548,7 @@ def __init__(self):
547548
})
548549

549550
# Konfekt support -----------------------------------------------------------------------------------
551+
550552
class Konfekt(Board):
551553
soc_kwargs = {"l2_size" : 0}
552554
def __init__(self):
@@ -564,6 +566,7 @@ def __init__(self):
564566
})
565567

566568
# Noir support -----------------------------------------------------------------------------------
569+
567570
class Noir(Board):
568571
soc_kwargs = {"l2_size" : 8192}
569572
def __init__(self):

make.py

+17-67
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# SPDX-License-Identifier: BSD-2-Clause
88

99
import os
10+
import re
1011
import sys
1112
import argparse
1213

@@ -17,70 +18,21 @@
1718
from soc_linux import SoCLinux
1819

1920
#---------------------------------------------------------------------------------------------------
20-
# Build
21+
# Helpers
2122
#---------------------------------------------------------------------------------------------------
2223

23-
supported_boards = {
24-
# Xilinx
25-
"acorn" : Acorn,
26-
"acorn_pcie" : AcornPCIe,
27-
"aesku40" : AESKU40,
28-
"arty" : Arty,
29-
"arty_a7" : ArtyA7,
30-
"arty_s7" : ArtyS7,
31-
"netv2" : NeTV2,
32-
"genesys2" : Genesys2,
33-
"kc705" : KC705,
34-
"vc707" : VC707,
35-
"kcu105" : KCU105,
36-
"zcu104" : ZCU104,
37-
"nexys4ddr" : Nexys4DDR,
38-
"nexys_video" : NexysVideo,
39-
"minispartan6" : MiniSpartan6,
40-
"pipistrello" : Pipistrello,
41-
"xcu1525" : XCU1525,
42-
"alveo_u280" : AlveoU280,
43-
"alveo_u250" : AlveoU250,
44-
"qmtech_wukong" : Qmtech_WuKong,
45-
"sds1104xe" : SDS1104XE,
46-
"mnt_rkx7" : MNT_RKX7,
47-
"stlv7325" : STLV7325,
48-
"stlv7325_v2" : STLV7325_v2,
49-
"decklink_quad_hdmi_recorder" : DecklinkQuadHDMIRecorder,
50-
"hseda_xc7a35t" : HSEDA_xc7a35t,
51-
52-
# Lattice
53-
"versa_ecp5" : VersaECP5,
54-
"ulx3s" : ULX3S,
55-
"ulx4m_ld_v2" : ULX4M_LD_V2,
56-
"hadbadge" : HADBadge,
57-
"orangecrab" : OrangeCrab,
58-
"butterstick" : ButterStick,
59-
"camlink_4k" : CamLink4K,
60-
"trellisboard" : TrellisBoard,
61-
"ecpix5" : ECPIX5,
62-
"colorlight_i5" : Colorlight_i5,
63-
"icesugar_pro" : IcesugarPro,
64-
"schoko" : Schoko,
65-
"konfekt" : Konfekt,
66-
"noir" : Noir,
67-
68-
# Altera/Intel
69-
"de0nano" : De0Nano,
70-
"de10nano" : De10Nano,
71-
"de1soc" : De1SoC,
72-
"qmtech_ep4ce15" : Qmtech_EP4CE15,
73-
"qmtech_ep4ce55" : Qmtech_EP4CE55,
74-
"qmtech_5cefa2" : Qmtech_5CEFA2,
75-
76-
# Efinix
77-
"trion_t120_bga576_dev_kit" : TrionT120BGA576DevKit,
78-
"titanium_ti60_f225_dev_kit" : TitaniumTi60F225DevKit,
79-
80-
# Gowin
81-
"sipeed_tang_nano_20k" : Sipeed_tang_nano_20k,
82-
"sipeed_tang_primer_20k" : Sipeed_tang_primer_20k,
83-
}
24+
def get_supported_boards():
25+
board_classes = {}
26+
for name, obj in globals().items():
27+
if isinstance(obj, type) and issubclass(obj, Board) and obj is not Board:
28+
board_classes[name] = obj
29+
return board_classes
30+
31+
supported_boards = get_supported_boards()
32+
33+
#---------------------------------------------------------------------------------------------------
34+
# Build
35+
#---------------------------------------------------------------------------------------------------
8436

8537
def main():
8638
description = "Linux on LiteX-VexRiscv\n\n"
@@ -109,8 +61,6 @@ def main():
10961
if args.board == "all":
11062
board_names = list(supported_boards.keys())
11163
else:
112-
args.board = args.board.lower()
113-
args.board = args.board.replace(" ", "_")
11464
board_names = [args.board]
11565

11666
# Board(s) iteration ---------------------------------------------------------------------------
@@ -177,15 +127,15 @@ def main():
177127
soc.add_constant(k, v)
178128

179129
# SoC peripherals --------------------------------------------------------------------------
180-
if board_name in ["arty", "arty_a7"]:
130+
if board_name in ["Arty", "ArtyA7"]:
181131
from litex_boards.platforms.digilent_arty import _sdcard_pmod_io
182132
board.platform.add_extension(_sdcard_pmod_io)
183133

184-
if board_name in ["aesku40"]:
134+
if board_name in ["AESKU40"]:
185135
from litex_boards.platforms.avnet_aesku40 import _sdcard_pmod_io
186136
board.platform.add_extension(_sdcard_pmod_io)
187137

188-
if board_name in ["orangecrab"]:
138+
if board_name in ["OrangeCrab"]:
189139
from litex_boards.platforms.gsd_orangecrab import feather_i2c
190140
board.platform.add_extension(feather_i2c)
191141

test/test_build.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def board_build_test(self, board, cpu_count=1):
2828

2929
def test_boards(self):
3030
excluded_boards = [
31-
"schoko", # USB OHCI netlist generation issue.
32-
"trion_t120_bga576_dev_kit", # Reason: Require Efinity toolchain.
33-
"titanium_ti60_f225_dev_kit", # Reason: Require Efinity toolchain.
31+
"Schoko", # USB OHCI netlist generation issue.
32+
"TrionT120BGA576DevKit", # Reason: Require Efinity toolchain.
33+
"TitaniumTi60F225DevKit", # Reason: Require Efinity toolchain.
3434
]
3535
for board in supported_boards:
3636
if board in excluded_boards:

0 commit comments

Comments
 (0)