Skip to content

Commit 19f8e10

Browse files
committed
fix(ci): naming exception
WL3 does not have the same naming convention than other series. product_line definition are not the same convention nor case. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 72aedb0 commit 19f8e10

File tree

2 files changed

+49
-13
lines changed

2 files changed

+49
-13
lines changed

CI/update/stm32variant.py

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,12 +1647,36 @@ def print_variant(generic_list, alt_syswkup_list):
16471647
def search_product_line(valueline: str, extra: str) -> str:
16481648
product_line = ""
16491649
product_line_list = product_line_dict[mcu_family]
1650-
if not valueline.startswith("STM32MP1"):
1650+
if valueline.startswith("STM32MP1"):
1651+
# previous
1652+
# Unfortunately, MP1 does not follows the same naming rules
1653+
for pline in product_line_dict[mcu_family]:
1654+
vline = valueline
1655+
product_line = pline
1656+
# Remove the 'x' character from pline and
1657+
# the one at same index in the vline
1658+
while 1:
1659+
idx = pline.find("x")
1660+
if idx > 0:
1661+
pline = pline.replace("x", "", 1)
1662+
if "STM32MP15xx" != vline:
1663+
vline = vline[:idx] + vline[idx + 1 :]
1664+
else:
1665+
break
1666+
if pline >= vline and pline[:10] == vline[:10]:
1667+
break
1668+
else:
1669+
# In case of CMSIS device does not exist
1670+
product_line = "STM32MP15xx"
1671+
elif valueline.startswith("STM32WL3"):
16511672
for idx_pline, pline in enumerate(product_line_list):
16521673
vline = valueline
1674+
# Add an 'x' at the end to match the length
1675+
# as startup file contains only one 'x' at the end
1676+
# STM32WL3xx -> STM32WL30K8
1677+
# STM32WL3Rx -> STM32WL3RK8
16531678
product_line = pline
1654-
if vline.startswith("STM32WB0") or vline.startswith("STM32WL3"):
1655-
pline = pline + "xx"
1679+
pline = pline + "x"
16561680
# Remove the 'x' character from pline and
16571681
# the one at same index in the vline
16581682
while 1:
@@ -1662,7 +1686,8 @@ def search_product_line(valueline: str, extra: str) -> str:
16621686
vline = vline[:idx] + vline[idx + 1 :]
16631687
else:
16641688
break
1665-
if pline >= vline:
1689+
# Exact match or generic name
1690+
if pline == vline or product_line == "STM32WL3xx":
16661691
if (
16671692
extra
16681693
and len(product_line_list) > idx_pline + 1
@@ -1674,27 +1699,34 @@ def search_product_line(valueline: str, extra: str) -> str:
16741699
else:
16751700
# In case of CMSIS device does not exist
16761701
product_line = ""
1702+
product_line = product_line.upper()
16771703
else:
1678-
# previous
1679-
# Unfortunately, MP1 does not follows the same naming rules
1680-
for pline in product_line_dict[mcu_family]:
1704+
for idx_pline, pline in enumerate(product_line_list):
16811705
vline = valueline
16821706
product_line = pline
1707+
if vline.startswith("STM32WB0"):
1708+
pline = pline + "xx"
16831709
# Remove the 'x' character from pline and
16841710
# the one at same index in the vline
16851711
while 1:
16861712
idx = pline.find("x")
16871713
if idx > 0:
16881714
pline = pline.replace("x", "", 1)
1689-
if "STM32MP15xx" != vline:
1690-
vline = vline[:idx] + vline[idx + 1 :]
1715+
vline = vline[:idx] + vline[idx + 1 :]
16911716
else:
16921717
break
1693-
if pline >= vline and pline[:10] == vline[:10]:
1718+
if pline >= vline:
1719+
if (
1720+
extra
1721+
and len(product_line_list) > idx_pline + 1
1722+
and product_line_list[idx_pline + 1] == (product_line + extra)
1723+
):
1724+
# Look for the next product line if contains the extra
1725+
product_line = product_line_list[idx_pline + 1]
16941726
break
16951727
else:
16961728
# In case of CMSIS device does not exist
1697-
product_line = "STM32MP15xx"
1729+
product_line = ""
16981730
return product_line
16991731

17001732

CI/update/stm32wrapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,16 @@ def printCMSISStartup(log):
123123
for fn_list in group_startup_list:
124124
if len(fn_list) == 1:
125125
valueline = re.split("_|\\.", fn_list[0])
126-
vline = valueline[1].upper().replace("X", "x")
126+
vline = valueline[1].upper()
127+
if not valueline[1].startswith("stm32wl3"):
128+
vline = vline.replace("X", "x")
127129
cmsis_list.append({"vline": vline, "fn": fn_list[0], "cm": ""})
128130
else:
129131
for fn in fn_list:
130132
valueline = re.split("_|\\.", fn)
131-
vline = valueline[1].upper().replace("X", "x")
133+
vline = valueline[1].upper()
134+
if not valueline[1].startswith("stm32wl3"):
135+
vline = vline.replace("X", "x")
132136
cm = valueline[2].upper()
133137
cmsis_list.append({"vline": vline, "fn": fn, "cm": cm})
134138
with open(CMSIS_Startupfile, "w", newline="\n") as out_file:

0 commit comments

Comments
 (0)