cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22427
Open
itsadarshnair wants to merge 4 commits into
Open
cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22427itsadarshnair wants to merge 4 commits into
itsadarshnair wants to merge 4 commits into
Conversation
added 4 commits
June 29, 2026 00:18
Add the STM32U3 (Cortex-M33) family to the STM32 CPU support: CPU_FAM detection and line/RAM/ROM info, CMSIS header selection, Kconfig family and model definitions, and the cpu_stm32u3 feature. Clock bring-up uses the MSI oscillator to reach high SYSCLK (no PLL needed); FLASH wait states are connected to the ACR register. Core register fixups (APB3, AHB1ENR1/2, FLASH key, CLOCK_LSI) are added so the family compiles.
Wire up GPIO (incl. EXTI/SYSCFG for external interrupts) and the UART/LPUART driver for STM32U3, including LPUART clock routing.
Add the Nucleo-U385RG-Q board with the minimum to boot: CPU/clock selection, LED/button, timer, and the UART/LPUART serial console. Additional peripherals are added in a follow-up.
OpenOCD does not yet support the STM32U3, so note the STM32CubeProgrammer CLI workflow as the interim way to flash the board.
|
Hey @itsadarshnair, thank you for your first contribution! We really appreciate it! If you haven't already, please take a look at our contributing guidelines before the review process starts. Also, due to how the GitHub review system works, please avoid force-pushing or squashing your commits unless asked to by a maintainer (or unless your commit is still in "draft commit" stage). Lastly, make sure to comply with our AI Policy when using AI. Your pull request will be reviewed as soon as possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR adds initial support for the STM32U3 MCU family (Cortex-M33, TrustZone)
and the NUCLEO-U385RG-Q board, covering the minimum needed to boot RIOT and
interact with it over a serial console.
Parts of RIOT involved:
cpu/stm32: newu3CPU family —CPU_FAM/line/RAM/ROM detection(
stm32_info.mk,stm32_mem_lengths.mk), CMSIS header selection, Kconfigfamily/model definitions, and the
cpu_stm32u3feature.stmclk_u3.c+clk/u3/cfg_clock_default.h. The U3 reaches high SYSCLKvia the MSI oscillator (no PLL bring-up needed); FLASH wait states are wired to
the ACR register to avoid HardFaults at higher frequencies.
FLASH key, EXTI/SYSCFG, and
CLOCK_LSI(periph/cpu_common.h,periph_cpu.h,periph/u3/periph_cpu.h).UART/LPUART (USART1 = ST-LINK VCP / STDIO, LPUART1), plus the general-purpose
timer backend.
boards/nucleo-u385rg-q: new thin Nucleo-64 board (LED/button, clock selection,serial console pins).
Additional peripherals (ADC, SPI, I2C, PWM, USB, RTC, VBAT, HWRNG, flashpage) are
added in a follow-up PR stacked on top of this one.
Testing procedure
These apps were compiled for the NUCLEO-U385RG-Q and run on hardware:
cd examples/basic/blinky && make BOARD=nucleo-u385rg-q
cd examples/basic/default && make BOARD=nucleo-u385rg-q
cd tests/periph/uart && make BOARD=nucleo-u385rg-q
cd tests/periph/timer_periodic && make BOARD=nucleo-u385rg-q
cd tests/periph/gpio_ll && make BOARD=nucleo-u385rg-q
Note
OpenOCD does not yet support the STM32U3, so
make flash(default programmer:openocd) does not work for this board. Until OpenOCD support lands, flash the
built ELF with the STM32CubeProgrammer CLI, e.g.:
After flashing, open the serial console (ST-LINK VCP, 115200 baud) with
make BOARD=nucleo-u385rg-q term.Expected results:
blinky— the green User LED (LD2) blinks, confirming clock + GPIO bring-up.default— the RIOT shell comes up on the VCP and responds to commands,confirming the UART/STDIO console.
tests/periph/uart— UART/LPUART behaves as the test expects.tests/periph/timer_periodic— the periodic timer fires at the expected intervals.tests/periph/gpio_ll— GPIO including external interrupts (EXTI) works.None of this is available in
mastertoday — thestm32u3CPU family and thenucleo-u385rg-qboard do not exist there, somake BOARD=nucleo-u385rg-qfailson master with an unknown board.
Issues/PRs references
Supersedes #22175 (that PR is being split into this focused bring-up PR plus a
peripherals PR for easier review). The peripherals follow-up is stacked on this
branch and depends on it.
Declaration of AI-Tools / LLMs usage:
AI-Tools / LLMs that were used are:
-Claude for code generation but reviewed by user.
-Gemini for planning and review.