Skip to content

Commit 1296dfa

Browse files
authored
Merge pull request #2409 from fpistm/debug_enhancement
feat(debug): implement latest arduino-cli specifications
2 parents 9f2eaeb + 7bfa64c commit 1296dfa

File tree

923 files changed

+4467
-577
lines changed

Some content is hidden

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

923 files changed

+4467
-577
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ boards.local.txt
55
platform.local.txt
66
path_config.json
77
update_config.json
8-
variant_config.json
98

109
# Backup
1110
*.bak

CI/update/stm32cube.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
script_path = Path(__file__).parent.resolve()
1616
sys.path.append(str(script_path.parent))
1717
from utils import copyFile, copyFolder, createFolder, deleteFolder, genSTM32List
18-
from utils import execute_cmd, getRepoBranchName
18+
from utils import defaultConfig, execute_cmd, getRepoBranchName
1919

2020
if sys.platform.startswith("win32"):
2121
from colorama import init
2222

2323
init(autoreset=True)
2424

2525
home = Path.home()
26-
path_config_filename = "update_config.json"
2726

2827
# GitHub
2928
gh_st = "https://github.com/STMicroelectronics/"
@@ -85,19 +84,6 @@
8584
out_separator = "-" * 70
8685

8786

88-
def create_config(config_file_path):
89-
global repo_local_path
90-
91-
# Create a Json file for a better path management
92-
print(f"'{config_file_path}' file created. Please check the configuration.")
93-
path_config_file = open(config_file_path, "w")
94-
path_config_file.write(
95-
json.dumps({"REPO_LOCAL_PATH": str(repo_local_path)}, indent=2)
96-
)
97-
path_config_file.close()
98-
exit(1)
99-
100-
10187
def checkConfig():
10288
global repo_local_path
10389
global hal_dest_path
@@ -107,14 +93,18 @@ def checkConfig():
10793
global md_CMSIS_path
10894
global stm32_def
10995

110-
config_file_path = script_path / path_config_filename
96+
config_file_path = script_path / "update_config.json"
11197
if config_file_path.is_file():
11298
try:
11399
config_file = open(config_file_path, "r")
114100
path_config = json.load(config_file)
115-
# Common path
116-
repo_local_path = Path(path_config["REPO_LOCAL_PATH"])
117101
config_file.close()
102+
# Common path
103+
if "REPO_LOCAL_PATH" not in path_config:
104+
path_config["REPO_LOCAL_PATH"] = str(repo_local_path)
105+
defaultConfig(config_file_path, path_config)
106+
else:
107+
repo_local_path = Path(path_config["REPO_LOCAL_PATH"])
118108
hal_dest_path = repo_local_path / repo_core_name / hal_dest_path
119109
md_HAL_path = hal_dest_path / md_HAL_path
120110
cmsis_dest_path = repo_local_path / repo_core_name / cmsis_dest_path
@@ -130,7 +120,7 @@ def checkConfig():
130120
except IOError:
131121
print(f"Failed to open {config_file}!")
132122
else:
133-
create_config(config_file_path)
123+
defaultConfig(config_file_path, {"REPO_LOCAL_PATH": str(repo_local_path)})
134124
createFolder(repo_local_path)
135125

136126

CI/update/stm32svd.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import json
2+
import sys
3+
from pathlib import Path
4+
5+
script_path = Path(__file__).parent.resolve()
6+
sys.path.append(str(script_path.parent))
7+
from utils import copyFile, copyFolder, createFolder, deleteFolder
8+
from utils import defaultConfig, genSTM32List
9+
10+
stm32_list = [] # series
11+
root_path = script_path.parent.parent.resolve()
12+
hal_path = root_path / "system" / "Drivers"
13+
cubeclt_path = Path("")
14+
cubeclt_svd_path = Path("")
15+
stm32_svd_repo = Path("")
16+
stm32_svd_dir = Path("")
17+
18+
19+
def checkConfig():
20+
global cubeclt_path
21+
global cubeclt_svd_path
22+
global stm32_svd_repo
23+
global stm32_svd_dir
24+
config_file_path = script_path / "update_config.json"
25+
if config_file_path.is_file():
26+
try:
27+
config_file = open(config_file_path, "r")
28+
path_config = json.load(config_file)
29+
config_file.close()
30+
31+
if "STM32CUBECLT_PATH" not in path_config:
32+
path_config["STM32CUBECLT_PATH"] = str(
33+
"Path to STM32CubeCLT installation directory"
34+
)
35+
defaultConfig(config_file_path, path_config)
36+
else:
37+
cubeclt_path = Path(path_config["STM32CUBECLT_PATH"])
38+
if not cubeclt_path.is_dir():
39+
print(f"{cubeclt_path} does not exist!")
40+
exit(1)
41+
else:
42+
cubeclt_svd_path = cubeclt_path / "STMicroelectronics_CMSIS_SVD"
43+
if not cubeclt_svd_path.is_dir():
44+
print(f"{cubeclt_svd_path} does not exist!")
45+
exit(1)
46+
if "STM32_SVD_PATH" not in path_config:
47+
path_config["STM32_SVD_PATH"] = str("Path to stm32_svd repository")
48+
defaultConfig(config_file_path, path_config)
49+
else:
50+
stm32_svd_repo = Path(path_config["STM32_SVD_PATH"])
51+
if not stm32_svd_repo.is_dir():
52+
print(f"{stm32_svd_repo} does not exist!")
53+
exit(1)
54+
else:
55+
stm32_svd_dir = stm32_svd_repo / "svd"
56+
except IOError:
57+
print(f"Failed to open {config_file}!")
58+
else:
59+
defaultConfig(
60+
config_file_path,
61+
{"STM32CUBECLT_PATH": "Path to STM32CubeCLT installation directory"},
62+
)
63+
64+
65+
def main():
66+
global stm32_list
67+
# check config have to be done first
68+
checkConfig()
69+
stm32_list = genSTM32List(hal_path, None)
70+
# Reverse order to get WBA before WB to ease svd sorting
71+
stm32_list.sort(reverse=True)
72+
# Clean up core svd folder
73+
deleteFolder(stm32_svd_dir)
74+
createFolder(stm32_svd_dir)
75+
# Update the Core folder
76+
copyFolder(cubeclt_svd_path / "Core", stm32_svd_dir / "Core")
77+
# Update the license
78+
copyFile(cubeclt_svd_path / "about.html", stm32_svd_dir)
79+
# Copy the version
80+
copyFile(cubeclt_path / ".version", stm32_svd_dir / "STM32CubeCLT.version")
81+
# Create all directories
82+
for serie in stm32_list:
83+
createFolder(stm32_svd_dir / f"STM32{serie}xx")
84+
# Get all xml files
85+
svd_list = sorted(cubeclt_svd_path.glob("STM32*.svd"))
86+
87+
# Copy all svd files per series
88+
for svd_file in svd_list:
89+
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
94+
95+
96+
if __name__ == "__main__":
97+
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