Skip to content

Commit 6d64ea3

Browse files
authored
Merge pull request #2622 from fpistm/ci_enhancement
ci: enhancements
2 parents 91b29fb + a7e15f1 commit 6d64ea3

File tree

1,255 files changed

+11938
-9335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,255 files changed

+11938
-9335
lines changed

CI/build/conf/cores_config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,11 @@
476476
"GENERIC_G471VEHX",
477477
"GENERIC_G471VEIX",
478478
"GENERIC_G473CBTX",
479+
"GENERIC_G473CBUX",
479480
"GENERIC_G473CCTX",
481+
"GENERIC_G473CCUX",
480482
"GENERIC_G473CETX",
483+
"GENERIC_G473CEUX",
481484
"GENERIC_G473MBTX",
482485
"GENERIC_G473MCTX",
483486
"GENERIC_G473METX",
@@ -499,8 +502,11 @@
499502
"GENERIC_G473VEHX",
500503
"GENERIC_G473VETX",
501504
"GENERIC_G474CBTX",
505+
"GENERIC_G474CBUX",
502506
"GENERIC_G474CCTX",
507+
"GENERIC_G474CCUX",
503508
"GENERIC_G474CETX",
509+
"GENERIC_G474CEUX",
504510
"GENERIC_G474MBTX",
505511
"GENERIC_G474MCTX",
506512
"GENERIC_G474METX",
@@ -520,6 +526,7 @@
520526
"GENERIC_G474VEHX",
521527
"GENERIC_G474VETX",
522528
"GENERIC_G483CETX",
529+
"GENERIC_G483CEUX",
523530
"GENERIC_G483METX",
524531
"GENERIC_G483PEIX",
525532
"GENERIC_G483QETX",
@@ -593,6 +600,7 @@
593600
"GENERIC_H750VBTX",
594601
"GENERIC_H750XBHX",
595602
"GENERIC_H750ZBTX",
603+
"GENERIC_H753IIKX",
596604
"GENERIC_H753VIHX",
597605
"GENERIC_H753XIHX",
598606
"GENERIC_H753ZITX",

CI/build/conf/cores_config_ci.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,11 @@
476476
"GENERIC_G471VEHX",
477477
"GENERIC_G471VEIX",
478478
"GENERIC_G473CBTX",
479+
"GENERIC_G473CBUX",
479480
"GENERIC_G473CCTX",
481+
"GENERIC_G473CCUX",
480482
"GENERIC_G473CETX",
483+
"GENERIC_G473CEUX",
481484
"GENERIC_G473MBTX",
482485
"GENERIC_G473MCTX",
483486
"GENERIC_G473METX",
@@ -499,8 +502,11 @@
499502
"GENERIC_G473VEHX",
500503
"GENERIC_G473VETX",
501504
"GENERIC_G474CBTX",
505+
"GENERIC_G474CBUX",
502506
"GENERIC_G474CCTX",
507+
"GENERIC_G474CCUX",
503508
"GENERIC_G474CETX",
509+
"GENERIC_G474CEUX",
504510
"GENERIC_G474MBTX",
505511
"GENERIC_G474MCTX",
506512
"GENERIC_G474METX",
@@ -520,6 +526,7 @@
520526
"GENERIC_G474VEHX",
521527
"GENERIC_G474VETX",
522528
"GENERIC_G483CETX",
529+
"GENERIC_G483CEUX",
523530
"GENERIC_G483METX",
524531
"GENERIC_G483PEIX",
525532
"GENERIC_G483QETX",
@@ -593,6 +600,7 @@
593600
"GENERIC_H750VBTX",
594601
"GENERIC_H750XBHX",
595602
"GENERIC_H750ZBTX",
603+
"GENERIC_H753IIKX",
596604
"GENERIC_H753VIHX",
597605
"GENERIC_H753XIHX",
598606
"GENERIC_H753ZITX",

CI/update/stm32svd.py

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
import json
22
import sys
33
from pathlib import Path
4+
from xml.dom.minidom import parse
45

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

1011
stm32_list = [] # series
12+
svd_dict = {} # 'svd file': 'name'
1113
root_path = script_path.parent.parent.resolve()
1214
hal_path = root_path / "system" / "Drivers"
1315
cubeclt_path = Path("")
16+
cubeclt_mcu_path = Path()
1417
cubeclt_svd_path = Path("")
1518
stm32_svd_repo = Path("")
1619
stm32_svd_dir = Path("")
1720

1821

