Skip to content

!arch/stm32: split stm32 and stm32f0l0g0 into per-chip-family directories#19143

Open
raiden00pl wants to merge 16 commits into
apache:masterfrom
raiden00pl:stm32_refactor_all_pr8
Open

!arch/stm32: split stm32 and stm32f0l0g0 into per-chip-family directories#19143
raiden00pl wants to merge 16 commits into
apache:masterfrom
raiden00pl:stm32_refactor_all_pr8

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

This PR moves the shared arch/arm/src/stm32 and arch/arm/src/stm32f0l0g0 arch and board code into common/stm32 directories and splits the two historical super-directories into one directory per chip family.

Most of the changes in the PR involve moving files and using "git mv" to preserve git history. The size of this PR is quite large, but it can't be broken down into smaller pieces without breaking CI.

I also added a page in the documentation summarizing the stm32 ports standardization with migration guide.

Reference: #19004

Fixes #16172 and #18894

Impact

BREAKING CHANGE: Each STM32 family now has a separate directory in the arch. arch/arm/src/stm32 was divided into:

  • arch/arm/src/stm32l1
  • arch/arm/src/stm32f1
  • arch/arm/src/stm32f2
  • arch/arm/src/stm32f3
  • arch/arm/src/stm32f4
  • arch/arm/src/stm32g4

arch/arm/src/stm32f0l0g0 was divided into:

  • arch/arm/src/stm32c0
  • arch/arm/src/stm32g0
  • arch/arm/src/stm32l0
  • arch/arm/src/stm32f0

The common code that was used by the families was moved to arch/arm/src/common/stm32.

For boards, common STM32 board code was introduced in boards/arm/common/stm32. It can now we shared for all STM32 families and board code can be reused. Migration of the rest STM32 families to board common will be done later.

Testing

CI

@github-actions github-actions Bot added Area: Build system Arch: arm Issues related to ARM (32-bit) architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: arm labels Jun 15, 2026
@raiden00pl raiden00pl force-pushed the stm32_refactor_all_pr8 branch 5 times, most recently from 2fc9180 to 93dd46b Compare June 15, 2026 12:00
@hartmannathan

Copy link
Copy Markdown
Contributor

@michallenc has objections to move common code to arch/arm/src/common/stm32 in #19004 (comment) and I understand it, but I don't see any other option to solve this problem. The alternative is either to leave arch/stm32 and arch/stm32f0l0g0 (problem not solved), or to duplicate the code for all families (even bigger problem).

Yet another option might be to change common sources from arch/arm/src/common/stm32 to arch/arm/src/st or arch/arm/src/stm32, but the current path follows another example of common sources in arch: arch/risc-v/src/common/espressif.

I prefer consistency as much as possible throughout the NuttX tree. Once someone becomes familiar with using NuttX on one architecture, it is beneficial if other architectures follow similar patterns.

arch/arm/src/common/stm32 is a parallel of arch/risc-v/src/common/espressif, so that would give us two architectures following a similar pattern. Hopefully other architectures are consistent with this layout too.

jerpelea
jerpelea previously approved these changes Jun 16, 2026
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@raiden00pl please fix the conflict

BREAKING CHANGE: Move the existing STM32 board common sources to
boards/arm/common/stm32 and fold in the common STM32F0/L0/G0/C0
board helpers so split STM32 board families can share one source
tree.

Signed-off-by: raiden00pl <raiden00@railab.me>
Add boards/arm/stm32l4/common so STM32L4 boards build through the shared
STM32 board-common tree (boards/arm/common/stm32), like the other split
STM32 families.

Convert each STM32L4 board's src/Makefile to src/Make.defs so the
per-board sources are pulled in by the common board Makefile.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE: Common STM32 source and private header files moved to
arch/arm/src/common/stm32. Out-of-tree code that references family-local
common source paths must update includes, build rules, and source paths
to the new common STM32 location.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32f0 sources, headers and boards into arch/arm/src/stm32f0,
arch/arm/include/stm32f0 and boards/arm/stm32f0.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32l0 sources, headers and boards into arch/arm/src/stm32l0,
arch/arm/include/stm32l0 and boards/arm/stm32l0.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32g0 sources, headers and boards into arch/arm/src/stm32g0,
arch/arm/include/stm32g0 and boards/arm/stm32g0.

Signed-off-by: raiden00pl <raiden00@railab.me>
Move the stm32c0 sources, headers and boards into arch/arm/src/stm32c0,
arch/arm/include/stm32c0 and boards/arm/stm32c0, then finalize the split:
source each split family directly in arch/arm/Kconfig and boards/Kconfig and
remove the now-empty combined arch/arm/src/stm32f0l0g0 and
boards/arm/stm32f0l0g0 trees.

BREAKING CHANGE: The combined STM32F0/L0/G0/C0 architecture and board
paths were split into stm32f0, stm32l0, stm32g0, and stm32c0 directories.
Out-of-tree boards, include paths, source paths, and defconfigs must move
from stm32f0l0g0 to the matching split family.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32f1 sources, headers and boards into arch/arm/src/stm32f1,
arch/arm/include/stm32f1 and boards/arm/stm32f1.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32f2 sources, headers and boards into arch/arm/src/stm32f2,
arch/arm/include/stm32f2 and boards/arm/stm32f2.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32f3 sources, headers and boards into arch/arm/src/stm32f3,
arch/arm/include/stm32f3 and boards/arm/stm32f3.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32f4 sources, headers and boards into arch/arm/src/stm32f4,
arch/arm/include/stm32f4 and boards/arm/stm32f4.

Signed-off-by: raiden00pl <raiden00@railab.me>
BREAKING CHANGE:

Part of splitting the legacy stm32 super-directory; relocates
the stm32g4 sources, headers and boards into arch/arm/src/stm32g4,
arch/arm/include/stm32g4 and boards/arm/stm32g4.

Signed-off-by: raiden00pl <raiden00@railab.me>
Move the stm32l1 sources, headers and boards into arch/arm/src/stm32l1,
arch/arm/include/stm32l1 and boards/arm/stm32l1, then finalize the split:
source each split family directly in arch/arm/Kconfig and boards/Kconfig and
remove the now-empty combined arch/arm/src/stm32 and boards/arm/stm32 trees.

BREAKING CHANGE: The legacy STM32 architecture and board paths were split into
stm32f1, stm32l1, stm32f2, stm32f3, stm32f4, and stm32g4 directories.
Out-of-tree boards must move from stm32 to the matching split family.

Signed-off-by: raiden00pl <raiden00@railab.me>
fix various stm32 boards errors found by CI

Signed-off-by: raiden00pl <raiden00@railab.me>
update arm-13.dat build targets so they match state before stm32 split

Signed-off-by: raiden00pl <raiden00@railab.me>
add STM32 porting guide

Signed-off-by: raiden00pl <raiden00@railab.me>
@raiden00pl raiden00pl dismissed stale reviews from jerpelea and xiaoxiang781216 via eba261d June 16, 2026 09:12
@raiden00pl raiden00pl force-pushed the stm32_refactor_all_pr8 branch from 93dd46b to eba261d Compare June 16, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Build system Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The naming for stm32f0l0g0 architecture is no longer valid

4 participants