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
11 changes: 11 additions & 0 deletions executables/referenceApp/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ if (PLATFORM_SUPPORT_TRANSPORT)
if (PLATFORM_SUPPORT_UDS)
target_sources(app.referenceApp PRIVATE src/systems/UdsSystem.cpp
src/uds/ReadIdentifierPot.cpp)
if (PLATFORM_SUPPORT_UDS_DEMO_SERVICES)
target_sources(
app.referenceApp
PRIVATE src/uds/Stm32ClearDtc.cpp
src/uds/Stm32ControlDtcSetting.cpp
src/uds/Stm32DemoRoutine.cpp
src/uds/Stm32DtcManager.cpp
src/uds/Stm32ReadDtcInfo.cpp
src/uds/Stm32SecurityAccess.cpp
src/uds/Stm32WriteVin.cpp)
endif ()
endif ()
endif ()

Expand Down
35 changes: 35 additions & 0 deletions executables/referenceApp/application/include/systems/UdsSystem.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/********************************************************************************
* Copyright (c) 2024 Accenture
* 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
Expand All @@ -22,6 +23,19 @@
#include <uds/async/AsyncDiagJob.h>
#include <uds/jobs/ReadIdentifierFromMemory.h>
#include <uds/jobs/WriteIdentifierToMemory.h>

#ifdef PLATFORM_SUPPORT_UDS_DEMO_SERVICES
#include <uds/Stm32ClearDtc.h>
#include <uds/Stm32ControlDtcSetting.h>
#include <uds/Stm32DemoRoutine.h>
#include <uds/Stm32DtcManager.h>
#include <uds/Stm32ReadDtcInfo.h>
#include <uds/Stm32SecurityAccess.h>
#include <uds/Stm32WriteVin.h>
#include <uds/services/ecureset/ECUReset.h>
#include <uds/services/ecureset/HardReset.h>
#endif

#include <uds/services/communicationcontrol/CommunicationControl.h>
#include <uds/services/readdata/ReadDataByIdentifier.h>
#include <uds/services/routinecontrol/RequestRoutineResults.h>
Expand Down Expand Up @@ -101,7 +115,28 @@ class UdsSystem
ReadIdentifierFromMemory _read22Cf01;
ReadIdentifierPot _read22Cf02;
WriteIdentifierToMemory _write2eCf03;
#ifdef PLATFORM_SUPPORT_UDS_DEMO_SERVICES
ReadIdentifierFromMemory _readF190;
Stm32WriteVin _writeF190;
ReadIdentifierFromMemory _readF195;
ReadIdentifierFromMemory _readF18C;
ReadIdentifierFromMemory _readF193;
ReadIdentifierFromMemory _readF18A;
ReadIdentifierFromMemory _readF180;
#endif
TesterPresent _testerPresent;
#ifdef PLATFORM_SUPPORT_UDS_DEMO_SERVICES
ECUReset _ecuReset;
HardReset _hardReset;
Stm32SecurityAccess _securityAccess;
Stm32DtcManager _dtcManager;
Stm32ClearDtc _clearDtc;
Stm32ReadDtcInfo _readDtcInfo;
Stm32ControlDtcSetting _controlDtcSetting;
Stm32DemoRoutine _routineFF00;
Stm32DemoRoutine _routineFF01;
Stm32DemoRoutine _routineFF02;
#endif

::async::ContextType _context;
::async::TimeoutType _timeout;
Expand Down
36 changes: 36 additions & 0 deletions executables/referenceApp/application/include/uds/Stm32ClearDtc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/********************************************************************************
* 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
********************************************************************************/

#pragma once

#include "uds/Stm32DtcManager.h"
#include "uds/base/Service.h"

namespace uds
{
/**
* ClearDiagnosticInformation (SID 0x14).
* Accepts 3-byte group-of-DTC. 0xFFFFFF = clear all.
*/
class Stm32ClearDtc : public Service
{
public:
explicit Stm32ClearDtc(Stm32DtcManager& dtcManager);

private:
DiagReturnCode::Type process(
IncomingDiagConnection& connection,
uint8_t const request[],
uint16_t requestLength) override;

Stm32DtcManager& _dtcManager;
};

} // namespace uds
Loading
Loading