cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22175
cpu/stm32: add initial STM32U3 and nucleo-u385rg-q support#22175itsadarshnair wants to merge 16 commits intoRIOT-OS:masterfrom
Conversation
crasbe
left a comment
There was a problem hiding this comment.
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
| - name: cpu_stm32u5 | ||
| help: The MCU has an STM32 U5 MCU | ||
| - name: cpu_stm32u3 | ||
| help: The MCU has an STM32 U3 MCU |
There was a problem hiding this comment.
| - 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.
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/stm32_mem_lengths.mk
Outdated
| ifneq (, $(filter $(STM32_MODEL2), 7 8)) | ||
| RAM_LEN = 768K | ||
| SRAM4_LEN = 16K | ||
| BACKUP_RAM_ADDR = 0x40036400 | ||
| BACKUP_RAM_LEN = 0x2K | ||
| endif | ||
| endif |
There was a problem hiding this comment.
| endif | |
| endif |
Whitespace error introduced.
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/stm32_info.mk
Outdated
| 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) |
There was a problem hiding this comment.
| 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...
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/kconfigs/u3/Kconfig
Outdated
| /* | ||
| * SPDX-FileCopyrightText: 2026 Adarsh Nair Mullachery | ||
| * SPDX-License-Identifier: LGPL-2.1-only | ||
| */ |
There was a problem hiding this comment.
| /* | |
| * 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.
There was a problem hiding this comment.
Please adapt the other Kconfig files yourself.
There was a problem hiding this comment.
Fixed in the latest commit.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| #define AHB12_PERIPH_EN RCC->AHB1ENR2 | |
| #define AHB12_PERIPH_EN RCC->AHB1ENR2 |
Whitespace error.
There was a problem hiding this comment.
Fixed in the latest commit.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Please also adapt the other files accordingly.
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/periph/pm.c
Outdated
| @@ -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) | |||
There was a problem hiding this comment.
| #elif defined(CPU_FAM_STM32U5) | |
| #elif defined(CPU_FAM_STM32U5) |
Whitespace error.
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/Makefile.cmsis
Outdated
| @@ -31,6 +29,8 @@ PKG_VERSION_l1=dafdef897e29b4f5934f1e2b9de9957410435476 | |||
| PKG_VERSION_l4=013bf0e41256ffbc2b539676f2007d08b297a86a | |||
| # v1.0.5 | |||
| PKG_VERSION_l5=a43f959bdb1e7449cbabe14356ca9309dbd48ad3 | |||
| # v1.2.0 (STM32U3 CMSIS) | |||
There was a problem hiding this comment.
| # v1.2.0 (STM32U3 CMSIS) | |
| # v1.2.0 |
There was a problem hiding this comment.
Fixed in the latest commit.
cpu/stm32/Makefile.features
Outdated
| @@ -64,6 +64,7 @@ STM32_WITH_VBAT = stm32f031% stm32f038% stm32f042% stm32f048% \ | |||
| stm32l412% stm32l433% stm32l45% stm32l47% stm32l49% stm32l4r% \ | |||
| stm32l5% \ | |||
| stm32u5% \ | |||
| stm32u3% \ | |||
There was a problem hiding this comment.
| stm32u3% \ | |
| stm32u3% \ |
Wrong indentation.
There was a problem hiding this comment.
Fixed in the latest commit.
| # SPDX-FileCopyrightText: 2026 Technische Universität Hamburg | ||
| # SPDX-License-Identifier: LGPL-2.1-only |
There was a problem hiding this comment.
| # 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.
There was a problem hiding this comment.
Resolved it in latest commit
4072c14 to
ca4fb00
Compare
Contribution description
This PR adds initial support for the STM32U3 family and the NUCLEO-U385RG-Q board.
It includes:
cpu/stm32boards/nucleo-u385rg-qAt 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/blinkyapplication on thenucleo-u385rg-qboard.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: