Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion CI/update/stm32wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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():
Expand All @@ -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
Expand Down
24 changes: 24 additions & 0 deletions CI/update/templates/stm32yyxx_util_ppp.h
Original file line number Diff line number Diff line change
@@ -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_ */

17 changes: 17 additions & 0 deletions libraries/SrcWrapper/inc/stm32yyxx_util_i3c.h
Original file line number Diff line number Diff line change
@@ -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_ */
Loading