Skip to content

Commit bfef7e6

Browse files
mathieuchopstmfabiobaltieri
authored andcommitted
soc: st: stm32: reorganize family-wide common Kconfig
Split STM32 family-wide common Kconfig in two separate files: a new Kconfig file `soc/st/stm32/common/Kconfig` to hold options that affect the common code found in the same directory, and the existing top-level Kconfig file `soc/st/stm32/Kconfig` which now only holds options used by multiple series but not consumed by the common code - for example, options that are used by SoC-specific code or consumed by the STM32Cube HAL module go in this file. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 236e0d0 commit bfef7e6

File tree

2 files changed

+71
-52
lines changed

2 files changed

+71
-52
lines changed

soc/st/stm32/Kconfig

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,28 @@ if SOC_FAMILY_STM32
1010

1111
rsource "*/Kconfig"
1212

13-
# STM32 wide symbols definitions
14-
15-
# Workaround for not being able to have commas in macro arguments
16-
DT_CHOSEN_Z_CCM := zephyr,ccm
17-
18-
config STM32_CCM
19-
def_bool $(dt_chosen_enabled,$(DT_CHOSEN_Z_CCM))
20-
13+
# Kconfig options used to configure the family-wide code
14+
# found in `common/` are declared in `common/Kconfig`.
15+
# Some options are also shared by multiple series, but not
16+
# used by this family-wide common code; instead, they are
17+
# consumed by certain drivers, SoC-specific code or the
18+
# STM32Cube HAL module.
19+
#
20+
# (Please indicate as a comment where each option is consumed)
21+
22+
# This option is consumed by the HAL module
2123
config USE_STM32_ASSERT
2224
depends on ASSERT
2325
bool "STM32Cube HAL and LL drivers asserts"
2426
help
2527
Enable asserts in STM32Cube HAL and LL drivers.
2628

27-
config STM32_BACKUP_SRAM
28-
bool "STM32 Backup SRAM"
29-
default y
30-
depends on DT_HAS_ST_STM32_BACKUP_SRAM_ENABLED
31-
help
32-
Enable support for STM32 backup SRAM.
33-
34-
config STM32_BACKUP_SRAM_INIT_PRIORITY
35-
int "STM32 Backup SRAM init priority"
36-
default APPLICATION_INIT_PRIORITY
37-
depends on STM32_BACKUP_SRAM
38-
help
39-
STM32 Backup SRAM device initialization priority.
40-
41-
config STM32_ENABLE_DEBUG_SLEEP_STOP
42-
bool "Allow debugger attach in stop/sleep Mode"
43-
default y if DEBUG
44-
help
45-
Some STM32 parts disable the DBGMCU in sleep/stop modes because
46-
of power consumption. As a side-effects this prevents
47-
debuggers from attaching w/o resetting the target. This
48-
effectively destroys the use-case of `west attach`. Also
49-
SEGGER RTT and similar technologies need this.
50-
51-
config SWJ_ANALOG_PRIORITY
52-
int "SWJ DP port to analog routine initialization priority"
53-
default 49
54-
help
55-
Initialization priority of the routine within the PRE_KERNEL1 level.
56-
This priority must be greater than GPIO_INIT_PRIORITY and lower than
57-
UART_INIT_PRIORITY.
58-
5929
config HAS_STM32_FLASH_PREFETCH
6030
bool
6131
help
6232
Hidden symbol selected by SoCs which support flash prefetch.
6333

34+
# This option is consumed by `soc.c` of applicable series
6435
config STM32_FLASH_PREFETCH
6536
bool "Flash prefetch buffer"
6637
default y
@@ -70,18 +41,7 @@ config STM32_FLASH_PREFETCH
7041
be enabled when flash is accessed through a cache memory. Flash
7142
prefetch also improves performances a bit.
7243

73-
config STM32_WKUP_PINS
74-
bool "STM32 PWR Wake-up Pins"
75-
depends on DT_HAS_ST_STM32_PWR_ENABLED
76-
help
77-
Enable support for STM32 PWR wake-up pins.
78-
79-
config STM32_BACKUP_PROTECTION
80-
bool "SoC has backup domain protection access"
81-
help
82-
Enabled for SoCs for which access protection to backup domain
83-
resources needs to be explicitly handled.
84-
44+
# This option is consumed by external flash drivers
8545
config STM32_APP_IN_EXT_FLASH
8646
bool
8747
help

soc/st/stm32/common/Kconfig

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) 2025 STMicroelectronics
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Kconfig options for STM32 family-wide code
5+
#
6+
# The following options are used to enable or configure
7+
# code in `soc/st/stm32/common` which is shared between
8+
# multiple STM32 series.
9+
#
10+
11+
# Workaround for not being able to have commas in macro arguments
12+
DT_CHOSEN_Z_CCM := zephyr,ccm
13+
14+
config STM32_CCM
15+
def_bool $(dt_chosen_enabled,$(DT_CHOSEN_Z_CCM))
16+
17+
config STM32_BACKUP_SRAM
18+
bool "STM32 Backup SRAM"
19+
default y
20+
depends on DT_HAS_ST_STM32_BACKUP_SRAM_ENABLED
21+
help
22+
Enable support for STM32 backup SRAM.
23+
24+
config STM32_BACKUP_SRAM_INIT_PRIORITY
25+
int "STM32 Backup SRAM init priority"
26+
default APPLICATION_INIT_PRIORITY
27+
depends on STM32_BACKUP_SRAM
28+
help
29+
STM32 Backup SRAM device initialization priority.
30+
31+
config STM32_ENABLE_DEBUG_SLEEP_STOP
32+
bool "Allow debugger attach in stop/sleep Mode"
33+
default y if DEBUG
34+
help
35+
Some STM32 parts disable the DBGMCU in sleep/stop modes because
36+
of power consumption. As a side-effects this prevents
37+
debuggers from attaching w/o resetting the target. This
38+
effectively destroys the use-case of `west attach`. Also
39+
SEGGER RTT and similar technologies need this.
40+
41+
config SWJ_ANALOG_PRIORITY
42+
int "SWJ DP port to analog routine initialization priority"
43+
default 49
44+
help
45+
Initialization priority of the routine within the PRE_KERNEL1 level.
46+
This priority must be greater than GPIO_INIT_PRIORITY and lower than
47+
UART_INIT_PRIORITY.
48+
49+
config STM32_WKUP_PINS
50+
bool "STM32 PWR Wake-up Pins"
51+
depends on DT_HAS_ST_STM32_PWR_ENABLED
52+
help
53+
Enable support for STM32 PWR wake-up pins.
54+
55+
config STM32_BACKUP_PROTECTION
56+
bool "SoC has backup domain protection access"
57+
help
58+
Enabled for SoCs for which access protection to backup domain
59+
resources needs to be explicitly handled.

0 commit comments

Comments
 (0)