Skip to content

STM32L4: support UART5 for debug output#37

Merged
thomasw04 merged 4 commits intomainfrom
feature/print-uart5
Mar 1, 2026
Merged

STM32L4: support UART5 for debug output#37
thomasw04 merged 4 commits intomainfrom
feature/print-uart5

Conversation

@xarantolus
Copy link
Contributor

@xarantolus xarantolus commented Mar 1, 2026

This MR basically just resurrects some code I've written quite some time ago. It's also integrated with the config system, so a user can just select UART5 and it'll work.

Tested output using the hello-world example on cave and that works, but didn't really test the UART5_RX part, but that should be the correct pin. But tbh we probably don't care.

One thing that would be a bit nicer is if we did the comparison of huart->Instance at compile time / only compiled in the relevant code, but didn't really get that working nicely with preprocessor macros - any opinion on that?

@xarantolus xarantolus marked this pull request as ready for review March 1, 2026 11:54
Copilot AI review requested due to automatic review settings March 1, 2026 11:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds STM32L4 debug output support for selecting UART5 in addition to the existing LPUART1 path, wiring up the necessary RCC clock and GPIO AF configuration in the STM32L4xx UART interface.

Changes:

  • Extend debug.uart configuration option to allow selecting UART5.
  • Add UART5-specific MSP init (clock selection + GPIOC/ GPIOD pin configuration) in the STM32L4xx UART interface.
  • Update UART interface includes to pull in additional STM32/HAL headers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
options.toml Expands the debug UART selection to include UART5.
machine/arm/stm32l4xx/interface/uart.c Implements UART5 clock + GPIO init path for debug UART output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

LCOV of commit 0561a48 during Osiris CI #312

This pull request changes total coverage 0.00% (14.04% -> 14.04%) for this diff

lcov: WARNING: lcov: WARNING: RC option 'lcov_branch_coverage' is deprecated.  Consider using 'branch_coverage. instead.  (Backward-compatible support will be removed in the future
Summary coverage rate:
  lines......: 14.0% (232 of 1653 lines)
  functions..: 16.7% (39 of 233 functions)
  branches...: no data found

Files changed coverage rate: n/a

@thomasw04 thomasw04 self-requested a review March 1, 2026 16:22
@thomasw04 thomasw04 merged commit 29e9775 into main Mar 1, 2026
12 checks passed
@thomasw04 thomasw04 deleted the feature/print-uart5 branch March 1, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants