Skip to content

Conversation

@tinnedkarma
Copy link
Contributor

@tinnedkarma tinnedkarma commented Jan 17, 2026

Summary

Some time ago I've learned about the nuttx's clk framework. My work being mostly on stm32h7 mcu's I've some nucleo boards to spare.

I've worked in my spare time on moving the reset and clock configuration to this clk framework.

It is starting to get some shape although I'm kinda worried that is not really the "embedded" way of doing things.

It uses more (by 100% some can say) ram usage to store the clk structs, the clk file part of the procfs needs 10kb ram just to generate the output buffer.

That being said, there are lot's of reasons to use this approach, at least of this beefy stm32h7 mcu family.
It simplifies a lot the clock interaction

I'll keep this in draft to see if there is any use of these changes. Anyone is free, or encouraged, to have a look over this changes, although lots of things still missing, the stm32_rcc.c file is close to something final.

Impact

Should be considered breaking change.
Lot's of things will differ.

  • The previous clock configuration was done in the board.h while the initialization was done in some stm32_clkconfig function.
  • usart driver will be reworked to adapt the new clk config.
  • timers?? not yet there but most probably there should be changes as well.
  • small changes thru ought the stm3h7 family will be touched

Testing

This is still work in progress, so, not many tests, other than the development lifecycle

@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Area: OS Components OS Components issues Board: arm Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Jan 17, 2026
@@ -244,10 +244,11 @@ static uint32_t clk_divider_bestdiv(FAR struct clk_s *clk, uint32_t rate,
}

mindiv = 0;
if (divider->flags & CLK_DIVIDER_MINDIV_MSK)
if ((divider->flags & CLK_DIVIDER_MINDIV_MSK) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

it's better to move clock framework self change to new pr

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: Drivers Drivers issues Area: OS Components OS Components issues 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.

2 participants