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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ namespace docan
{

DoCanSystem::AddressingFilterType::AddressEntryType DoCanSystem::_addresses[]
= {{0x02A, 0x0F0U, 0x0F0U, LOGICAL_ADDRESS, 0, 0}};
#ifdef PLATFORM_SUPPORT_OBD_UDS_ADDRESSING
= {{0x7E0U, 0x7E8U, 0x7E8U, LOGICAL_ADDRESS, 0, 0}};
#else
= {{0x02AU, 0x0F0U, 0x0F0U, LOGICAL_ADDRESS, 0, 0}};
#endif

DoCanSystem::DoCanSystem(
::transport::ITransportSystem& transportSystem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
#include <async/TaskInitializer.h>

#ifdef PLATFORM_SUPPORT_TRANSPORT
#ifdef PLATFORM_SUPPORT_OBD_UDS_ADDRESSING
static constexpr uint16_t LOGICAL_ADDRESS = 0x0600U;
#else
static constexpr uint16_t LOGICAL_ADDRESS = 0x002AU;
#endif
#endif // PLATFORM_SUPPORT_TRANSPORT

#define safety_task_stackSize 2048U
Expand Down
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 ()
55 changes: 55 additions & 0 deletions executables/referenceApp/platforms/nucleo_f413zh/Options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# *******************************************************************************
# 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_OBD_UDS_ADDRESSING
ON
CACHE BOOL "" FORCE)
set(PLATFORM_SUPPORT_PROGRAMMING_SESSION
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)
Loading
Loading