Skip to content

Conversation

djiatsaf-st
Copy link
Contributor

@djiatsaf-st djiatsaf-st commented Jul 8, 2025

Following discussions in #85368

This PR moves the definitions of MAIN_STACK_SIZE, IDLE_STACK_SIZE, and ISR_STACK_SIZE to a dedicated defconfig file.

These changes specifically concern the STM32 families: F0, G0, and L0 , boards with low memory.

Copy link
Contributor

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM functionally.

Move CONFIG_MAIN_STACK_SIZE to be the default in the
Kconfig.defconfig files and avoid code duplication in each
related soc.
SOC_STM32F031X6 has its  own configuration so keep it in its
soc file.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Move CONFIG_MAIN_STACK_SIZE to be the default in the
Kconfig.defconfig stm32g031xx file.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Move CONFIG_MAIN_STACK_SIZE to be the default in the
Kconfig.defconfig files and avoid code duplication in each
related soc.
SOC_STM32L011XX has its own configuration so keep it in its
soc file.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Copy link

sonarqubecloud bot commented Jul 8, 2025

@mathieuchopstm mathieuchopstm added this to the v4.3.0 milestone Jul 9, 2025
Comment on lines +20 to +28
# Reduce kernel stack sizes to fit in 8 KiB RAM
config MAIN_STACK_SIZE
default 640 if SOC_STM32F030X4 || SOC_STM32F030X8 || SOC_STM32F051X8

config IDLE_STACK_SIZE
default 200 if SOC_STM32F030X4 || SOC_STM32F030X8 || SOC_STM32F051X8

config ISR_STACK_SIZE
default 512 if SOC_STM32F030X4 || SOC_STM32F030X8 || SOC_STM32F051X8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's work on a common Kconfig piece that would define profiles based on DT_CHOSEN(zephyr_ram) and apply it on the whole STM32 family.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. at family Kconfig level

config MAIN_STACK_SIZE
    default 640 if SRAM_SIZE <= 8192
    default ... if SRAM_SIZE <= ....

etc

@djiatsaf-st djiatsaf-st marked this pull request as draft August 7, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants