Skip to content

ci: enhancements #2622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d80a672
ci(common): harden functions
fpistm Jan 7, 2025
7b30c6a
ci(stm32svd): sort by supported cube series
fpistm Jan 6, 2025
575baf5
ci(stm32variant): dynamically manage syswkup list
fpistm Jan 6, 2025
b19931a
ci(stm32variant): delete folder with no ldscript
fpistm Jan 6, 2025
2ccfc78
ci(stm32variant): enhance series managements
fpistm Jan 7, 2025
9698938
chore(c0): update variant after script update
fpistm Jan 8, 2025
c93dc10
chore(f0): update variant after script update
fpistm Jan 8, 2025
8988091
chore(f1): update variant after script update
fpistm Jan 8, 2025
218c6a8
chore(f2): update variant after script update
fpistm Jan 8, 2025
1aaf0d0
chore(f3): update variant after script update
fpistm Jan 8, 2025
3582721
chore(f4): update variant after script update
fpistm Jan 8, 2025
f53f44f
chore(f7): update variant after script update
fpistm Jan 8, 2025
154b1e2
chore(g0): update variant after script update
fpistm Jan 8, 2025
63a7d7c
chore(g4): update variant after script update
fpistm Jan 8, 2025
57b20de
chore(h5): update variant after script update
fpistm Jan 8, 2025
50326fe
chore(h7): update variant after script update
fpistm Jan 8, 2025
0ff2177
chore(l0): update variant after script update
fpistm Jan 8, 2025
0dbd4da
chore(l1): update variant after script update
fpistm Jan 8, 2025
8cff587
chore(l4): update variant after script update
fpistm Jan 8, 2025
254e786
chore(l5): update variant after script update
fpistm Jan 8, 2025
444152f
chore(mp1): update variant after script update
fpistm Jan 8, 2025
3eb068f
chore(u0): update variant after script update
fpistm Jan 8, 2025
27ef26c
chore(u5): update variant after script update
fpistm Jan 8, 2025
4e9e0b3
chore(wba): update variant after script update
fpistm Jan 8, 2025
20d7d3e
chore(wb): update variant after script update
fpistm Jan 8, 2025
fe7fb43
chore(wl): update variant after script update
fpistm Jan 8, 2025
778bfb5
chore: update cmake after variants update
fpistm Jan 8, 2025
a7e15f1
chore(ci): update generics list to skip
fpistm Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions CI/build/conf/cores_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@
"GENERIC_G471VEHX",
"GENERIC_G471VEIX",
"GENERIC_G473CBTX",
"GENERIC_G473CBUX",
"GENERIC_G473CCTX",
"GENERIC_G473CCUX",
"GENERIC_G473CETX",
"GENERIC_G473CEUX",
"GENERIC_G473MBTX",
"GENERIC_G473MCTX",
"GENERIC_G473METX",
Expand All @@ -499,8 +502,11 @@
"GENERIC_G473VEHX",
"GENERIC_G473VETX",
"GENERIC_G474CBTX",
"GENERIC_G474CBUX",
"GENERIC_G474CCTX",
"GENERIC_G474CCUX",
"GENERIC_G474CETX",
"GENERIC_G474CEUX",
"GENERIC_G474MBTX",
"GENERIC_G474MCTX",
"GENERIC_G474METX",
Expand All @@ -520,6 +526,7 @@
"GENERIC_G474VEHX",
"GENERIC_G474VETX",
"GENERIC_G483CETX",
"GENERIC_G483CEUX",
"GENERIC_G483METX",
"GENERIC_G483PEIX",
"GENERIC_G483QETX",
Expand Down Expand Up @@ -593,6 +600,7 @@
"GENERIC_H750VBTX",
"GENERIC_H750XBHX",
"GENERIC_H750ZBTX",
"GENERIC_H753IIKX",
"GENERIC_H753VIHX",
"GENERIC_H753XIHX",
"GENERIC_H753ZITX",
Expand Down
8 changes: 8 additions & 0 deletions CI/build/conf/cores_config_ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@
"GENERIC_G471VEHX",
"GENERIC_G471VEIX",
"GENERIC_G473CBTX",
"GENERIC_G473CBUX",
"GENERIC_G473CCTX",
"GENERIC_G473CCUX",
"GENERIC_G473CETX",
"GENERIC_G473CEUX",
"GENERIC_G473MBTX",
"GENERIC_G473MCTX",
"GENERIC_G473METX",
Expand All @@ -499,8 +502,11 @@
"GENERIC_G473VEHX",
"GENERIC_G473VETX",
"GENERIC_G474CBTX",
"GENERIC_G474CBUX",
"GENERIC_G474CCTX",
"GENERIC_G474CCUX",
"GENERIC_G474CETX",
"GENERIC_G474CEUX",
"GENERIC_G474MBTX",
"GENERIC_G474MCTX",
"GENERIC_G474METX",
Expand All @@ -520,6 +526,7 @@
"GENERIC_G474VEHX",
"GENERIC_G474VETX",
"GENERIC_G483CETX",
"GENERIC_G483CEUX",
"GENERIC_G483METX",
"GENERIC_G483PEIX",
"GENERIC_G483QETX",
Expand Down Expand Up @@ -593,6 +600,7 @@
"GENERIC_H750VBTX",
"GENERIC_H750XBHX",
"GENERIC_H750ZBTX",
"GENERIC_H753IIKX",
"GENERIC_H753VIHX",
"GENERIC_H753XIHX",
"GENERIC_H753ZITX",
Expand Down
83 changes: 76 additions & 7 deletions CI/update/stm32svd.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import json
import sys
from pathlib import Path
from xml.dom.minidom import parse

