Merge pull request 'watchdog updates' (#144) from mueller/watchdog-tweaks into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #144
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Jakob Meier 2022-02-22 18:16:12 +01:00
commit b9e8346e82
5 changed files with 29 additions and 19 deletions

View File

@ -174,7 +174,7 @@ To build the EIVE watchdog, the corresponding target must be specified in the bu
The configure steps do not need to be repeated if the folder has already been configured.
```sh
mkdir build-Debug-Q7S && cd build-Debug-Q7S
mkdir build-Debug-Watchdog && cd build-Debug-Watchdog
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --target eive-watchdog -j
```

View File

@ -1177,7 +1177,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.138952870" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.69065720" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1773865512" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder arguments="--build . -j" buildPath="${workspace_loc:/eive-obsw/build-Watchdog}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.890124449" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<builder arguments="--build . --target eive-watchdog -j" buildPath="${workspace_loc:/eive-obsw/build-Debug-Watchdog}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.890124449" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.964799144" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.295289472" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.111941431" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
@ -1343,7 +1343,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1135900144" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.2092395820" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.381962613" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder arguments="--build . -j" buildPath="${workspace_loc:/eive-obsw/build-Release-Watchdog}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1784164529" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<builder arguments="--build . --target eive-watchdog -j" buildPath="${workspace_loc:/eive-obsw/build-Release-Watchdog}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1784164529" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.926630835" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.243911424" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.473023042" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
@ -1496,10 +1496,10 @@
<configuration configurationName="q7s-watchdog-release">
<resource resourceType="PROJECT" workspacePath="/eive-obsw"/>
</configuration>
<configuration configurationName="eive-rpi-release-win"/>
<configuration configurationName="eive-fsfw-unittest">
<resource resourceType="PROJECT" workspacePath="/eive-obsw"/>
</configuration>
<configuration configurationName="eive-rpi-release-win"/>
<configuration configurationName="q7s-watchdog-debug"/>
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>

View File

@ -2,3 +2,7 @@ target_sources(${WATCHDOG_NAME} PRIVATE
main.cpp
Watchdog.cpp
)
target_include_directories(${WATCHDOG_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

19
watchdog/definitions.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef WATCHDOG_DEFINITIONS_H_
#define WATCHDOG_DEFINITIONS_H_
namespace watchdog {
// Suspend watchdog operations temporarily
static constexpr char SUSPEND_CHAR = 's';
// Resume watchdog operations
static constexpr char RESTART_CHAR = 'b';
// Causes the watchdog to close down
static constexpr char CANCEL_CHAR = 'c';
static constexpr int TIMEOUT_MS = 5 * 1000;
const std::string FIFO_NAME = "/tmp/watchdog-pipe";
const std::string RUNNING_FILE_NAME = "/tmp/obsw-running";
}
#endif /* WATCHDOG_DEFINITIONS_H_ */

View File

@ -1,24 +1,11 @@
#include <cstdint>
#include <string>
#include "watchdog/definitions.h"
#define WATCHDOG_VERBOSE_LEVEL 1
/**
* This flag instructs the watchdog to create a special file in /tmp if the OBSW is running
* or to delete it if it is not running
*/
#define WATCHDOG_CREATE_FILE_IF_RUNNING 1
namespace watchdog {
static constexpr int TIMEOUT_MS = 5 * 1000;
const std::string FIFO_NAME = "/tmp/watchdog-pipe";
const std::string RUNNING_FILE_NAME = "/tmp/obsw-running";
// Suspend watchdog operations temporarily
static constexpr char SUSPEND_CHAR = 's';
// Resume watchdog operations
static constexpr char RESTART_CHAR = 'b';
// Causes the watchdog to close down
static constexpr char CANCEL_CHAR = 'c';
}