Merge remote-tracking branch 'upstream/development' into mueller/cfdp-pdus
This commit is contained in:
commit
751de7accc
7
.clang-format
Normal file
7
.clang-format
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 2
|
||||
---
|
||||
Language: Cpp
|
||||
ColumnLimit: 100
|
||||
---
|
@ -56,7 +56,7 @@ if(FSFW_BUILD_UNITTESTS)
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.0.0-preview3
|
||||
GIT_TAG v3.0.0-preview4
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
@ -90,7 +90,7 @@ set(FSFW_CORE_INC_PATH "inc")
|
||||
|
||||
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos)
|
||||
|
||||
# Configure Files
|
||||
# For configure files
|
||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
@ -152,13 +152,8 @@ else()
|
||||
set(OS_FSFW "host")
|
||||
endif()
|
||||
|
||||
if(FSFW_BUILD_UNITTESTS OR FSFW_BUILD_DOCS)
|
||||
configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h)
|
||||
configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h)
|
||||
else()
|
||||
configure_file(src/fsfw/FSFW.h.in FSFW.h)
|
||||
configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h)
|
||||
endif()
|
||||
configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h)
|
||||
configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h)
|
||||
|
||||
message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.")
|
||||
|
||||
|
@ -107,6 +107,12 @@ cmake --build . -- fsfw-tests_coverage -j
|
||||
|
||||
The `coverage.py` script located in the `script` folder can also be used to do this conveniently.
|
||||
|
||||
## Formatting the sources
|
||||
|
||||
The formatting is done by the `clang-format` tool. The configuration is contained within the
|
||||
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
|
||||
can run the `apply-clang-format.sh` helper script to format all source files consistently.
|
||||
|
||||
## Index
|
||||
|
||||
[1. High-level overview](docs/README-highlevel.md#top) <br>
|
||||
|
@ -6,3 +6,9 @@ RUN apt-get --yes upgrade
|
||||
#tzdata is a dependency, won't install otherwise
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano
|
||||
|
||||
RUN git clone https://github.com/catchorg/Catch2.git && \
|
||||
cd Catch2 && \
|
||||
git checkout v3.0.0-preview4 && \
|
||||
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
|
||||
cmake --build build/ --target install
|
||||
|
43
automation/Jenkinsfile
vendored
43
automation/Jenkinsfile
vendored
@ -1,28 +1,23 @@
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
BUILDDIR = 'build-tests'
|
||||
}
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
//force docker to redownload base image and rebuild all steps instead of caching them
|
||||
//this way, we always get an up to date docker image one each build
|
||||
additionalBuildArgs '--no-cache --pull'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Create Docker') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
additionalBuildArgs '--no-cache'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
stage('Clean') {
|
||||
steps {
|
||||
sh 'rm -rf $BUILDDIR'
|
||||
}
|
||||
}
|
||||
stage('Configure') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..'
|
||||
@ -30,12 +25,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake --build . -j'
|
||||
@ -43,12 +32,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Unittests') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake --build . -- fsfw-tests_coverage -j'
|
||||
@ -56,12 +39,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Valgrind') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests'
|
||||
|
1
docs/.gitignore
vendored
Normal file
1
docs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/_build
|
8
scripts/apply-clang-format.sh
Executable file
8
scripts/apply-clang-format.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
if [[ ! -f README.md ]]; then
|
||||
cd ..
|
||||
fi
|
||||
|
||||
find ./src -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||
find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
||||
find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
@ -7,12 +7,3 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
||||
)
|
||||
|
||||
add_subdirectory(fsfw)
|
||||
|
||||
# Configure File
|
||||
|
||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define TIMEVALOPERATIONS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <fsfw/platform.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef PLATFORM_WIN
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
|
@ -1,15 +1,12 @@
|
||||
#include "TestController.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
TestController::TestController(object_id_t objectId, object_id_t device0, object_id_t device1,
|
||||
TestController::TestController(object_id_t objectId, object_id_t parentId,
|
||||
size_t commandQueueDepth):
|
||||
ExtendedControllerBase(objectId, objects::NO_OBJECT, commandQueueDepth),
|
||||
deviceDataset0(device0),
|
||||
deviceDataset1(device1) {
|
||||
ExtendedControllerBase(objectId, parentId, commandQueueDepth) {
|
||||
}
|
||||
|
||||
TestController::~TestController() {
|
||||
@ -20,136 +17,15 @@ ReturnValue_t TestController::handleCommandMessage(CommandMessage *message) {
|
||||
}
|
||||
|
||||
void TestController::performControlOperation() {
|
||||
/* We will trace vaiables if we received an update notification or snapshots */
|
||||
#if OBSW_CONTROLLER_PRINTOUT == 1
|
||||
if(not traceVariable) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(currentTraceType) {
|
||||
case(NONE): {
|
||||
break;
|
||||
}
|
||||
case(TRACE_DEV_0_UINT8): {
|
||||
if(traceCounter == 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Tracing finished" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Tracing finished\n");
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
traceVariable = false;
|
||||
traceCounter = traceCycles;
|
||||
currentTraceType = TraceTypes::NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
PoolReadGuard readHelper(&deviceDataset0.testUint8Var);
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Tracing device 0 variable 0 (UINT8), current value: " <<
|
||||
static_cast<int>(deviceDataset0.testUint8Var.value) << std::endl;
|
||||
#else
|
||||
sif::printInfo("Tracing device 0 variable 0 (UINT8), current value: %d\n",
|
||||
deviceDataset0.testUint8Var.value);
|
||||
#endif
|
||||
traceCounter--;
|
||||
break;
|
||||
}
|
||||
case(TRACE_DEV_0_VECTOR): {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */
|
||||
}
|
||||
|
||||
void TestController::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
|
||||
using namespace std;
|
||||
|
||||
#if OBSW_CONTROLLER_PRINTOUT == 1
|
||||
char const* printout = nullptr;
|
||||
if(storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
printout = "Notification";
|
||||
}
|
||||
else {
|
||||
printout = "Snapshot";
|
||||
}
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "TestController::handleChangedDataset: " << printout << " update from object "
|
||||
"ID " << setw(8) << setfill('0') << hex << sid.objectId <<
|
||||
" and set ID " << sid.ownerSetId << dec << setfill(' ') << endl;
|
||||
#else
|
||||
sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and "
|
||||
"set ID %lu\n", printout, sid.objectId, sid.ownerSetId);
|
||||
#endif
|
||||
|
||||
if (storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
if(sid.objectId == objects::TEST_DEVICE_HANDLER_0) {
|
||||
PoolReadGuard readHelper(&deviceDataset0.testFloat3Vec);
|
||||
float floatVec[3];
|
||||
floatVec[0] = deviceDataset0.testFloat3Vec.value[0];
|
||||
floatVec[1] = deviceDataset0.testFloat3Vec.value[1];
|
||||
floatVec[2] = deviceDataset0.testFloat3Vec.value[2];
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Current float vector (3) values: [" << floatVec[0] << ", " <<
|
||||
floatVec[1] << ", " << floatVec[2] << "]" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Current float vector (3) values: [%f, %f, %f]\n",
|
||||
floatVec[0], floatVec[1], floatVec[2]);
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
}
|
||||
}
|
||||
#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */
|
||||
|
||||
/* We will trace the variables for snapshots and update notifications */
|
||||
if(not traceVariable) {
|
||||
traceVariable = true;
|
||||
traceCounter = traceCycles;
|
||||
currentTraceType = TraceTypes::TRACE_DEV_0_VECTOR;
|
||||
}
|
||||
}
|
||||
|
||||
void TestController::handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
|
||||
bool* clearMessage) {
|
||||
using namespace std;
|
||||
|
||||
#if OBSW_CONTROLLER_PRINTOUT == 1
|
||||
char const* printout = nullptr;
|
||||
if (storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
printout = "Notification";
|
||||
}
|
||||
else {
|
||||
printout = "Snapshot";
|
||||
}
|
||||
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "TestController::handleChangedPoolVariable: " << printout << " update from object "
|
||||
"ID 0x" << setw(8) << setfill('0') << hex << globPoolId.objectId <<
|
||||
" and local pool ID " << globPoolId.localPoolId << dec << setfill(' ') << endl;
|
||||
#else
|
||||
sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and "
|
||||
"local pool ID %lu\n", printout, globPoolId.objectId, globPoolId.localPoolId);
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
|
||||
if (storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
if(globPoolId.objectId == objects::TEST_DEVICE_HANDLER_0) {
|
||||
PoolReadGuard readHelper(&deviceDataset0.testUint8Var);
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Current test variable 0 (UINT8) value: " << static_cast<int>(
|
||||
deviceDataset0.testUint8Var.value) << std::endl;
|
||||
#else
|
||||
sif::printInfo("Current test variable 0 (UINT8) value %d\n",
|
||||
deviceDataset0.testUint8Var.value);
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
}
|
||||
}
|
||||
#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */
|
||||
|
||||
/* We will trace the variables for snapshots and update notifications */
|
||||
if(not traceVariable) {
|
||||
traceVariable = true;
|
||||
traceCounter = traceCycles;
|
||||
currentTraceType = TraceTypes::TRACE_DEV_0_UINT8;
|
||||
}
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* TestController::getDataSetHandle(sid_t sid) {
|
||||
@ -162,50 +38,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local
|
||||
}
|
||||
|
||||
ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||
namespace td = testdevice;
|
||||
HasLocalDataPoolIF* device0 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
deviceDataset0.getCreatorObjectId());
|
||||
if(device0 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 "
|
||||
"handle invalid!" << std::endl;
|
||||
#else
|
||||
sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 0 "
|
||||
"handle invalid!");
|
||||
#endif
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
ProvidesDataPoolSubscriptionIF* subscriptionIF = device0->getSubscriptionInterface();
|
||||
if(subscriptionIF != nullptr) {
|
||||
/* For DEVICE_0, we only subscribe for notifications */
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(),
|
||||
getCommandQueue(), false);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID,
|
||||
getObjectId(), getCommandQueue(), false);
|
||||
}
|
||||
|
||||
|
||||
HasLocalDataPoolIF* device1 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
deviceDataset0.getCreatorObjectId());
|
||||
if(device1 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 "
|
||||
"handle invalid!" << std::endl;
|
||||
#else
|
||||
sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 1 "
|
||||
"handle invalid!");
|
||||
#endif
|
||||
}
|
||||
|
||||
subscriptionIF = device1->getSubscriptionInterface();
|
||||
if(subscriptionIF != nullptr) {
|
||||
/* For DEVICE_1, we will subscribe for snapshots */
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(),
|
||||
getCommandQueue(), true);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID,
|
||||
getObjectId(), getCommandQueue(), true);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return ExtendedControllerBase::initializeAfterTaskCreation();
|
||||
}
|
||||
|
||||
ReturnValue_t TestController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
|
@ -8,20 +8,18 @@
|
||||
class TestController:
|
||||
public ExtendedControllerBase {
|
||||
public:
|
||||
TestController(object_id_t objectId, object_id_t device0, object_id_t device1,
|
||||
size_t commandQueueDepth = 10);
|
||||
TestController(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 10);
|
||||
virtual~ TestController();
|
||||
protected:
|
||||
testdevice::TestDataSet deviceDataset0;
|
||||
testdevice::TestDataSet deviceDataset1;
|
||||
|
||||
/* Extended Controller Base overrides */
|
||||
// Extended Controller Base overrides
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
void performControlOperation() override;
|
||||
|
||||
/* HasLocalDatapoolIF callbacks */
|
||||
void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override;
|
||||
void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
|
||||
// HasLocalDatapoolIF callbacks
|
||||
virtual void handleChangedDataset(sid_t sid, store_address_t storeId,
|
||||
bool* clearMessage) override;
|
||||
virtual void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
|
||||
bool* clearMessage) override;
|
||||
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
@ -34,17 +32,6 @@ protected:
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
|
||||
private:
|
||||
|
||||
bool traceVariable = false;
|
||||
uint8_t traceCycles = 5;
|
||||
uint8_t traceCounter = traceCycles;
|
||||
|
||||
enum TraceTypes {
|
||||
NONE,
|
||||
TRACE_DEV_0_UINT8,
|
||||
TRACE_DEV_0_VECTOR
|
||||
};
|
||||
TraceTypes currentTraceType = TraceTypes::NONE;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user