Skip to content

cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22427

Open
itsadarshnair wants to merge 4 commits into
RIOT-OS:masterfrom
itsadarshnair:stm32u385-bringup
Open

cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22427
itsadarshnair wants to merge 4 commits into
RIOT-OS:masterfrom
itsadarshnair:stm32u385-bringup

Conversation

@itsadarshnair

@itsadarshnair itsadarshnair commented Jun 29, 2026

Copy link
Copy Markdown

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: new u3 CPU family — CPU_FAM/line/RAM/ROM detection
    (stm32_info.mk, stm32_mem_lengths.mk), CMSIS header selection, Kconfig
    family/model definitions, and the cpu_stm32u3 feature.
  • Clock: stmclk_u3.c + clk/u3/cfg_clock_default.h. The U3 reaches high SYSCLK
    via the MSI oscillator (no PLL bring-up needed); FLASH wait states are wired to
    the ACR register to avoid HardFaults at higher frequencies.
  • Core register fixups so the family compiles: APB3 / AHB1ENR1-2 enable routing,
    FLASH key, EXTI/SYSCFG, and CLOCK_LSI (periph/cpu_common.h, periph_cpu.h,
    periph/u3/periph_cpu.h).
  • Peripherals in this PR: GPIO (incl. EXTI external interrupts) and
    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.:

STM32_Programmer_CLI -c port=SWD mode=Normal reset=HWrst freq=8000 \
    -e all \
    -w bin/nucleo-u385rg-q/<application>.elf \
    -v -rst

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 master today — the stm32u3 CPU family and the
nucleo-u385rg-q board do not exist there, so make BOARD=nucleo-u385rg-q fails
on 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.

Adarsh Nair Mullachery 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.
@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: doc Area: Documentation Area: build system Area: Build system Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: Kconfig Area: Kconfig integration labels Jun 29, 2026
@itsadarshnair itsadarshnair changed the title Stm32u385 bringup cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support Jun 29, 2026
@crasbe crasbe added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 29, 2026
@crasbe crasbe self-assigned this Jun 29, 2026
@riot-ci

riot-ci commented Jun 30, 2026

Copy link
Copy Markdown

Murdock results

✔️ PASSED

2b65641 boards/nucleo-u385rg-q: document STM32CubeProgrammer flashing

Success Failures Total Runtime
11123 0 11124 11m:39s

Artifacts

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

Labels

Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants