Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.riminfo -whitespace
platforms/*/3rdparty/threadx/ports/** -whitespace
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ if (BUILD_EXECUTABLE STREQUAL "unitTest")
add_subdirectory(platforms/posix/bsp/bspEepromDriver/test)
add_subdirectory(platforms/posix/bsp/socketCanTransceiver/test)

elseif (OPENBSW_PLATFORM STREQUAL "stm32")

add_subdirectory(platforms/stm32/unitTest EXCLUDE_FROM_ALL)

add_subdirectory(platforms/stm32/bsp/bspCan/test)
add_subdirectory(platforms/stm32/bsp/bxCanTransceiver/test)
add_subdirectory(platforms/stm32/bsp/fdCanTransceiver/test)
add_subdirectory(platforms/stm32/safety/safeBspMcuWatchdog/test)

elseif (OPENBSW_PLATFORM STREQUAL "s32k1xx")

add_subdirectory(platforms/s32k1xx/unitTest EXCLUDE_FROM_ALL)
Expand Down
158 changes: 158 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,112 @@
"OPENBSW_PLATFORM": "s32k1xx"
}
},
{
"name": "tests-stm32-debug",
"displayName": "Configure for testing STM32 modules (debug)",
"description": "Configure for testing STM32 modules (debug)",
"inherits": "_config-base",
"binaryDir": "${sourceDir}/build/tests/stm32/Debug",
"cacheVariables": {
"CMAKE_DEFAULT_BUILD_TYPE": "Debug",
"CMAKE_CONFIGURATION_TYPES": "Debug",
"BUILD_EXECUTABLE": "unitTest",
"OPENBSW_PLATFORM": "stm32"
}
},
{
"name": "tests-stm32-release",
"displayName": "Configure for testing STM32 modules (release)",
"description": "Configure for testing STM32 modules (release)",
"inherits": "_config-base",
"binaryDir": "${sourceDir}/build/tests/stm32/Release",
"cacheVariables": {
"CMAKE_DEFAULT_BUILD_TYPE": "Release",
"CMAKE_CONFIGURATION_TYPES": "Release",
"BUILD_EXECUTABLE": "unitTest",
"OPENBSW_PLATFORM": "stm32"
}
},
{
"name": "nucleo-g474re-freertos-gcc",
"generator": "Ninja Multi-Config",
"displayName": "NUCLEO-G474RE FreeRTOS configuration (GCC)",
"description": "Configure for NUCLEO-G474RE platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "referenceApp",
"BUILD_TARGET_PLATFORM": "NUCLEO_G474RE",
"BUILD_TARGET_RTOS": "FREERTOS",
"STM32_CHIP": "STM32G474RE",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "nucleo-g474re-threadx-gcc",
"generator": "Ninja Multi-Config",
"displayName": "NUCLEO-G474RE ThreadX configuration (GCC)",
"description": "Configure for NUCLEO-G474RE platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "referenceApp",
"BUILD_TARGET_PLATFORM": "NUCLEO_G474RE",
"BUILD_TARGET_RTOS": "THREADX",
"STM32_CHIP": "STM32G474RE",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "nucleo-f413zh-freertos-gcc",
"generator": "Ninja Multi-Config",
"displayName": "NUCLEO-F413ZH FreeRTOS configuration (GCC)",
"description": "Configure for NUCLEO-F413ZH platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "referenceApp",
"BUILD_TARGET_PLATFORM": "NUCLEO_F413ZH",
"BUILD_TARGET_RTOS": "FREERTOS",
"STM32_CHIP": "STM32F413ZH",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "nucleo-f413zh-threadx-gcc",
"generator": "Ninja Multi-Config",
"displayName": "NUCLEO-F413ZH ThreadX configuration (GCC)",
"description": "Configure for NUCLEO-F413ZH platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "referenceApp",
"BUILD_TARGET_PLATFORM": "NUCLEO_F413ZH",
"BUILD_TARGET_RTOS": "THREADX",
"STM32_CHIP": "STM32F413ZH",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "posix-freertos",
"displayName": "POSIX-FREERTOS compliant configuration",
Expand Down Expand Up @@ -228,6 +334,44 @@
"configurePreset": "tests-s32k1xx-release",
"configuration": "Release"
},
{
"name": "tests-stm32-debug",
"displayName": "Build tests of STM32 modules (debug)",
"description": "Build tests of STM32 modules (debug)",
"configurePreset": "tests-stm32-debug",
"configuration": "Debug"
},
{
"name": "tests-stm32-release",
"displayName": "Build tests of STM32 modules (release)",
"description": "Build tests of STM32 modules (release)",
"configurePreset": "tests-stm32-release",
"configuration": "Release"
},
{
"name": "nucleo-g474re-freertos-gcc",
"displayName": "NUCLEO-G474RE FreeRTOS build (GCC)",
"description": "Build reference application for NUCLEO-G474RE platform with GCC",
"configurePreset": "nucleo-g474re-freertos-gcc"
},
{
"name": "nucleo-g474re-threadx-gcc",
"displayName": "NUCLEO-G474RE ThreadX build (GCC)",
"description": "Build reference application for NUCLEO-G474RE platform with GCC",
"configurePreset": "nucleo-g474re-threadx-gcc"
},
{
"name": "nucleo-f413zh-freertos-gcc",
"displayName": "NUCLEO-F413ZH FreeRTOS build (GCC)",
"description": "Build reference application for NUCLEO-F413ZH platform with GCC",
"configurePreset": "nucleo-f413zh-freertos-gcc"
},
{
"name": "nucleo-f413zh-threadx-gcc",
"displayName": "NUCLEO-F413ZH ThreadX build (GCC)",
"description": "Build reference application for NUCLEO-F413ZH platform with GCC",
"configurePreset": "nucleo-f413zh-threadx-gcc"
},
{
"name": "posix-freertos",
"displayName": "build POSIX-FREERTOS",
Expand Down Expand Up @@ -305,6 +449,20 @@
"description": "Run tests of S32K1XX modules (release)",
"configuration": "Release",
"configurePreset": "tests-s32k1xx-release"
},
{
"name": "tests-stm32-debug",
"displayName": "Run tests of STM32 modules (debug)",
"description": "Run tests of STM32 modules (debug)",
"configuration": "Debug",
"configurePreset": "tests-stm32-debug"
},
{
"name": "tests-stm32-release",
"displayName": "Run tests of STM32 modules (release)",
"description": "Run tests of STM32 modules (release)",
"configuration": "Release",
"configurePreset": "tests-stm32-release"
}
]
}
4 changes: 4 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ We recommend to read their licenses, as their terms may differ from the terms de
| FreeRTOS Real Time Kernel | 10.6.2 | MIT | ``platforms/posix/3rdparty/freeRtosPosix/LICENSE.md`` |
| FreeRTOS Real Time Kernel | 10.6.2 | MIT | ``platforms/s32k1xx/3rdparty/freertos_cm4_sysTick/LICENSE.md`` |
| FreeRTOS Real Time Kernel | 10.6.2 | MIT | ``libs/3rdparty/freeRtos/LICENSE.md`` |
| FreeRTOS Real Time Kernel | 10.6.2 | MIT | ``platforms/stm32/3rdparty/freertos_cm4_sysTick/LICENSE.md`` |
| ThreadX Kernel | 6.4.3 | MIT | ``libs/3rdparty/threadx/LICENSE.md`` |
| ThreadX Cortex M4 Port | 6.4.3 | MIT | ``platforms/s32k1xx/3rdparty/threadx/LICENSE.md`` |
| ThreadX Cortex M4 Port | 6.4.3 | MIT | ``platforms/stm32/3rdparty/threadx/LICENSE.md`` |
| ThreadX Linux Port | 6.4.3 | MIT | ``platforms/posix/3rdparty/threadx/LICENSE.md`` |
| CMSIS | 6.1.0 | Apache v2 | ``libs/3rdparty/cmsis/LICENSE`` |
| NXP S32K148 Headers | 1.1a | BSD-3 | ``platforms/s32k1xx/bsp/bspMcu/include/3rdparty/nxp/*.h`` |
| ST STM32F4 Device Headers | 2.6.11 | Apache v2 | ``platforms/stm32/bsp/bspMcu/include/3rdparty/st/LICENSE`` |
| ST STM32G4 Device Headers | 1.2.6 | Apache v2 | ``platforms/stm32/bsp/bspMcu/include/3rdparty/st/LICENSE`` |
| CodeCoverage | | BSD-3 | ``cmake/modules/CodeCoverage.cmake`` |

## MISRA
Expand Down
1 change: 1 addition & 0 deletions doc/dev/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Eclipse OpenBSW is a trademark of the Eclipse Foundation.
modules/common
modules/posix
modules/s32k1xx
modules/stm32
modules/executables
modules/mocks

Expand Down
9 changes: 9 additions & 0 deletions doc/dev/modules/executables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ S32K148EVB

../../../executables/referenceApp/platforms/s32k148evb/**/doc/index

STM32 Nucleo
++++++++++++

.. toctree::
:maxdepth: 1
:glob:

../../../executables/referenceApp/platforms/nucleo_*/**/doc/index

Safety
++++++

Expand Down
22 changes: 22 additions & 0 deletions doc/dev/modules/stm32.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
..
*******************************************************************************
Copyright (c) 2026 An Dao
This program and the accompanying materials are made available under the
terms of the Apache License Version 2.0 which is available at
https://www.apache.org/licenses/LICENSE-2.0

SPDX-License-Identifier: Apache-2.0
*******************************************************************************

STM32
=====

BSP
---

.. toctree::
:maxdepth: 1
:glob:

../../../platforms/stm32/**/doc/index
15 changes: 15 additions & 0 deletions executables/referenceApp/platforms/nucleo_f413zh/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# NUCLEO-F413ZH platform for referenceApp

add_subdirectory(bspConfiguration)
add_subdirectory(safety)
add_subdirectory(main)

if (BUILD_TARGET_RTOS STREQUAL "FREERTOS")
add_subdirectory(freeRtosCoreConfiguration)
add_library(freeRtosPort ALIAS freeRtosCm4SysTickPort)
add_library(freeRtosPortImpl ALIAS freeRtosCm4SysTick)
elseif (BUILD_TARGET_RTOS STREQUAL "THREADX")
add_subdirectory(threadXCoreConfiguration)
add_library(threadXPort ALIAS threadXCortexM4Port)
add_library(threadXPortImpl ALIAS threadXCortexM4)
endif ()
49 changes: 49 additions & 0 deletions executables/referenceApp/platforms/nucleo_f413zh/Options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# *******************************************************************************
# Copyright (c) 2026 An Dao
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# NUCLEO-F413ZH platform options