1922
def checkConfig():
2023
global cubeclt_path
24+
global cubeclt_mcu_path
2125
global cubeclt_svd_path
2226
global stm32_svd_repo
2327
global stm32_svd_dir
@@ -43,6 +47,10 @@ def checkConfig():
4347
if not cubeclt_svd_path.is_dir():
4448
print(f"{cubeclt_svd_path} does not exist!")
4549
exit(1)
50+
cubeclt_mcu_path = cubeclt_path / "STM32target-mcu"
51+
if not cubeclt_mcu_path.is_dir():
52+
print(f"{cubeclt_mcu_path} does not exist!")
53+
exit(1)
4654
if "STM32_SVD_PATH" not in path_config:
4755
path_config["STM32_SVD_PATH"] = str("Path to stm32_svd repository")
4856
defaultConfig(config_file_path, path_config)
@@ -62,11 +70,56 @@ def checkConfig():
6270
)
6371

6472

73+
def parse_stm32targets(stm32targets_file: Path):
74+
global stm32_list
75+
global svd_dict
76+
77+
xml_stm32targets = parse(str(stm32targets_file))
78+
mcu_nodes = xml_stm32targets.getElementsByTagName("mcu")
79+
for mcu_node in mcu_nodes:
80+
parent_node_name = mcu_node.getElementsByTagName("parent")[0].firstChild.data
81+
mcu_node_name = mcu_node.getElementsByTagName("name")[0].firstChild.data
82+
cpus_node_name = mcu_node.getElementsByTagName("cpus")
83+
cpu_node_name = cpus_node_name[0].getElementsByTagName("cpu")
84+
svd_node = cpu_node_name[0].getElementsByTagName("svd")
85+
svd_file = svd_node[0].getElementsByTagName("name")[0].firstChild.data
86+
serie = (
87+
parent_node_name.upper()
88+
.removeprefix("STM32")
89+
.removesuffix("SINGLE")
90+
.removesuffix("DUAL")
91+
)
92+
if serie == "L4PLUS":
93+
serie = "L4"
94+
else:
95+
if mcu_node_name.startswith("STM32H7R") or mcu_node_name.startswith(
96+
"STM32H7S"
97+
):
98+
serie = "H7RS"
99+
svd_dict[svd_file] = serie
100+
# Check if a second cpu is defined
101+
if cpu_node_name.length > 1:
102+
svd_node = cpu_node_name[1].getElementsByTagName("svd")
103+
svd_file = svd_node[0].getElementsByTagName("name")[0].firstChild.data
104+
serie = parent_node_name.upper().removeprefix("STM32").removesuffix("DUAL")
105+
svd_dict[svd_file] = serie
106+
xml_stm32targets.unlink()
107+
108+
65109
def main():
66110
global stm32_list
67-
# check config have to be done first
111+
# Check config have to be done first
68112
checkConfig()
113+
# Get list of STM32 series from HAL driver directory
69114
stm32_list = genSTM32List(hal_path, None)
115+
# Parse STM32Targets.xml to get list of STM32 series and svd file
116+
# one per Cube reference
117+
stm32targets_file = cubeclt_mcu_path / "stm32targets.xml"
118+
if stm32targets_file.is_file():
119+
parse_stm32targets(stm32targets_file)
120+
else:
121+
print(f"{stm32targets_file} does not exits!")
122+
exit(1)
70123
# Reverse order to get WBA before WB to ease svd sorting
71124
stm32_list.sort(reverse=True)
72125
# Clean up core svd folder
@@ -81,17 +134,33 @@ def main():
81134
# Create all directories
82135
for serie in stm32_list:
83136
createFolder(stm32_svd_dir / f"STM32{serie}xx")
84-
# Get all xml files
137+
# Get all svd files
85138
svd_list = sorted(cubeclt_svd_path.glob("STM32*.svd"))
86139

87-
# Copy all svd files per series
140+
# Copy all svd files per supported series
88141
for svd_file in svd_list:
89142
svd_name = svd_file.name
90-
for serie in stm32_list:
91-
if svd_name.find(f"STM32{serie}") != -1:
92-
copyFile(svd_file, stm32_svd_dir / f"STM32{serie}xx")
93-
break
143+
if svd_name in svd_dict:
144+
if svd_dict[svd_name] in stm32_list:
145+
copyFile(svd_file, stm32_svd_dir / f"STM32{svd_dict[svd_name]}xx")
146+
else:
147+
# File not copied as not referenced in stm32targets.xml
148+
if svd_name.startswith("STM32GBK"):
149+
copyFile(svd_file, stm32_svd_dir / "STM32G4xx")
150+
else:
151+
for serie in stm32_list:
152+
if svd_name.startswith(f"STM32{serie}"):
153+
copyFile(svd_file, stm32_svd_dir / f"STM32{serie}xx")
154+
break
155+
else:
156+
print(f"File {svd_name} not copied.")
94157

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

96165
if __name__ == "__main__":
97166
main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy