From eb6a8519358270a8560bc6d77a55a4f08854dc7c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jan 2021 12:02:23 +0100 Subject: [PATCH 1/8] pool entry update --- datapool/PoolEntry.cpp | 42 ++++++++++++++++------------- datapool/PoolEntry.h | 61 +++++++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/datapool/PoolEntry.cpp b/datapool/PoolEntry.cpp index 58375162..a5867222 100644 --- a/datapool/PoolEntry.cpp +++ b/datapool/PoolEntry.cpp @@ -1,32 +1,24 @@ #include "PoolEntry.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../globalfunctions/arrayprinter.h" #include #include template -PoolEntry::PoolEntry(std::initializer_list initValue, uint8_t setLength, - bool setValid ) : length(setLength), valid(setValid) { +PoolEntry::PoolEntry(std::initializer_list initValue, bool setValid ): + length(initValue.size()), valid(setValid) { this->address = new T[this->length]; if(initValue.size() == 0) { std::memset(this->address, 0, this->getByteSize()); } - else if (initValue.size() != setLength){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "PoolEntry: setLength is not equal to initializer list" - "length! Performing zero initialization with given setLength" - << std::endl; -#endif - std::memset(this->address, 0, this->getByteSize()); - } else { std::copy(initValue.begin(), initValue.end(), this->address); } } template -PoolEntry::PoolEntry( T* initValue, uint8_t setLength, bool setValid ) : +PoolEntry::PoolEntry(T* initValue, uint8_t setLength, bool setValid): length(setLength), valid(setValid) { this->address = new T[this->length]; if (initValue != nullptr) { @@ -70,14 +62,26 @@ bool PoolEntry::getValid() { template void PoolEntry::print() { + const char* validString = nullptr; + if(valid) { + validString = "Valid"; + } + else { + validString = "Invalid"; + } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Pool Entry Validity: " << - (this->valid? " (valid) " : " (invalid) ") << std::endl; -#endif - arrayprinter::print(reinterpret_cast(address), length); -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << std::dec << std::endl; + sif::info << "PoolEntry information." << std::endl; + sif::info << "PoolEntry validity: " << validString << std::endl; +#else + sif::printInfo("PoolEntry information.\n"); + sif::printInfo("PoolEntry validity: %s\n", validString); #endif + arrayprinter::print(reinterpret_cast(address), getByteSize()); +} + +template +inline T* PoolEntry::getDataPtr() { + return this->address; } template @@ -88,8 +92,10 @@ Type PoolEntry::getType() { template class PoolEntry; template class PoolEntry; template class PoolEntry; +template class PoolEntry; template class PoolEntry; template class PoolEntry; template class PoolEntry; +template class PoolEntry; template class PoolEntry; template class PoolEntry; diff --git a/datapool/PoolEntry.h b/datapool/PoolEntry.h index 033db40d..30940320 100644 --- a/datapool/PoolEntry.h +++ b/datapool/PoolEntry.h @@ -35,24 +35,22 @@ public: "uint8_t"); /** * @brief In the classe's constructor, space is allocated on the heap and - * potential init values are copied to that space. + * potential initialization values are copied to that space. * @details * Not passing any arguments will initialize an non-array pool entry - * (setLength = 1) with an initial invalid state. - * Please note that if an initializer list is passed, the correct - * corresponding length should be passed too, otherwise a zero - * initialization will be performed with the given setLength. + * with an initial invalid state and the value 0. + * Please note that if an initializer list is passed, the length of the + * initializer list needs to be correct for vector entries because + * required allocated space will be deduced from the initializer list length + * and the pool entry type. * @param initValue - * Initializer list with values to initialize with, for example {0,0} to - * initialize the two entries to zero. - * @param setLength - * Defines the array length of this entry. Should be equal to the - * intializer list length. + * Initializer list with values to initialize with, for example {0, 0} to + * initialize the a pool entry of a vector with two entries to 0. * @param setValid * Sets the initialization flag. It is invalid by default. */ - PoolEntry(std::initializer_list initValue = {}, uint8_t setLength = 1, - bool setValid = false); + PoolEntry(std::initializer_list initValue = {0}, bool setValid = false); + /** * @brief In the classe's constructor, space is allocated on the heap and * potential init values are copied to that space. @@ -66,9 +64,9 @@ public: */ PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); - //! Explicitely deleted copy ctor, copying is not allowed! + //! Explicitely deleted copy ctor, copying is not allowed. PoolEntry(const PoolEntry&) = delete; - //! Explicitely deleted copy assignment, copying is not allowed! + //! Explicitely deleted copy assignment, copying is not allowed. PoolEntry& operator=(const PoolEntry&) = delete; /** @@ -82,21 +80,16 @@ public: ~PoolEntry(); /** - * @brief This is the address pointing to the allocated memory. + * Return typed pointer to start of data. + * @return */ - T* address; - /** - * @brief This attribute stores the length information. - */ - uint8_t length; - /** - * @brief Here, the validity information for a variable is stored. - * Every entry (single variable or vector) has one valid flag. - */ - uint8_t valid; + T* getDataPtr(); + /** * @brief getSize returns the array size of the entry. - * @details A single parameter has size 1. + * @details + * For non-array pool entries return type size, for vector entries + * return type size times the number of entries. */ uint8_t getSize(); /** @@ -123,8 +116,22 @@ public: * information to the screen. It prints all array entries in a row. */ void print(); - Type getType(); + +private: + /** + * @brief This attribute stores the length information. + */ + uint8_t length; + /** + * @brief Here, the validity information for a variable is stored. + * Every entry (single variable or vector) has one valid flag. + */ + uint8_t valid; + /** + * @brief This is the address pointing to the allocated memory. + */ + T* address; }; #endif /* FSFW_DATAPOOL_POOLENTRY_H_ */ From cd3f19d0e4857e18fc5a9ae84fa199bd0a22e42c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jan 2021 12:56:55 +0100 Subject: [PATCH 2/8] updated defaultcfg --- defaultcfg/fsfwconfig/FSFWConfig.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index 261e3d6d..ed86e6e1 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -9,18 +9,14 @@ //! the C stdio functions can be used alternatively #define FSFW_CPP_OSTREAM_ENABLED 1 -//! More FSFW related printouts. -//! Be careful, this also turns off most diagnostic prinouts! -#define FSFW_ENHANCED_PRINTOUT 0 +//! More FSFW related printouts depending on level. Useful for development. +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. -#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 #define FSFW_DISABLE_PRINTOUT 0 #endif -//! Can be used to enable additional debugging printouts for developing the FSFW -#define FSFW_PRINT_VERBOSITY_LEVEL 0 - //! Can be used to disable the ANSI color sequences for C stdio. #define FSFW_COLORED_OUTPUT 1 From 6b1c7084ac3bc6478562cfa5323b3e9c687689f7 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 14 Jan 2021 11:29:38 +0100 Subject: [PATCH 3/8] added srv3 --- pus/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pus/CMakeLists.txt b/pus/CMakeLists.txt index 758c2629..c0e00448 100644 --- a/pus/CMakeLists.txt +++ b/pus/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources(${LIB_FSFW_NAME} Service17Test.cpp Service1TelecommandVerification.cpp Service2DeviceAccess.cpp + Service3Housekeeping.cpp Service5EventReporting.cpp Service8FunctionManagement.cpp Service9TimeManagement.cpp From 113b4b5ffaa32bbd6b6ec94bab6763112bd3d764 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jan 2021 19:44:25 +0100 Subject: [PATCH 4/8] important bugfix --- action/ActionMessage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action/ActionMessage.cpp b/action/ActionMessage.cpp index b0bcabaa..4e56feea 100644 --- a/action/ActionMessage.cpp +++ b/action/ActionMessage.cpp @@ -1,3 +1,4 @@ +#include #include "ActionMessage.h" #include "../objectmanager/ObjectManagerIF.h" #include "../storagemanager/StorageManagerIF.h" @@ -53,7 +54,7 @@ void ActionMessage::setDataReply(CommandMessage* message, ActionId_t actionId, void ActionMessage::setCompletionReply(CommandMessage* message, ActionId_t fid, ReturnValue_t result) { - if (result == HasReturnvaluesIF::RETURN_OK) { + if (result == HasReturnvaluesIF::RETURN_OK or result == HasActionsIF::EXECUTION_FINISHED) { message->setCommand(COMPLETION_SUCCESS); } else { message->setCommand(COMPLETION_FAILED); From d4b08459f4e27441181d068dcbeb903eec325578 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jan 2021 19:49:15 +0100 Subject: [PATCH 5/8] smaller changes and documentation --- action/ActionMessage.cpp | 3 ++- action/ActionMessage.h | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/action/ActionMessage.cpp b/action/ActionMessage.cpp index 4e56feea..1c00dee0 100644 --- a/action/ActionMessage.cpp +++ b/action/ActionMessage.cpp @@ -1,5 +1,6 @@ -#include #include "ActionMessage.h" +#include "HasActionsIF.h" + #include "../objectmanager/ObjectManagerIF.h" #include "../storagemanager/StorageManagerIF.h" diff --git a/action/ActionMessage.h b/action/ActionMessage.h index 7a859de0..be7116d7 100644 --- a/action/ActionMessage.h +++ b/action/ActionMessage.h @@ -4,8 +4,15 @@ #include "../ipc/CommandMessage.h" #include "../objectmanager/ObjectManagerIF.h" #include "../storagemanager/StorageManagerIF.h" -typedef uint32_t ActionId_t; +using ActionId_t = uint32_t; + +/** + * @brief These messages are part of the action module of the FSFW. + * @details + * These messages are sent amongst objects implementing the HasActionsIF. The ActionHelper + * class is able to process these messages. + */ class ActionMessage { private: ActionMessage(); From 87fbb5ce756e77fb3f82b134b1705f79547b9fdc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jan 2021 19:49:59 +0100 Subject: [PATCH 6/8] imrpoved doc --- action/ActionMessage.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action/ActionMessage.h b/action/ActionMessage.h index be7116d7..deb11095 100644 --- a/action/ActionMessage.h +++ b/action/ActionMessage.h @@ -10,8 +10,8 @@ using ActionId_t = uint32_t; /** * @brief These messages are part of the action module of the FSFW. * @details - * These messages are sent amongst objects implementing the HasActionsIF. The ActionHelper - * class is able to process these messages. + * These messages are sent amongst objects implementing the HasActionsIF. Classes like the + * ActionHelper are able to process these messages. */ class ActionMessage { private: From ffb6208b24278a10612f17180d142ac58aa5aab1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Jan 2021 16:13:10 +0100 Subject: [PATCH 7/8] cmake lists update --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76542842..d6911f61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -Wno-unused-parameter -Wno-psabi ) + + if(NOT DEFINED WARNING_SHADOW_LOCAL) + option(WARNING_SHADOW_LOCAL "Show shadows declarations warning." ON) endif() + + if(WARNING_SHADOW_LOCAL) + list(APPEND WARNING_FLAGS "-Wshadow=local") + endif() + endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") From b23309a5f4f1b73f86ee5d560f830e551e4b1e5e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Jan 2021 16:30:17 +0100 Subject: [PATCH 8/8] improved options --- CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6911f61..9dbd24cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 3.13) +option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) +# Options to exclude parts of the FSFW from compilation. +option(FSFW_USE_RMAP "Compile with RMAP" ON) +option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) + set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) @@ -40,9 +45,7 @@ endif() message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") -# Options to exclude parts of the FSFW from compilation. -option(FSFW_USE_RMAP "Compile with RMAP" ON) -option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) + add_subdirectory(action) add_subdirectory(container) @@ -116,12 +119,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -Wno-unused-parameter -Wno-psabi ) - - if(NOT DEFINED WARNING_SHADOW_LOCAL) - option(WARNING_SHADOW_LOCAL "Show shadows declarations warning." ON) - endif() - if(WARNING_SHADOW_LOCAL) + if(FSFW_WARNING_SHADOW_LOCAL_GCC) list(APPEND WARNING_FLAGS "-Wshadow=local") endif()