Tools: board_list.py: generate from hwdef files

This commit is contained in:
Peter Barker 2021-08-30 12:59:15 +10:00 committed by Peter Barker
parent 9d12130689
commit 21c42e3123

262
Tools/scripts/board_list.py Normal file → Executable file
View File

@ -1,140 +1,138 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import re
''' '''
list of boards for build_binaries.py and custom build server list of boards for build_binaries.py and custom build server
AP_FLAKE8_CLEAN
''' '''
AUTOBUILD_BOARDS = ["fmuv2",
"fmuv3", class Board(object):
"fmuv5", def __init__(self, name):
"mindpx-v2", self.name = name
"erlebrain2", self.is_ap_periph = False
"navigator",
"navio",
"navio2", class BoardList(object):
"edge",
"pxf", def __init__(self):
"pxfmini", self.hwdef_dir = os.path.join(
"KakuteF4", os.path.dirname(os.path.realpath(__file__)),
"KakuteF7", "..", "..", "libraries", "AP_HAL_ChibiOS", "hwdef")
"KakuteH7",
"KakuteF7Mini", if not os.path.exists(self.hwdef_dir):
"KakuteF4Mini", raise ValueError("%s does not exist" % self.hwdef_dir)
"MambaF405v2",
"MatekF405", # no hwdefs for Linux boards - yet?
"MatekF405-bdshot", self.boards = [
"MatekF405-STD", Board("erlebrain2"),
"MatekF405-Wing", Board("navigator"),
"MatekF405-TE", Board("navio"),
"MatekF765-Wing", Board("navio2"),
"MatekF765-SE", Board("edge"),
"MatekF405-CAN", Board("obal"),
"MatekH743", Board("pxf"),
"MatekH743-bdshot", Board("pxfmini"),
"OMNIBUSF7V2", Board("SITL_x86_64_linux_gnu"),
"sparky2", Board("SITL_arm_linux_gnueabihf"),
"omnibusf4",
"omnibusf4pro",
"omnibusf4pro-bdshot",
"omnibusf4v6",
"OmnibusNanoV6",
"OmnibusNanoV6-bdshot",
"mini-pix",
"airbotf4",
"revo-mini",
"revo-mini-bdshot",
"revo-mini-i2c",
"revo-mini-i2c-bdshot",
"CubeBlack",
"CubeBlack+",
"CubePurple",
"Pixhawk1",
"Pixhawk1-1M",
"Pixhawk4",
"Pixhawk4-bdshot",
"Pix32v5",
"PH4-mini",
"CUAVv5",
"CUAVv5-bdshot",
"CUAVv5Nano",
"CUAVv5Nano-bdshot",
"CUAV-Nora",
"CUAV-X7",
"CUAV-X7-bdshot",
"mRoX21",
"Pixracer",
"Pixracer-bdshot",
"F4BY",
"mRoX21-777",
"mRoControlZeroF7",
"mRoNexus",
"mRoPixracerPro",
"mRoPixracerPro-bdshot",
"mRoControlZeroOEMH7",
"mRoControlZeroClassic",
"mRoControlZeroH7",
"mRoControlZeroH7-bdshot",
"F35Lightning",
"speedybeef4",
"SuccexF4",
"DrotekP3Pro",
"VRBrain-v51",
"VRBrain-v52",
"VRUBrain-v51",
"VRCore-v10",
"VRBrain-v54",
"TBS-Colibri-F7",
"Durandal",
"Durandal-bdshot",
"CubeOrange",
"CubeOrange-bdshot",
"CubeYellow",
"R9Pilot",
"QioTekZealotF427",
"QioTekZealotH743",
"BeastH7",
"BeastF7",
"BeastF7v2",
"FlywooF745",
"FlywooF745Nano",
"luminousbee5",
"MambaF405US-I2C",
"Swan-K1",
"obal",
"modalai_fc-v1",
"Pixhawk5X",
"AIRLink",
"PixC4-Jetson",
# SITL targets
"SITL_x86_64_linux_gnu",
"SITL_arm_linux_gnueabihf",
] ]
AP_PERIPH_BOARDS = ["f103-GPS", for adir in os.listdir(self.hwdef_dir):
"f103-QiotekPeriph", if adir is None:
"f103-ADSB", continue
"f103-RangeFinder", if not os.path.isdir(os.path.join(self.hwdef_dir, adir)):
"f303-GPS", continue
"f303-Universal", if adir in ["scripts", "common", "STM32CubeConf"]:
"f303-M10025", continue
"f303-HWESC", filepath = os.path.join(self.hwdef_dir, adir, "hwdef.dat")
"f303-PWM", if not os.path.exists(filepath):
"f303-M10070", continue
"f303-MatekGPS", filepath = os.path.join(self.hwdef_dir, adir, "hwdef.dat")
"f405-MatekGPS", text = self.read_hwdef(filepath)
"f103-Airspeed",
"CUAV_GPS", board = Board(adir)
"ZubaxGNSS", self.boards.append(board)
"CubeOrange-periph", for line in text:
"CubeBlack-periph", if re.match(r"^\s*env AP_PERIPH 1", line):
"MatekH743-periph", board.is_ap_periph = 1
"HitecMosaic",
"FreeflyRTK", def read_hwdef(self, filepath):
"HolybroGPS", fh = open(filepath)
"BirdCANdy", ret = []
"Hitec-Airspeed", text = fh.readlines()
"Sierra-L431", for line in text:
"Sierra-F405", m = re.match(r"^\s*include\s+(.+)\s*$", line)
"Sierra-F412", if m is not None:
"CarbonixL496", ret += self.read_hwdef(os.path.join(os.path.dirname(filepath), m.group(1)))
"mRo-M10095", else:
ret += [line]
return ret
def find_autobuild_boards(self):
ret = []
for board in self.boards:
if board.is_ap_periph:
continue
ret.append(board.name)
# these were missing in the original list for unknown reasons.
# Omitting them for backwards-compatability here - but we
# should probably have a line in the hwdef indicating they
# shouldn't be auto-built...
blacklist = [
"skyviper-journey",
"skyviper-v2450",
"CubeGreen-solo",
"omnibusf4pro-one",
"CubeSolo",
"MazzyStarDrone",
"fmuv3-bdshot",
"CubeYellow-bdshot",
"crazyflie2",
"NucleoH743",
"Pixhawk1-1M-bdshot",
"Nucleo-G491",
"fmuv5-bdshot",
"KakuteF7-bdshot",
"iomcu",
"luminousbee4",
"skyviper-f412-rev1",
"CubeOrange-joey",
"OMNIBUSF7V2-bdshot",
'H757I_EVAL',
'H757I_EVAL_intf',
'iomcu_f103_8MHz',
] ]
ret = filter(lambda x : x not in blacklist, ret)
return list(ret)
def find_ap_periph_boards(self):
blacklist = [
"Pixracer-periph",
"f103-Trigger",
"H757I_EVAL",
"HerePro",
"HereID",
"G4-ESC",
"CubeOrange-periph-heavy",
"f103-HWESC",
"Nucleo-L476",
"Nucleo-L496",
]
ret = []
for x in self.boards:
if not x.is_ap_periph:
continue
if x.name in blacklist:
continue
ret.append(x.name)
return list(ret)
AUTOBUILD_BOARDS = BoardList().find_autobuild_boards()
AP_PERIPH_BOARDS = BoardList().find_ap_periph_boards()