@@ -184,8 +184,9 @@ def wrap(arg_core, arg_cmsis, log):
184
184
lower = serie .lower ()
185
185
186
186
# Search stm32yyxx_[hal|ll]*.c file
187
- filelist = src .glob (f"stm32{ lower } xx_*.c" )
187
+ filelist = src .glob (f"**/ stm32{ lower } xx_*.c" )
188
188
for fp in filelist :
189
+ legacy = True if fp .parent .name == "Legacy" else False
189
190
# File name
190
191
fn = fp .name
191
192
found = peripheral_c_regex .match (fn )
@@ -194,14 +195,30 @@ def wrap(arg_core, arg_cmsis, log):
194
195
peripheral = found .group (1 ) if found else "hal"
195
196
if "_ll_" in fn :
196
197
if peripheral in ll_c_dict :
197
- ll_c_dict [peripheral ].append (lower )
198
+ if legacy :
199
+ # Change legacy value if exists
200
+ current_list = ll_c_dict .pop (peripheral )
201
+ if current_list [- 1 ][0 ] == lower :
202
+ current_list .pop ()
203
+ current_list .append ((lower , legacy ))
204
+ ll_c_dict [peripheral ] = current_list
205
+ else :
206
+ ll_c_dict [peripheral ].append ((lower , legacy ))
198
207
else :
199
- ll_c_dict [peripheral ] = [lower ]
208
+ ll_c_dict [peripheral ] = [( lower , legacy ) ]
200
209
else :
201
210
if peripheral in hal_c_dict :
202
- hal_c_dict [peripheral ].append (lower )
211
+ if legacy :
212
+ # Change legacy value if exists
213
+ current_list = hal_c_dict .pop (peripheral )
214
+ if current_list [- 1 ][0 ] == lower :
215
+ current_list .pop ()
216
+ current_list .append ((lower , legacy ))
217
+ hal_c_dict [peripheral ] = current_list
218
+ else :
219
+ hal_c_dict [peripheral ].append ((lower , legacy ))
203
220
else :
204
- hal_c_dict [peripheral ] = [lower ]
221
+ hal_c_dict [peripheral ] = [( lower , legacy ) ]
205
222
206
223
# Search stm32yyxx_ll_*.h file
207
224
filelist = inc .glob (f"stm32{ lower } xx_ll_*.h" )
0 commit comments