Skip to content

Commit b4f8379

Browse files
committed
fix(stm32variant): wrong product line generated
Fixes #2628. Signed-off-by: Frederic Pillon <[email protected]>
1 parent d8a8b20 commit b4f8379

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Diff for: CI/update/stm32variant.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -1584,10 +1584,11 @@ def print_variant(generic_list, alt_syswkup_list):
15841584
)
15851585

15861586

1587-
def search_product_line(valueline):
1587+
def search_product_line(valueline: str, extra: str) -> str:
15881588
product_line = ""
1589+
product_line_list = product_line_dict[mcu_family]
15891590
if not valueline.startswith("STM32MP1"):
1590-
for pline in product_line_dict[mcu_family]:
1591+
for idx_pline, pline in enumerate(product_line_list):
15911592
vline = valueline
15921593
product_line = pline
15931594
# Remove the 'x' character from pline and
@@ -1600,6 +1601,10 @@ def search_product_line(valueline):
16001601
else:
16011602
break
16021603
if pline >= vline:
1604+
if extra and len(product_line_list) > idx_pline + 1:
1605+
if product_line_list[idx_pline + 1] == (product_line + extra):
1606+
# Look for the next product line if contains the extra
1607+
product_line = product_line_list[idx_pline + 1]
16031608
break
16041609
else:
16051610
# In case of CMSIS device does not exist
@@ -1698,11 +1703,14 @@ def print_boards_entry():
16981703
}
16991704
)
17001705
# Search product line for last flash size
1706+
# Keep the AQ if any
1707+
subp = pl_regex.search(subf.group(3))
17011708
product_line = search_product_line(
17021709
"STM32"
17031710
+ subf.group(1)
17041711
+ subf.group(2).split("-")[-1]
1705-
+ package_regex.sub(r"", subf.group(3))
1712+
+ package_regex.sub(r"", subf.group(3)),
1713+
subp.group(1) if subp and subp.group(1) is not None else "",
17061714
)
17071715
else:
17081716
valueline = mcu_refname
@@ -1715,7 +1723,11 @@ def print_boards_entry():
17151723
"svd": search_svdfile(mcu_refname),
17161724
}
17171725
)
1718-
product_line = search_product_line(package_regex.sub(r"", valueline))
1726+
subp = pl_regex.search(valueline)
1727+
product_line = search_product_line(
1728+
package_regex.sub(r"", valueline),
1729+
subp.group(1) if subp and subp.group(1) is not None else "",
1730+
)
17191731

17201732
gen_entry = mcu_family.replace("STM32", "Gen")
17211733

@@ -2685,6 +2697,7 @@ def manage_repo():
26852697
# Clean temporary dir
26862698
deleteFolder(tmp_dir)
26872699

2700+
pl_regex = re.compile(r"([AQ])$")
26882701
package_regex = re.compile(r"[\w][\w]([ANPQSXZ])?$")
26892702
flash_group_regex = re.compile(r"(.*)\((.*)\)(.*)")
26902703

0 commit comments

Comments
 (0)