Skip to content

Commit 912c1f7

Browse files
committed
ci(stm32variant): syswkup update
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 922ac7f commit 912c1f7

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

CI/update/stm32variant.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,21 +1248,21 @@ def print_peripheral():
12481248
# PinNamesVar.h generation
12491249
def manage_syswkup():
12501250
if len(syswkup_list) != 0:
1251-
# Find the max range of SYS_WKUP to ensure it doesn't exceed
1252-
# the current maximum range of SYS_WKUP used by STM32LowPower
1251+
# Find the max range of SYS_WKUP.
1252+
# Ensure it is compatible with the current maximum range
1253+
# used by STM32LowPower.
12531254
max_range = syswkup_list[-1][2].replace("SYS_WKUP", "")
1254-
max_range = int(max_range) if max_range else 1
1255+
max_range = int(max_range) if max_range else 8
12551256
# F446 start from 0
12561257
base_index = 1
12571258
if syswkup_list[0][2].replace("SYS_WKUP", "") == "0":
12581259
base_index = 0
12591260
max_range += 1
1260-
if max_range > 8:
1261-
print(
1262-
f"Error: SYS_WKUP range exceeds the current maximum range of 8 --> {max_range}."
1263-
)
1264-
exit(1)
1265-
syswkup_pins_list = [[] for _ in range(8)]
1261+
# Ensure the max_range is at least 8
1262+
# as some mcu PWR_WAKEUP_PINx while not SYS_WKUPx
1263+
if max_range < 8:
1264+
max_range = 8
1265+
syswkup_pins_list = [[] for _ in range(max_range)]
12661266
for p in syswkup_list:
12671267
num = p[2].replace("SYS_WKUP", "")
12681268
num = int(num) if num else 1
@@ -1280,6 +1280,8 @@ def manage_syswkup():
12801280
def print_pinamevar():
12811281
# First check core version and search PWR_WAKEUP_*
12821282
syswkup_type = "PIN"
1283+
if "STM32WB0" in mcu_family:
1284+
syswkup_type = "PINNAME"
12831285
if mcu_core[0][1] == 33:
12841286
# Search in stm32{series}xx_hal_pwr.h WR_WAKEUP_
12851287
pwr_header_file_path = (

CI/update/templates/PinNamesVar.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@
2727
{% set outer_loop = loop %}
2828
{% if syswkup_list %}
2929
{% for syswkup in syswkup_list %}
30+
{% if syswkup_type == "PINNAME" %}
31+
#ifdef PWR_WAKEUP_{{syswkup[0].replace("_", "")}}
32+
{% else %}
3033
#ifdef PWR_WAKEUP_{{syswkup_type}}{{outer_loop.index}}
34+
{% endif %}
3135
SYS_WKUP{{outer_loop.index}}{{"_{}".format(loop.index - 1) if loop.index > 1}} = {{syswkup[0]}},{{syswkup[1]}}
3236
#endif
3337
{% endfor %}
3438
{% else %}
39+
{% if syswkup_type != "PINNAME" %}
3540
#ifdef PWR_WAKEUP_{{syswkup_type}}{{loop.index}}
3641
SYS_WKUP{{loop.index}} = NC,
3742
#endif
43+
{% endif %}
3844
{% endif %}
3945
{% endfor %}
4046
{% else %}

0 commit comments

Comments
 (0)