Visitar URL original
arch/arm/src/stm32: unify LSI driver and make RCC headers per-family by raiden00pl · Pull Request #20487 · apache/nuttx · GitHub
Skip to content

arch/arm/src/stm32: unify LSI driver and make RCC headers per-family - #20487

Merged
xiaoxiang781216 merged 2 commits into
apache:masterfrom
raiden00pl:stm32_refactor_all-lsi
Oct 9, 2026
Merged

xiaoxiang781216 merged 2 commits into
apache:masterfrom
raiden00pl:stm32_refactor_all-lsi

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

Merge the per-family LSI oscillator drivers into a single core-agnostic common/stm32/stm32_lsi.c.

To let a common/stm32 driver resolve RCC register definitions for every family without a central chip enumeration, the
common/stm32/hardware/stm32_rcc.h dispatcher is removed and each family now provides its own hardware/stm32_rcc.h.

Impact

less code duplication

Testing

CI

@github-actions github-actions Bot added 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. labels Oct 7, 2026
xiaoxiang781216
xiaoxiang781216 previously approved these changes Oct 7, 2026
@raiden00pl
raiden00pl force-pushed the stm32_refactor_all-lsi branch from a6da0d8 to 814f520 Compare October 7, 2026 14:12
@github-actions github-actions Bot added Area: CI Size: M The size of the change in this PR is medium and removed Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

xiaoxiang781216
xiaoxiang781216 previously approved these changes Oct 7, 2026
acassis
acassis previously approved these changes Oct 8, 2026
@acassis

acassis commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@raiden00pl please fix the conflicting files

@raiden00pl
raiden00pl dismissed stale reviews from acassis and xiaoxiang781216 via c717dd8 October 9, 2026 06:49
@raiden00pl
raiden00pl force-pushed the stm32_refactor_all-lsi branch from c717dd8 to 1d8dc40 Compare October 9, 2026 09:46
Merge the per-family LSI oscillator drivers into a single core-agnostic
common/stm32/stm32_lsi.c.

To let a common/stm32 driver resolve RCC register definitions for every
family without a central chip enumeration, the
common/stm32/hardware/stm32_rcc.h dispatcher is removed and each family
that uses it now provides its own hardware/stm32_rcc.h.

stm32_lsi.c is built unconditionally for all families (including C5 and
U3, which had no LSI driver before); unused code is dropped by the linker.
The WB stm32_rcc_enable_lsi()/stm32_rcc_disable_lsi() are renamed to the
common stm32_rcc_enablelsi()/stm32_rcc_disablelsi().

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
On U5 LSION is in RCC_BDCR, which is write-protected after reset.
Without PWR DBP set the LSION write is ignored and stm32_rcc_enablelsi()
waits forever for LSIRDY.

- Add STM32_HAVE_IP_PWR_M33_V1 (U5) to the common PWR register
  dispatcher and the common stm32_pwr.h, so common code can reach the
  U5 PWR definitions and stm32_pwr_enablebkp().
- Rename stm32u5/hardware/stm32_pwr.h to stm32u5xx_pwr.h, so the common
  dispatcher can include it.
- In stm32_lsi.c enable backup domain write access around the BDCR
  update, as the common LSE drivers do.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@raiden00pl
raiden00pl force-pushed the stm32_refactor_all-lsi branch from 1d8dc40 to b49f8d9 Compare October 9, 2026 11:03
@xiaoxiang781216
xiaoxiang781216 merged commit db514c3 into apache:master Oct 9, 2026
52 of 53 checks passed
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: CI Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants