5757)
5858all_ll_header_file_template = j2_env .get_template (all_ll_h_file )
5959ll_h_file_template = j2_env .get_template (ll_h_file )
60+ util_h_file_template = j2_env .get_template ("stm32yyxx_util_ppp.h" )
6061c_file_template = j2_env .get_template (c_file )
6162dsp_file_template = Template ('#include "../Source/{{ dsp_dir }}/{{ dsp_name }}"\n \n ' )
6263stm32_def_build_template = j2_env .get_template (stm32_def_build_file )
6566# re
6667feat_c_regex = re .compile (r"stm32[^_]+_(.*).c$" )
6768feat_h_regex = re .compile (r"stm32[^_]+_(.*).h$" )
69+ feat_util_h_regex = re .compile (r"stm32[^_]+_util_(.*).h$" )
6870
6971
7072def checkConfig (arg_core , arg_cmsis ):
@@ -188,6 +190,8 @@ def wrap(arg_core, arg_cmsis, log):
188190 ll_h_dict = {}
189191 ll_c_dict = {}
190192 hal_c_dict = {}
193+ util_h_dict = {}
194+
191195 # Search all files for each series
192196 for series in stm32_series :
193197 nx = stm32_dict [series ]
@@ -254,6 +258,20 @@ def wrap(arg_core, arg_cmsis, log):
254258 ll_h_dict [feature ].append ((lower , stm32_dict [series ]))
255259 else :
256260 ll_h_dict [feature ] = [(lower , stm32_dict [series ])]
261+ # Search stm32yyxx_util_.*.h file
262+ filelist = inc .glob (f"stm32{ lower } { nx } _util_*.h" )
263+ for fp in filelist :
264+ # File name
265+ fn = fp .name
266+ found = feat_util_h_regex .match (fn )
267+ if not found :
268+ continue
269+ feature = found .group (1 )
270+ # Add to util_h_dict to generate a header file for it
271+ if feature in util_h_dict :
272+ util_h_dict [feature ].append ((lower , stm32_dict [series ]))
273+ else :
274+ util_h_dict [feature ] = [(lower , stm32_dict [series ])]
257275
258276 # Generate stm32yyxx_hal_*.c file
259277 for key , value in hal_c_dict .items ():
@@ -276,7 +294,11 @@ def wrap(arg_core, arg_cmsis, log):
276294 out_file .write (ll_h_file_template .render (feat = key , serieslist = value ))
277295 if log :
278296 print ("done" )
279-
297+ # Generate stm32yyxx_util_*.h file
298+ for key , value in util_h_dict .items ():
299+ filepath = SrcWrapper_path / "inc" / f"stm32yyxx_util_{ key } .h"
300+ with open (filepath , "w" , newline = "\n " ) as out_file :
301+ out_file .write (util_h_file_template .render (feat = key , serieslist = value ))
280302 # Filter all LL header file
281303 all_ll_h_list = sorted (set (all_ll_h_list ))
282304 # Generate the all LL header file
0 commit comments