Skip to content

Commit c53e5c0

Browse files
scripts: genpinctrl: only wipe folder of series we generate pinctrl for
When generating pinctrl for all families, don't delete the entire output folder as it may contain pinctrl for STM32Cube HAL2 series which CANNOT be regenerated by the script. Instead, wipe the folder of every series for which we will generate pinctrl right before doing said generation. When a family filter is active, continue to delete nothing as is the case today. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
1 parent 9552455 commit c53e5c0

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

scripts/genpinctrl/genpinctrl.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@
7979
]
8080
"""Supported SoC families"""
8181

82-
HAL2_FAMILIES = [
83-
"stm32c5",
84-
]
85-
"""SoC families relying on HAL2"""
86-
8782
PIN_MODS = [
8883
"_C", # Pins with analog switch (H7)
8984
]
@@ -628,18 +623,6 @@ def main(data_path, output):
628623
gpio_ip_afs = get_gpio_ip_afs(data_path)
629624
mcu_signals = get_mcu_signals(data_path, gpio_ip_afs)
630625

631-
# erase output if we're about to generate for all families
632-
if output.exists() and not FAMILY_FILTER.is_active():
633-
shutil.rmtree(output)
634-
output.mkdir(parents=True)
635-
# Do not consider SoCs related to HAL2
636-
for family in HAL2_FAMILIES:
637-
family_path = output / "st" / family.removeprefix("stm32")
638-
try:
639-
run(["git", "checkout", "--", family_path], check=True)
640-
except CalledProcessError:
641-
break
642-
643626
for family, refs in mcu_signals.items():
644627
# check family is supported
645628
if family.lower() not in SUPPORTED_FAMILIES:
@@ -648,8 +631,13 @@ def main(data_path, output):
648631
else:
649632
logger.info(f"Processing family {family}...")
650633

651-
# create destination directory for the family
634+
# Create destination directory for the family,
635+
# but wipe it first if we're generating for all
636+
# families (i.e., family filter is not active).
652637
family_dir = output / "st" / family.lower().removeprefix("stm32")
638+
639+
if family_dir.exists() and not FAMILY_FILTER.is_active():
640+
shutil.rmtree(family_dir)
653641
family_dir.mkdir(parents=True, exist_ok=True)
654642

655643
# process each reference of the family

0 commit comments

Comments
 (0)