Add STM32 MCU foundation#413
Conversation
21c4538 to
2818dbf
Compare
There was a problem hiding this comment.
Pull request overview
Introduces the initial STM32 Cortex‑M4 platform foundation for OpenBSW (NUCLEO‑G474RE and NUCLEO‑F413ZH), including CMSIS/ST device headers, startup code, linker scripts, and CMake integration/presets for cross-compiling.
Changes:
- Adds STM32 platform selection + per-chip CMake configuration modules (STM32F413ZH / STM32G474RE).
- Adds
bspMcuwith CMSIS/ST headers, startup assembly, linker scripts, and a software reset wrapper. - Adds STM32 CMake presets and root build integration for the new STM32 platforms.
Reviewed changes
Copilot reviewed 31 out of 34 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| platforms/stm32/CMakeLists.txt | Adds STM32 platform entrypoint and chip selection via STM32_CHIP. |
| platforms/stm32/cmake/stm32g474re.cmake | Defines STM32G474RE chip parameters and paths to startup/linker artifacts. |
| platforms/stm32/cmake/stm32f413zh.cmake | Defines STM32F413ZH chip parameters and paths to startup/linker artifacts. |
| platforms/stm32/bsp/CMakeLists.txt | Adds STM32 BSP subtree (currently only bspMcu). |
| platforms/stm32/bsp/bspMcu/startup/startup_stm32g474xx.s | Startup/reset handler + vector table for STM32G474xx. |
| platforms/stm32/bsp/bspMcu/startup/startup_stm32f413xx.s | Startup/reset handler + vector table for STM32F413xx. |
| platforms/stm32/bsp/bspMcu/src/reset/softwareSystemReset.cpp | Adds software-triggered system reset wrapper with weak pre-reset hook. |
| platforms/stm32/bsp/bspMcu/module.spec | Declares module metadata. |
| platforms/stm32/bsp/bspMcu/linker/STM32G474RExx_FLASH.ld | Linker script for STM32G474RE flash/RAM layout. |
| platforms/stm32/bsp/bspMcu/linker/STM32F413ZHxx_FLASH.ld | Linker script for STM32F413ZH flash/RAM layout. |
| platforms/stm32/bsp/bspMcu/include/reset/softwareSystemReset.h | Public header for software reset API. |
| platforms/stm32/bsp/bspMcu/include/mcu/typedefs.h | Adds NVIC convenience macro mappings. |
| platforms/stm32/bsp/bspMcu/include/mcu/mcu.h | Single include point for chip headers + platform interrupt macros. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/st/stm32g4/system_stm32g4xx.h | Imports ST system header for G4 family. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/st/stm32g4/stm32g4xx.h | Imports ST device-family header for G4. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/st/stm32f4/system_stm32f4xx.h | Imports ST system header for F4 family. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/st/stm32f4/stm32f4xx.h | Imports ST device-family header for F4. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/m-profile/cmsis_gcc_m.h | Imports CMSIS compiler support header (GCC, M-profile). |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/m-profile/cmsis_clang_m.h | Imports CMSIS compiler support header (Clang, M-profile). |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/m-profile/armv7m_mpu.h | Imports CMSIS MPU API for Armv7‑M. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/LICENSE | Adds Apache-2.0 license text for CMSIS import. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/cmsis_version.h | Imports CMSIS version header. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/cmsis_gcc.h | Imports CMSIS GCC compiler abstraction header. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/cmsis_compiler.h | Imports CMSIS compiler selection header. |
| platforms/stm32/bsp/bspMcu/include/3rdparty/cmsis/cmsis_clang.h | Imports CMSIS Clang compiler abstraction header. |
| platforms/stm32/bsp/bspMcu/doc/index.rst | Adds module documentation for the STM32 MCU foundation layer. |
| platforms/stm32/bsp/bspMcu/CMakeLists.txt | Defines bspMcu library and includes/compile defs for STM32. |
| executables/referenceApp/platforms/nucleo_g474re/Options.cmake | Adds referenceApp options for NUCLEO‑G474RE. |
| executables/referenceApp/platforms/nucleo_g474re/CMakeLists.txt | Adds placeholder board CMakeLists. |
| CMakePresets.json | Adds STM32 build/test presets (boards × RTOS). |
| CMakeLists.txt | Adds STM32 platform detection for selecting platforms/stm32 and Rust target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
76aa238 to
8dfaa91
Compare
|
Thank you for the review.
Full restructured plan: We'll rebase the series to match and update the PRs. |
|
Are you still planning to provide the PR 0, and update the others, as documented there? OTOH, you can also convert the PRs to "draft" for now, and in the beginning of collaboration in this project, first work on one of the smaller tasks under "issues". |
|
Yes, sticking with the plan. Starting with PR 0 (CMSIS move to |
|
Hi @rolandreichweinbmw — PR 0 is now open as #445 (cmake-format CI cleared via Marking #414–422 as draft for now while #445 is in review, per your suggestion. |
|
Now that #445 is merged, you can pick up this PR, resolve conflicts and remove the redundant CMSIS copy. |
|
Thanks, this is done now. I rebased the branch, resolved the conflict, removed the redundant STM32 CMSIS copy, and CI is green. |
e5ab109 to
71a2b34
Compare
|
Thank you for the patience with this PR. All review points should now be addressed: the ST device headers are RIM-controlled (cmsis_device_f4 v2.6.11, cmsis_device_g4 v1.2.6), the At the moment, we are simply out of capacity to re-check this PR continuously, but we will do our best to keep reviewing and improving it one at a time. Thank you again for your helpful comments. |
6d7b411 to
e68743f
Compare
Import the STM32F4 and STM32G4 CMSIS device headers from STMicroelectronics' dedicated RIM-tracked repositories. Keep only the F413 and G474 headers needed by the STM32 MCU foundation and record the unused upstream headers as RIM ignores.
Add the STM32 platform entry point, chip CMake files, bspMcu startup code, a software reset wrapper, and the STM32 unit-test presets. The platform reuses the shared CMSIS core from libs/3rdparty/cmsis instead of carrying a local copy.
e68743f to
77986f2
Compare
Purpose of this PR
Description
First PR of the STM32 platform port. It adds the MCU foundation for
STM32G474RE (FDCAN) and STM32F413ZH (bxCAN):
cmsis_device_g4 v1.2.6), with NOTICE.md entry and LICENSE
mcu/mcu.hwrapper; the shared CMSIS core fromlibs/3rdparty/cmsis(refactor: extract shared CMSIS to libs/3rdparty/cmsis #445) is reused, no local copy
tests-stm32-debug/tests-stm32-releasepresetsBoard executables and presets arrive in later PRs together with the
board code, so everything in this PR builds on its own.
Series overview:
Related Issues
Continues #408 (closed, split into this series). See also #394.
Breaking Changes
Test Plan
cmake --preset tests-stm32-debugconfigures and buildsRegression Tests
Have tests been added/updated? [ ] Yes [x] No — unit tests come with
the drivers in PRs 3–4