Skip to content

Commit 12a6dea

Browse files
committed
ci(wrapper): add HAL legacy support
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 949ecc8 commit 12a6dea

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CI/update/stm32wrapper.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ def wrap(arg_core, arg_cmsis, log):
184184
lower = serie.lower()
185185

186186
# Search stm32yyxx_[hal|ll]*.c file
187-
filelist = src.glob(f"stm32{lower}xx_*.c")
187+
filelist = src.glob(f"**/stm32{lower}xx_*.c")
188188
for fp in filelist:
189+
legacy = True if fp.parent.name == "Legacy" else False
189190
# File name
190191
fn = fp.name
191192
found = peripheral_c_regex.match(fn)
@@ -194,14 +195,14 @@ def wrap(arg_core, arg_cmsis, log):
194195
peripheral = found.group(1) if found else "hal"
195196
if "_ll_" in fn:
196197
if peripheral in ll_c_dict:
197-
ll_c_dict[peripheral].append(lower)
198+
ll_c_dict[peripheral].append((lower, legacy))
198199
else:
199-
ll_c_dict[peripheral] = [lower]
200+
ll_c_dict[peripheral] = [(lower, legacy)]
200201
else:
201202
if peripheral in hal_c_dict:
202-
hal_c_dict[peripheral].append(lower)
203+
hal_c_dict[peripheral].append((lower, legacy))
203204
else:
204-
hal_c_dict[peripheral] = [lower]
205+
hal_c_dict[peripheral] = [(lower, legacy)]
205206

206207
# Search stm32yyxx_ll_*.h file
207208
filelist = inc.glob(f"stm32{lower}xx_ll_*.h")

CI/update/templates/stm32yyxx_zz_ppp.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#pragma GCC diagnostic push
33
#pragma GCC diagnostic ignored "-Wunused-parameter"
44

5-
{% for serie in serieslist %}
5+
{% for serie, legacy in serieslist %}
66
{% if loop.first %}
77
#ifdef STM32{{serie.upper()}}xx
88
{% else %}
@@ -11,7 +11,11 @@
1111
{% if type == periph %}
1212
#include "stm32{{serie}}xx_{{type}}.c"
1313
{% else %}
14+
{% if legacy %}
15+
#include "Legacy/stm32{{serie}}xx_{{type}}_{{periph}}.c"
16+
{% else %}
1417
#include "stm32{{serie}}xx_{{type}}_{{periph}}.c"
18+
{% endif %}
1519
{% endif %}
1620
{% if loop.last %}
1721
#endif

0 commit comments

Comments
 (0)