script_path = Path(__file__).parent.resolve()
sys.path.append(str(script_path.parent))
from utils import copyFile, copyFolder, createFolder, deleteFolder
from utils import defaultConfig, genSTM32List

stm32_list = [] # series
svd_dict = {} # 'svd file': 'name'
root_path = script_path.parent.parent.resolve()
hal_path = root_path / "system" / "Drivers"
cubeclt_path = Path("")
cubeclt_mcu_path = Path()
cubeclt_svd_path = Path("")
stm32_svd_repo = Path("")
stm32_svd_dir = Path("")


def checkConfig():
global cubeclt_path
global cubeclt_mcu_path
global cubeclt_svd_path
global stm32_svd_repo
global stm32_svd_dir
Expand All @@ -43,6 +47,10 @@ def checkConfig():
if not cubeclt_svd_path.is_dir():
print(f"{cubeclt_svd_path} does not exist!")
exit(1)
cubeclt_mcu_path = cubeclt_path / "STM32target-mcu"
if not cubeclt_mcu_path.is_dir():
print(f"{cubeclt_mcu_path} does not exist!")
exit(1)
if "STM32_SVD_PATH" not in path_config:
path_config["STM32_SVD_PATH"] = str("Path to stm32_svd repository")
defaultConfig(config_file_path, path_config)
Expand All @@ -62,11 +70,56 @@ def checkConfig():
)


def parse_stm32targets(stm32targets_file: Path):
global stm32_list
global svd_dict

xml_stm32targets = parse(str(stm32targets_file))
mcu_nodes = xml_stm32targets.getElementsByTagName("mcu")
for mcu_node in mcu_nodes:
parent_node_name = mcu_node.getElementsByTagName("parent")[0].firstChild.data
mcu_node_name = mcu_node.getElementsByTagName("name")[0].firstChild.data
cpus_node_name = mcu_node.getElementsByTagName("cpus")
cpu_node_name = cpus_node_name[0].getElementsByTagName("cpu")
svd_node = cpu_node_name[0].getElementsByTagName("svd")
svd_file = svd_node[0].getElementsByTagName("name")[0].firstChild.data
serie = (
parent_node_name.upper()
.removeprefix("STM32")
.removesuffix("SINGLE")
.removesuffix("DUAL")
)
if serie == "L4PLUS":
serie = "L4"
else:
if mcu_node_name.startswith("STM32H7R") or mcu_node_name.startswith(
"STM32H7S"
):
serie = "H7RS"
svd_dict[svd_file] = serie
# Check if a second cpu is defined
if cpu_node_name.length > 1:
svd_node = cpu_node_name[1].getElementsByTagName("svd")
svd_file = svd_node[0].getElementsByTagName("name")[0].firstChild.data
serie = parent_node_name.upper().removeprefix("STM32").removesuffix("DUAL")
svd_dict[svd_file] = serie
xml_stm32targets.unlink()


def main():
global stm32_list
# check config have to be done first
# Check config have to be done first
checkConfig()
# Get list of STM32 series from HAL driver directory
stm32_list = genSTM32List(hal_path, None)
# Parse STM32Targets.xml to get list of STM32 series and svd file
# one per Cube reference
stm32targets_file = cubeclt_mcu_path / "stm32targets.xml"
if stm32targets_file.is_file():
parse_stm32targets(stm32targets_file)
else:
print(f"{stm32targets_file} does not exits!")
exit(1)
# Reverse order to get WBA before WB to ease svd sorting
stm32_list.sort(reverse=True)
# Clean up core svd folder
Expand All @@ -81,17 +134,33 @@ def main():
# Create all directories
for serie in stm32_list:
createFolder(stm32_svd_dir / f"STM32{serie}xx")
# Get all xml files
# Get all svd files
svd_list = sorted(cubeclt_svd_path.glob("STM32*.svd"))

# Copy all svd files per series
# Copy all svd files per supported series
for svd_file in svd_list:
svd_name = svd_file.name
for serie in stm32_list:
if svd_name.find(f"STM32{serie}") != -1:
copyFile(svd_file, stm32_svd_dir / f"STM32{serie}xx")
break
if svd_name in svd_dict:
if svd_dict[svd_name] in stm32_list:
copyFile(svd_file, stm32_svd_dir / f"STM32{svd_dict[svd_name]}xx")
else:
# File not copied as not referenced in stm32targets.xml
if svd_name.startswith("STM32GBK"):
copyFile(svd_file, stm32_svd_dir / "STM32G4xx")
else:
for serie in stm32_list:
if svd_name.startswith(f"STM32{serie}"):
copyFile(svd_file, stm32_svd_dir / f"STM32{serie}xx")
break
else:
print(f"File {svd_name} not copied.")

# Check if created folder is empty and delete it
for serie in stm32_list:
serie_dir = stm32_svd_dir / f"STM32{serie}xx"
if not any(serie_dir.glob("*")):
print (f"Folder {serie_dir} is empty.")
serie_dir.rmdir()

if __name__ == "__main__":
main()
Loading
Loading