Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KamilDuljas
Copy link

@KamilDuljas KamilDuljas commented Nov 24, 2025

Pull Request Overview

Add initial support for STM32L4xx family (specifically L476):

  • Implement clock management (MSI, HSI, PLL, peripheral clocks)
  • Add RCC, PWR, Flash, GPIO, EXTI, and SYSCFG drivers
  • Implement interrupt-based USART driver (no DMA)
  • Add chip-specific traits for clock constants and flash latency
  • Create stm32l476rg board crate with default peripherals
  • Add nucleo_l476rg board support with LED, button, GPIO, and console
  • Implement MSI as default 4MHz system clock source

Testing Strategy

Tested on STM32L476RG Nucleo board.

TODO or Help Wanted

This pull request still needs...

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

Add complete support for STM32L4xx family (specifically L476):
- Implement clock management (MSI, HSI, PLL, peripheral clocks)
- Add RCC, PWR, Flash, GPIO, EXTI, and SYSCFG drivers
- Implement interrupt-based USART driver (no DMA)
- Add chip-specific traits for clock constants and flash latency
- Create stm32l476rg board crate with default peripherals
- Add nucleo_l476rg board support with LED, button, GPIO, and console
- Implement MSI as default 4MHz system clock source

All drivers follow Tock's HIL interfaces and coding standards.
Tested on STM32L476RG Nucleo board.
@github-actions github-actions bot added the stm32 label Nov 24, 2025
Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

Very cool! I only skimmed much of the files in chips/stm32l4xx. I'm not an STM expert and someone more familiar with that family of chips should take a look at whether this crate organization is proper, or should be further deduplicated with other STM chip implementations. But apart from that, this looks pretty good!

Tagging @alexandruradovici as one of the resident STM chip maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but we probably want to create an stm/ subdirectory in boards to keep our directory structure manageable, similar to what we do for nordic/.


#![no_std]
#![no_main]
//#![deny(missing_docs)]
Copy link
Member

Choose a reason for hiding this comment

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

Reenable?

Comment on lines +314 to +317
// Optional kernel tests
//
// See comment in `boards/imix/src/main.rs`
// virtual_uart_rx_test::run_virtual_uart_receive(mux_uart);
Copy link
Member

Choose a reason for hiding this comment

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

Remove.

Comment on lines +16 to +21
[features]
# Currently, Tock supports only these chips.
# When a new chip is added, add its identifier here and inside
# the chip's crate as a feature for the dependency.
stm32l476 = []

Copy link
Member

Choose a reason for hiding this comment

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

I think we shouldn't prematurely define features that aren't actually used in the codebase (as far as I can tell). We can add them as soon as we have another chip crate using this common infrastructure.

Comment on lines +233 to +237
// Return BUSY if setting the frequency took too long. The caller can either:
//
// + recall this method
// + or busy wait get_latency() until the flash latency has the desired value
Err(ErrorCode::BUSY)
Copy link
Member

Choose a reason for hiding this comment

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

I'd guess AGAIN could be a better error code here? What are the cases where this is expected to happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants