From df65d4981501e02a365fd8198164e93fe60414dd Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Fri, 24 Apr 2026 16:21:27 +0200 Subject: [PATCH 1/2] ci(stm32wrapper): add util header files Signed-off-by: Frederic Pillon --- CI/update/stm32wrapper.py | 24 +++++++++++++++++++++++- CI/update/templates/stm32yyxx_util_ppp.h | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 CI/update/templates/stm32yyxx_util_ppp.h diff --git a/CI/update/stm32wrapper.py b/CI/update/stm32wrapper.py index d57aa28b83..03e19409a3 100644 --- a/CI/update/stm32wrapper.py +++ b/CI/update/stm32wrapper.py @@ -57,6 +57,7 @@ ) all_ll_header_file_template = j2_env.get_template(all_ll_h_file) ll_h_file_template = j2_env.get_template(ll_h_file) +util_h_file_template = j2_env.get_template("stm32yyxx_util_ppp.h") c_file_template = j2_env.get_template(c_file) dsp_file_template = Template('#include "../Source/{{ dsp_dir }}/{{ dsp_name }}"\n\n') stm32_def_build_template = j2_env.get_template(stm32_def_build_file) @@ -65,6 +66,7 @@ # re feat_c_regex = re.compile(r"stm32[^_]+_(.*).c$") feat_h_regex = re.compile(r"stm32[^_]+_(.*).h$") +feat_util_h_regex = re.compile(r"stm32[^_]+_util_(.*).h$") def checkConfig(arg_core, arg_cmsis): @@ -188,6 +190,8 @@ def wrap(arg_core, arg_cmsis, log): ll_h_dict = {} ll_c_dict = {} hal_c_dict = {} + util_h_dict = {} + # Search all files for each series for series in stm32_series: nx = stm32_dict[series] @@ -254,6 +258,20 @@ def wrap(arg_core, arg_cmsis, log): ll_h_dict[feature].append((lower, stm32_dict[series])) else: ll_h_dict[feature] = [(lower, stm32_dict[series])] + # Search stm32yyxx_util_.*.h file + filelist = inc.glob(f"stm32{lower}{nx}_util_*.h") + for fp in filelist: + # File name + fn = fp.name + found = feat_util_h_regex.match(fn) + if not found: + continue + feature = found.group(1) + # Add to util_h_dict to generate a header file for it + if feature in util_h_dict: + util_h_dict[feature].append((lower, stm32_dict[series])) + else: + util_h_dict[feature] = [(lower, stm32_dict[series])] # Generate stm32yyxx_hal_*.c file for key, value in hal_c_dict.items(): @@ -276,7 +294,11 @@ def wrap(arg_core, arg_cmsis, log): out_file.write(ll_h_file_template.render(feat=key, serieslist=value)) if log: print("done") - + # Generate stm32yyxx_util_*.h file + for key, value in util_h_dict.items(): + filepath = SrcWrapper_path / "inc" / f"stm32yyxx_util_{key}.h" + with open(filepath, "w", newline="\n") as out_file: + out_file.write(util_h_file_template.render(feat=key, serieslist=value)) # Filter all LL header file all_ll_h_list = sorted(set(all_ll_h_list)) # Generate the all LL header file diff --git a/CI/update/templates/stm32yyxx_util_ppp.h b/CI/update/templates/stm32yyxx_util_ppp.h new file mode 100644 index 0000000000..e728b40ac5 --- /dev/null +++ b/CI/update/templates/stm32yyxx_util_ppp.h @@ -0,0 +1,24 @@ +#ifndef _STM32YYXX_UTIL_{{feat.upper()}}_H_ +#define _STM32YYXX_UTIL_{{feat.upper()}}_H_ +/* LL raised several warnings, ignore them */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#ifdef __cplusplus + #pragma GCC diagnostic ignored "-Wregister" +#endif + +{% for series, nx in serieslist %} + {% if loop.first %} +#ifdef STM32{{series.upper()}}{{nx}} + {% else %} +#elif STM32{{series.upper()}}{{nx}} + {% endif %} + #include "stm32{{series}}{{nx}}_util_{{feat}}.h" + {% if loop.last %} +#endif + {% endif %} +{% endfor %} +#pragma GCC diagnostic pop +#endif /* _STM32YYXX_UTIL_{{feat.upper()}}_H_ */ + From c59ab2094eb648ded72ba3d7a3b7986ae6d620cf Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Fri, 24 Apr 2026 16:24:47 +0200 Subject: [PATCH 2/2] chore: add generated util header file Signed-off-by: Frederic Pillon --- libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h diff --git a/libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h b/libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h new file mode 100644 index 0000000000..d072f81673 --- /dev/null +++ b/libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h @@ -0,0 +1,17 @@ +#ifndef _STM32YYXX_UTIL_I3C_H_ +#define _STM32YYXX_UTIL_I3C_H_ +/* LL raised several warnings, ignore them */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#ifdef __cplusplus + #pragma GCC diagnostic ignored "-Wregister" +#endif + +#ifdef STM32H5xx + #include "stm32h5xx_util_i3c.h" +#elif STM32U3xx + #include "stm32u3xx_util_i3c.h" +#endif +#pragma GCC diagnostic pop +#endif /* _STM32YYXX_UTIL_I3C_H_ */