Skip to content

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

Open
itsadarshnair wants to merge 16 commits intoRIOT-OS:masterfrom
itsadarshnair:stm32u385-port
Open

cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22175
itsadarshnair wants to merge 16 commits intoRIOT-OS:masterfrom
itsadarshnair:stm32u385-port

Conversation

@itsadarshnair
Copy link
Copy Markdown

@itsadarshnair itsadarshnair commented Apr 5, 2026

Contribution description

This PR adds initial support for the STM32U3 family and the NUCLEO-U385RG-Q board.

It includes:

  • initial STM32U3 CPU family support under cpu/stm32
  • board support for boards/nucleo-u385rg-q
  • basic clock and peripheral configuration required for bring-up

At the moment, this is an initial bring-up PR. The board boots and the LED blinking example was verified on hardware. Other peripherals and features may still be incomplete or untested.

At this stage, OpenOCD flashing support is not yet available. The board was programmed using STM32CubeProgrammer.

Testing procedure

The changes were tested with the examples/basic/blinky application on the nucleo-u385rg-q board.

Build:
bash
make -C examples/basic/blinky BOARD=nucleo-u385rg-q

Issues/PRs references

Progress for Tracking Issue #19264.

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • ChatGPT for understanding the porting process, code generation/suggestions, with user review
  • Gemini for understanding the porting process and code suggestions, with user review

@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 Apr 5, 2026
@crasbe crasbe added Type: new feature The issue requests / The PR implemements a new feature for RIOT State: needs rebase State: The codebase was changed since the creation of the PR, making a rebase necessary labels Apr 5, 2026
Copy link
Copy Markdown
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Thank you for creating the Pull Request with the STM32U3 support.

This is the first review round that is has mostly style related comments. I will do a second round once everything style-wise is in order.

There are merge conflicts that have to be resolved before this can be merged.

features.yaml Outdated
Comment on lines +329 to +332
- name: cpu_stm32u5
help: The MCU has an STM32 U5 MCU
- name: cpu_stm32u3
help: The MCU has an STM32 U3 MCU
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- name: cpu_stm32u5
help: The MCU has an STM32 U5 MCU
- name: cpu_stm32u3
help: The MCU has an STM32 U3 MCU
- name: cpu_stm32u3
help: The MCU has an STM32 U3 MCU
- name: cpu_stm32u5
help: The MCU has an STM32 U5 MCU

Keep the right order.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

ifneq (, $(filter $(STM32_MODEL2), 7 8))
RAM_LEN = 768K
SRAM4_LEN = 16K
BACKUP_RAM_ADDR = 0x40036400
BACKUP_RAM_LEN = 0x2K
endif
endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
endif
endif

Whitespace error introduced.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

Comment on lines +88 to +93
else ifeq (u5,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)
else ifeq (u3,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
else ifeq (u5,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)
else ifeq (u3,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)
else ifeq (u3,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)
else ifeq (u5,$(CPU_FAM))
CPU_CORE = cortex-m33
SVD_MODEL := STM32U$(STM32_MODEL)

Also here, keeping the order (although the others are not really ordered either...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

Comment on lines +1 to +4
/*
* SPDX-FileCopyrightText: 2026 Adarsh Nair Mullachery
* SPDX-License-Identifier: LGPL-2.1-only
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/*
* SPDX-FileCopyrightText: 2026 Adarsh Nair Mullachery
* SPDX-License-Identifier: LGPL-2.1-only
*/
# SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
# SPDX-License-Identifier: LGPL-2.1-only

Kconfig uses hastags as comment indicators, not C++ style comments.

Also, as this is part of your Project Thesis, the copyright holder is the Technische Universität Hamburg. For files that have a Doxygen header, the Author is you but the Copyright header is TUHH.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please adapt the other Kconfig files yourself.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some files are missing Copyright headers. Please add the SPDX style Copyright header with TUHH copyright.
See #21515 (or as you did in the Kconfig files).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

/* if CPU has AHB/AHB1 bus */
#if defined(AHBPERIPH_BASE) || \
defined(CPU_FAM_STM32F3)
#define AHB_PERIPH_EN RCC->AHBENR
#elif defined(CPU_FAM_STM32U3)
#define AHB1_PERIPH_EN RCC->AHB1ENR1
#define AHB12_PERIPH_EN RCC->AHB1ENR2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define AHB12_PERIPH_EN RCC->AHB1ENR2
#define AHB12_PERIPH_EN RCC->AHB1ENR2

Whitespace error.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please adapt the order of the #if defined() statements here that the U3 is before the U5.

Even though not everything is ordered, I'd like to maintain some level of order.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please also adapt the other files accordingly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

@@ -54,11 +54,10 @@
#define PM_STOP_CONFIG (PWR_CR1_LPDS | PWR_CR1_FPDS | PWR_CR1_LPUDS)
#elif defined(CPU_FAM_STM32MP1)
#define PM_STOP_CONFIG (0)
#elif defined(CPU_FAM_STM32U5)
#elif defined(CPU_FAM_STM32U5)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#elif defined(CPU_FAM_STM32U5)
#elif defined(CPU_FAM_STM32U5)

Whitespace error.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

@@ -31,6 +29,8 @@ PKG_VERSION_l1=dafdef897e29b4f5934f1e2b9de9957410435476
PKG_VERSION_l4=013bf0e41256ffbc2b539676f2007d08b297a86a
# v1.0.5
PKG_VERSION_l5=a43f959bdb1e7449cbabe14356ca9309dbd48ad3
# v1.2.0 (STM32U3 CMSIS)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# v1.2.0 (STM32U3 CMSIS)
# v1.2.0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

@@ -64,6 +64,7 @@ STM32_WITH_VBAT = stm32f031% stm32f038% stm32f042% stm32f048% \
stm32l412% stm32l433% stm32l45% stm32l47% stm32l49% stm32l4r% \
stm32l5% \
stm32u5% \
stm32u3% \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
stm32u3% \
stm32u3% \

Wrong indentation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in the latest commit.

Comment on lines +1 to +2
# SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
# SPDX-License-Identifier: LGPL-2.1-only
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
# SPDX-License-Identifier: LGPL-2.1-only
/*
* SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
* SPDX-License-Identifier: LGPL-2.1-only
*/

For C-files you have to use the C-style comments of course 😅

Please also adapt the other files.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Resolved it in latest commit

@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: needs rebase State: The codebase was changed since the creation of the PR, making a rebase necessary labels Apr 6, 2026
@riot-ci
Copy link
Copy Markdown

riot-ci commented Apr 6, 2026

Murdock results

✔️ PASSED

f68d2cf fix remaining review issues

Success Failures Total Runtime
11023 0 11025 11m:45s

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