forked from eclipse-openbsw/openbsw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a safeWatchdog for the S32K1 platform * Add safeMemory * Add safeMonitor * Add safeLifecycle (SafeSupervisor, safety logger) Add a demo SafetySystem to the lifecycle configuration, which uses these modules. Change-Id: I191dd1400b70e3216e70135a97c3224bd12036df
- Loading branch information
1 parent
fda81b1
commit 62ee06f
Showing
66 changed files
with
3,251 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
executables/referenceApp/application/include/systems/SafetySystem.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 Accenture. | ||
|
||
#include <console/AsyncCommandWrapper.h> | ||
#include <lifecycle/AsyncLifecycleComponent.h> | ||
#include <lifecycle/console/LifecycleControlCommand.h> | ||
|
||
namespace systems | ||
{ | ||
class SafetySystem | ||
: public ::lifecycle::AsyncLifecycleComponent | ||
, private ::async::IRunnable | ||
{ | ||
public: | ||
explicit SafetySystem( | ||
::async::ContextType context, ::lifecycle::ILifecycleManager& lifecycleManager); | ||
SafetySystem(SafetySystem const&) = delete; | ||
SafetySystem& operator=(SafetySystem const&) = delete; | ||
|
||
void init() override; | ||
void run() override; | ||
void shutdown() override; | ||
void cyclic(); | ||
|
||
private: | ||
void execute() override; | ||
|
||
private: | ||
::async::ContextType const _context; | ||
::async::TimeoutType _timeout; | ||
|
||
::lifecycle::LifecycleControlCommand _lifecycleControlCommand; | ||
::console::AsyncCommandWrapper _asyncCommandWrapperForLifecycleControlCommand; | ||
}; | ||
|
||
} // namespace systems |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
executables/referenceApp/application/src/systems/SafetySystem.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2024 Accenture. | ||
|
||
#include "systems/SafetySystem.h" | ||
|
||
#include <safeLifecycle/SafetyLogger.h> | ||
#include <safeLifecycle/SafetyManager.h> | ||
|
||
::safety::SafetyManager safetyManager; | ||
|
||
namespace | ||
{ | ||
constexpr uint32_t SYSTEM_CYCLE_TIME = 10; | ||
} | ||
|
||
namespace systems | ||
{ | ||
using ::util::logger::Logger; | ||
using ::util::logger::SAFETY; | ||
|
||
SafetySystem::SafetySystem( | ||
::async::ContextType const context, ::lifecycle::ILifecycleManager& lifecycleManager) | ||
: _context(context) | ||
, _timeout() | ||
, _lifecycleControlCommand(lifecycleManager) | ||
, _asyncCommandWrapperForLifecycleControlCommand(_lifecycleControlCommand, context) | ||
{ | ||
setTransitionContext(context); | ||
} | ||
|
||
void SafetySystem::init() | ||
{ | ||
safetyManager.init(); | ||
transitionDone(); | ||
} | ||
|
||
void SafetySystem::run() | ||
{ | ||
::async::scheduleAtFixedRate( | ||
_context, *this, _timeout, SYSTEM_CYCLE_TIME, ::async::TimeUnit::MILLISECONDS); | ||
|
||
transitionDone(); | ||
} | ||
|
||
void SafetySystem::shutdown() | ||
{ | ||
_timeout.cancel(); | ||
|
||
transitionDone(); | ||
} | ||
|
||
void SafetySystem::execute() { cyclic(); } | ||
|
||
void SafetySystem::cyclic() { safetyManager.cyclic(); } | ||
|
||
} // namespace systems |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
add_subdirectory(safety) | ||
add_subdirectory(bsw) | ||
add_subdirectory(bsp) | ||
add_subdirectory(3rdparty) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
option(PLATFORM_SUPPORT_WATCHDOG "Turn WATCHDOG support on or off" OFF) | ||
option(PLATFORM_SUPPORT_MPU "Turn MPU support on or off" OFF) | ||
|
||
if (BUILD_TARGET_PLATFORM STREQUAL "S32K148EVB") | ||
set(PLATFORM_SUPPORT_WATCHDOG | ||
ON | ||
CACHE BOOL "Turn ON Watchdog support" FORCE) | ||
set(PLATFORM_SUPPORT_MPU | ||
ON | ||
CACHE BOOL "Turn ON MPU support" FORCE) | ||
else () | ||
set(PLATFORM_SUPPORT_WATCHDOG | ||
OFF | ||
CACHE BOOL "Turn OFF Watchdog support" FORCE) | ||
set(PLATFORM_SUPPORT_MPU | ||
OFF | ||
CACHE BOOL "Turn OFF MPU support" FORCE) | ||
endif () | ||
|
||
if (PLATFORM_SUPPORT_WATCHDOG) | ||
add_compile_definitions(PLATFORM_SUPPORT_WATCHDOG=1) | ||
endif () | ||
if (PLATFORM_SUPPORT_MPU) | ||
add_compile_definitions(PLATFORM_SUPPORT_MPU=1) | ||
endif () | ||
|
||
add_subdirectory(safeLifecycle EXCLUDE_FROM_ALL) | ||
add_subdirectory(safeMemory EXCLUDE_FROM_ALL) | ||
add_subdirectory(safeMonitor EXCLUDE_FROM_ALL) | ||
add_subdirectory(safeWatchdog EXCLUDE_FROM_ALL) | ||
add_subdirectory(watchdogManager EXCLUDE_FROM_ALL) | ||
|
||
if (BUILD_UNIT_TESTS) | ||
add_subdirectory(safeLifecycle/test/gtest) | ||
add_subdirectory(safeMonitor/test) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
add_library(safeLifecycle src/safeLifecycle/SafetyManager.cpp | ||
src/safeLifecycle/SafeSupervisor.cpp) | ||
|
||
target_include_directories(safeLifecycle PUBLIC include) | ||
|
||
target_link_libraries( | ||
safeLifecycle | ||
PUBLIC safeMonitor | ||
safeWatchdog | ||
platform | ||
util | ||
safeMemory) | ||
|
||
if (BUILD_UNIT_TESTS) | ||
|
||
target_compile_definitions(safeLifecycle PUBLIC ESTD_HAS_EXCEPTIONS | ||
ESTL_ASSERT_MESSAGE_ALL) | ||
|
||
endif () |
Oops, something went wrong.