set(OPENBSW_PLATFORM
"stm32"
CACHE STRING "" FORCE)
set(STM32_CHIP
"STM32F413ZH"
CACHE STRING "" FORCE)
set(BUILD_TARGET_RTOS
"FREERTOS"
CACHE STRING "Target RTOS: FREERTOS or THREADX")

set(PLATFORM_SUPPORT_CAN
ON
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_IO
OFF
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_ETHERNET
OFF
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_TRANSPORT
ON
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_UDS
ON
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_WATCHDOG
OFF
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_MPU
OFF
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_STORAGE
OFF
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_ROM_CHECK
OFF
CACHE BOOL "" FORCE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_library(bspConfiguration src/bsp/stdIo/stdIo.cpp
src/bsp/uart/UartConfig.cpp)

target_include_directories(bspConfiguration PUBLIC include)

target_link_libraries(
bspConfiguration
PUBLIC bspUart
PRIVATE bspMcu platform)
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
..
*******************************************************************************
Copyright (c) 2026 An Dao

This program and the accompanying materials are made available under the
terms of the Apache License Version 2.0 which is available at
https://www.apache.org/licenses/LICENSE-2.0

SPDX-License-Identifier: Apache-2.0
*******************************************************************************

.. _bspconfig_nucleo_f413zh:

bspConfiguration - NUCLEO-F413ZH
================================

Overview
--------

The ``bspConfiguration`` module contains hardware-specific configuration for the
NUCLEO-F413ZH evaluation board. Driver logic is separated from its configuration
so that users can customise a project for different boards or pin assignments
without modifying driver source code.

The STM32F413ZH platform exposes a minimal set of BSP peripherals required for
the CAN reference application:

- **bspUart** - USART3 configuration (ST-LINK Virtual COM Port on PD8/PD9).
- **bspStdIo** - Standard I/O bridge that routes ``putByteToStdout`` /
``getByteFromStdin`` through the configured UART instance.

.. note::

Unlike the S32K148EVB reference application, this platform does not include
ADC, PWM, or digital I/O configuration modules because the CAN reference
application does not require analogue inputs or GPIO-driven outputs.
These modules can be added following the same configuration pattern if
a future application requires them.

Hardware Summary
++++++++++++++++

.. csv-table::
:widths: 30, 70
:width: 100%

"MCU", "STM32F413ZH (Arm Cortex-M4F, 96 MHz, single-precision FPU)"
"UART peripheral", "USART3 - routed to ST-LINK/V2-1 Virtual COM Port"
"UART TX pin", "PD8 (AF7)"
"UART RX pin", "PD9 (AF7)"
"UART baud rate", "115 200 baud (BRR = 417 at 48 MHz APB1)"
"CAN peripheral", "CAN1 (bxCAN, configured in CanSystem, not bspConfiguration)"

.. toctree::
:hidden:

user/index
Loading
Loading