Skip to content

Commit 1bbf2f4

Browse files
GeorgeCGVMathieu Choplain
andcommitted
scripts: genpinctrl: handle unsupported pindata gracefully
The latest STM32 Open Pin Data revision contains SoC descriptors that are not handled properly by genpinctrl yet. These files are parsed properly but trigger an exception during the pinctrl template rendering. Add exception logic around template rendering so that problematic SoC files are skipped - with an error message - instead of crashing the script, which would otherwise prevent regeneration of DTSI for *all* SoCs. This allows us to keep updating the pinctrl DTSI for supported SoCs even when new SoCs requiring genpinctrl updates are added to Pin Data. Co-authored-by: Mathieu Choplain <[email protected]> Signed-off-by: Georgij Cernysiov <[email protected]>
1 parent 019d825 commit 1bbf2f4

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

scripts/genpinctrl/genpinctrl.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,18 @@ def main(data_path, output):
695695
)
696696

697697
# write pinctrl file
698-
ref_file = family_dir / (ref["name"].lower() + "-pinctrl.dtsi")
699-
with open(ref_file, "w") as f:
700-
f.write(
701-
pinctrl_template.render(
702-
family=family, pinctrl_addr=pinctrl_addr, entries=entries
703-
)
698+
pinctrl_filename = f"{ref['name'].lower()}-pinctrl.dtsi"
699+
rendered = ""
700+
try:
701+
rendered = pinctrl_template.render(
702+
family=family, pinctrl_addr=pinctrl_addr, entries=entries
704703
)
704+
except Exception:
705+
logger.error(f"Skipping '{pinctrl_filename}' (rendering failed)")
706+
continue
707+
708+
with open(family_dir / pinctrl_filename, "w") as f:
709+
f.write(rendered)
705710

706711
# write readme file
707712
try:

0 commit comments

Comments
 (0)