From 7ffce219d5f86df29fe3348cdeb703419ba32acd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 7 Nov 2020 14:32:28 +0100 Subject: [PATCH 01/26] hosted build fix --- events/EventManager.cpp | 4 ++-- events/EventManager.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index f60a8a66d..d171b5913 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -42,7 +42,7 @@ ReturnValue_t EventManager::performOperation(uint8_t opCode) { EventMessage message; result = eventReportQueue->receiveMessage(&message); if (result == HasReturnvaluesIF::RETURN_OK) { -#ifdef DEBUG +#if FSFW_DEBUG_OUTPUT == 1 printEvent(&message); #endif notifyListeners(&message); @@ -113,7 +113,7 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, return result; } -#ifdef DEBUG +#if FSFW_DEBUG_OUTPUT == 1 void EventManager::printEvent(EventMessage* message) { const char *string = 0; diff --git a/events/EventManager.h b/events/EventManager.h index 2602aeb23..5e1a8153a 100644 --- a/events/EventManager.h +++ b/events/EventManager.h @@ -55,7 +55,7 @@ protected: void notifyListeners(EventMessage *message); -#ifdef DEBUG +#if FSFW_DEBUG_OUTPUT == 1 void printEvent(EventMessage *message); #endif From 5927d944de61672a16afc366d0ebec10f46e19c2 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 12 Dec 2020 18:32:24 +0100 Subject: [PATCH 02/26] cmake fixes --- CMakeLists.txt | 2 ++ datapool/CMakeLists.txt | 7 +------ datapoollocal/CMakeLists.txt | 8 ++++++++ events/CMakeLists.txt | 1 - housekeeping/CMakeLists.txt | 5 +++++ storagemanager/CMakeLists.txt | 2 ++ thermal/CMakeLists.txt | 4 ++-- 7 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 datapoollocal/CMakeLists.txt create mode 100644 housekeeping/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 669283c74..09760f8ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,8 @@ add_subdirectory(controller) add_subdirectory(coordinates) add_subdirectory(datalinklayer) add_subdirectory(datapool) +add_subdirectory(datapoollocal) +add_subdirectory(housekeeping) add_subdirectory(devicehandlers) add_subdirectory(events) add_subdirectory(fdir) diff --git a/datapool/CMakeLists.txt b/datapool/CMakeLists.txt index e741f6a13..0d53e1ba1 100644 --- a/datapool/CMakeLists.txt +++ b/datapool/CMakeLists.txt @@ -1,11 +1,6 @@ target_sources(${LIB_FSFW_NAME} PRIVATE - ControllerSet.cpp - DataPool.cpp - DataPoolAdmin.cpp - DataPoolParameterWrapper.cpp - DataSet.cpp HkSwitchHelper.cpp + PoolDataSetBase.cpp PoolEntry.cpp - PoolRawAccess.cpp ) \ No newline at end of file diff --git a/datapoollocal/CMakeLists.txt b/datapoollocal/CMakeLists.txt new file mode 100644 index 000000000..c6b187cd2 --- /dev/null +++ b/datapoollocal/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + LocalDataPoolManager.cpp + LocalDataSet.cpp + LocalPoolDataSetBase.cpp + LocalPoolObjectBase.cpp + SharedLocalDataSet.cpp +) \ No newline at end of file diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt index 9e63deb89..4e935167a 100644 --- a/events/CMakeLists.txt +++ b/events/CMakeLists.txt @@ -1,6 +1,5 @@ target_sources(${LIB_FSFW_NAME} PRIVATE - Event.cpp EventManager.cpp EventMessage.cpp ) diff --git a/housekeeping/CMakeLists.txt b/housekeeping/CMakeLists.txt new file mode 100644 index 000000000..fecad2e3d --- /dev/null +++ b/housekeeping/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + HousekeepingMessage.cpp + PeriodicHousekeepingHelper.cpp +) \ No newline at end of file diff --git a/storagemanager/CMakeLists.txt b/storagemanager/CMakeLists.txt index 57c921952..b8138cae7 100644 --- a/storagemanager/CMakeLists.txt +++ b/storagemanager/CMakeLists.txt @@ -2,4 +2,6 @@ target_sources(${LIB_FSFW_NAME} PRIVATE ConstStorageAccessor.cpp StorageAccessor.cpp + LocalPool.cpp + PoolManager.cpp ) \ No newline at end of file diff --git a/thermal/CMakeLists.txt b/thermal/CMakeLists.txt index 67664fbe5..ad5327214 100644 --- a/thermal/CMakeLists.txt +++ b/thermal/CMakeLists.txt @@ -1,10 +1,10 @@ target_sources(${LIB_FSFW_NAME} PRIVATE AbstractTemperatureSensor.cpp - CoreComponent.cpp Heater.cpp RedundantHeater.cpp + ThermalComponentCore.cpp ThermalComponent.cpp ThermalModule.cpp - ThermalMonitor.cpp + ThermalMonitorReporter.cpp ) From f128a1dc3d33c7bd22919b13240230373843f13c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Dec 2020 23:44:43 +0100 Subject: [PATCH 03/26] made datalinklayer optional --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09760f8ea..c8092629d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,11 @@ add_subdirectory(action) add_subdirectory(container) add_subdirectory(controller) add_subdirectory(coordinates) + +if(FSFW_USE_DATALINKLAYER) add_subdirectory(datalinklayer) +endif() + add_subdirectory(datapool) add_subdirectory(datapoollocal) add_subdirectory(housekeeping) From ac40b1c966bb025ce433dc55554100de29f77d5a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 17 Dec 2020 11:46:50 +0100 Subject: [PATCH 04/26] cmake list formatting --- CMakeLists.txt | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8092629d..fbbe386b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,27 +3,38 @@ cmake_minimum_required(VERSION 3.13) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) -# Set options for FSFW OSAL selection. -if(UNIX) -set(OS_FSFW "linux" CACHE STRING "OS abstraction layer used in the FSFW") -elseif(WIN32) -set(OS_FSFW "host" CACHE STRING "OS abstraction layer used in the FSFW") -endif() - set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos) +if(NOT OS_FSFW) + message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS") + # Assume host OS and autodetermine from OS_FSFW + if(UNIX) + set(OS_FSFW "linux" + CACHE STRING + "OS abstraction layer used in the FSFW" + ) + elseif(WIN32) + set(OS_FSFW "host" + CACHE STRING "OS abstraction layer used in the FSFW" + ) + endif() + +endif + if(${OS_FSFW} STREQUAL host) -set(OS_FSFW_NAME "Host") + set(OS_FSFW_NAME "Host") elseif(${OS_FSFW} STREQUAL linux) -set(OS_FSFW_NAME "Linux") + set(OS_FSFW_NAME "Linux") elseif(${OS_FSFW} STREQUAL freertos) -set(OS_FSFW_NAME "FreeRTOS") + set(OS_FSFW_NAME "FreeRTOS") elseif(${OS_FSFW} STREQUAL rtems) -set(OS_FSFW_NAME "RTEMS") + set(OS_FSFW_NAME "RTEMS") else() -message(WARNING "Invalid operating system for FSFW specified! Setting to host..") -set(OS_FSFW_NAME "Host") -set(OS_FSFW "host") + message(WARNING + "Invalid operating system for FSFW specified! Setting to host.." + ) + set(OS_FSFW_NAME "Host") + set(OS_FSFW "host") endif() message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system") @@ -38,7 +49,7 @@ add_subdirectory(controller) add_subdirectory(coordinates) if(FSFW_USE_DATALINKLAYER) -add_subdirectory(datalinklayer) + add_subdirectory(datalinklayer) endif() add_subdirectory(datapool) @@ -61,7 +72,7 @@ add_subdirectory(power) add_subdirectory(pus) if(FSFW_USE_RMAP) -add_subdirectory(rmap) + add_subdirectory(rmap) endif() add_subdirectory(serialize) @@ -79,9 +90,9 @@ add_subdirectory(tmtcservices) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. if(NOT FSFW_CONFIG_PATH) -message(WARNING "Flight Software Framework configuration path not set!") -message(WARNING "Setting default configuration!") -add_subdirectory(defaultcfg/fsfwconfig) + message(WARNING "Flight Software Framework configuration path not set!") + message(WARNING "Setting default configuration!") + add_subdirectory(defaultcfg/fsfwconfig) endif() # Required include paths to compile the FSFW From 62b5c19063c6b55f08aae54bc93e879619bd1a06 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 17 Dec 2020 20:18:16 +0100 Subject: [PATCH 05/26] small fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbe386b0..5cb4b28ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ if(NOT OS_FSFW) ) endif() -endif +endif() if(${OS_FSFW} STREQUAL host) set(OS_FSFW_NAME "Host") From c0099481a16897273b10a0c8b59c8f2504392b3d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 00:21:08 +0100 Subject: [PATCH 06/26] added freertos cmakelists --- osal/FreeRTOS/CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 osal/FreeRTOS/CMakeLists.txt diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt new file mode 100644 index 000000000..a7b1338f9 --- /dev/null +++ b/osal/FreeRTOS/CMakeLists.txt @@ -0,0 +1,18 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + Clock.cpp + FixedTimeslotTask.cpp + BinarySemaphore.cpp + BinSemaphUsingTask.cpp + CountingSemaphore.cpp + CountingSemaphUsingTask.cpp + MessageQueue.cpp + Mutex.cpp + MutexFactory.cpp + PeriodicTask.cpp + QueueFactory.cpp + QueueMapManager.cpp + SemaphoreFactory.cpp + TaskFactory.cpp + Timekeeper.cpp +) \ No newline at end of file From e030d7ed97609c377af8540b7754b08bbb7c87ef Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 02:29:22 +0100 Subject: [PATCH 07/26] correct interface and private includes --- CMakeLists.txt | 24 +++++++++++++++++++++--- osal/FreeRTOS/CMakeLists.txt | 15 +++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cb4b28ec..a3ca3e0d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,8 +95,26 @@ if(NOT FSFW_CONFIG_PATH) add_subdirectory(defaultcfg/fsfwconfig) endif() +# FSFW might be part of a possibly complicated folder structure, so we +# extract the absolute path of the fsfwconfig folder. +if(IS_ABSOLUTE ${FSFW_CONFIG_PATH}) + set(${FSFW_CONFIG_PATH_ABSOLUTE} ${FSFW_CONFIG_PATH}) +else() + get_filename_component(${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_CONFIG_PATH} ABSOLUTE + ) +endif() + # Required include paths to compile the FSFW -target_include_directories(${LIB_FSFW_NAME} - INTERFACE - ${FSFW_CONFIG_PATH} +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_SOURCE_DIR} + ${FSFW_CONFIG_PATH_ABSOLUTE} +) + +# Includes path required to compile FSFW itself as well +# We assume that the fsfwconfig folder uses include relative to the project +# root here! +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_SOURCE_DIR} + ${FSFW_CONFIG_PATH_ABSOLUTE} ) diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt index a7b1338f9..c310c5cf4 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/osal/FreeRTOS/CMakeLists.txt @@ -11,8 +11,19 @@ target_sources(${LIB_FSFW_NAME} MutexFactory.cpp PeriodicTask.cpp QueueFactory.cpp - QueueMapManager.cpp SemaphoreFactory.cpp TaskFactory.cpp Timekeeper.cpp -) \ No newline at end of file +) + +# FreeRTOS is required to link the FSFW now. It is recommended to compile +# FreeRTOS as a static library and set LIB_OS_NAME to the target name of the +# library. +if(NOT LIB_OS_NAME) + message(FATAL_ERROR + "FreeRTOS needs to be linked as a target and " + "LIB_OS_NAME needs to be set to the target" + ) +endif() + +target_link_libraries(${LIB_FSWFW_NAME} ${LIB_OS_NAME}) \ No newline at end of file From be20978998bc2d6852cd7ecdc6d3061354e13104 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 12:10:29 +0100 Subject: [PATCH 08/26] better path determination --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3ca3e0d6..21f4c90e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,10 +98,10 @@ endif() # FSFW might be part of a possibly complicated folder structure, so we # extract the absolute path of the fsfwconfig folder. if(IS_ABSOLUTE ${FSFW_CONFIG_PATH}) - set(${FSFW_CONFIG_PATH_ABSOLUTE} ${FSFW_CONFIG_PATH}) + set(FSFW_CONFIG_PATH_ABSOLUTE ${FSFW_CONFIG_PATH}) else() - get_filename_component(${FSFW_CONFIG_PATH_ABSOLUTE} - ${FSFW_CONFIG_PATH} ABSOLUTE + get_filename_component(FSFW_CONFIG_PATH_ABSOLUTE + ${FSFW_CONFIG_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR} ) endif() From b8e703ca833295d5dbfaadf20bb45b358295b6ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 13:04:16 +0100 Subject: [PATCH 09/26] linked against OS --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21f4c90e0..5660443fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ elseif(${OS_FSFW} STREQUAL linux) set(OS_FSFW_NAME "Linux") elseif(${OS_FSFW} STREQUAL freertos) set(OS_FSFW_NAME "FreeRTOS") + target_link_libraries(${LIB_FSFW_NAME} ${LIB_OS_NAME}) elseif(${OS_FSFW} STREQUAL rtems) set(OS_FSFW_NAME "RTEMS") else() From 8ede00fdf18c8a0fb7afd808a2d76d69bd5c23a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 18:38:02 +0100 Subject: [PATCH 10/26] small bugfixes --- CMakeLists.txt | 4 ++++ osal/FreeRTOS/CMakeLists.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5660443fc..0497a42ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,3 +119,7 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} ) + +target_compile_options(${LIB_FSFW_NAME} PRIVATE + ${ABI_FLAGS} +) diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt index c310c5cf4..95462010f 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/osal/FreeRTOS/CMakeLists.txt @@ -14,6 +14,7 @@ target_sources(${LIB_FSFW_NAME} SemaphoreFactory.cpp TaskFactory.cpp Timekeeper.cpp + TaskManagement.cpp ) # FreeRTOS is required to link the FSFW now. It is recommended to compile From d186b70d2edf5265f99e6d933ce90ccf5faf641f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 18:41:28 +0100 Subject: [PATCH 11/26] comment added --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0497a42ff..b2c55d957 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,6 +120,7 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE ${FSFW_CONFIG_PATH_ABSOLUTE} ) +# Machine specific options can be set with the ABI_FLAGS variable. target_compile_options(${LIB_FSFW_NAME} PRIVATE ${ABI_FLAGS} ) From c64a9654ea54ab843406b9966fffd9f26c76e17a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 19 Dec 2020 22:51:10 +0100 Subject: [PATCH 12/26] xcompile update --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2c55d957..2fc33e588 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ else() set(OS_FSFW "host") endif() -message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system") +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) From ebe7f02fc4c65ac4f28825d54671fe402e61cd9f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 20 Dec 2020 01:56:21 +0100 Subject: [PATCH 13/26] better error handling --- osal/windows/TcWinUdpPollingTask.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osal/windows/TcWinUdpPollingTask.cpp b/osal/windows/TcWinUdpPollingTask.cpp index 7b54bb2cf..06deafd10 100644 --- a/osal/windows/TcWinUdpPollingTask.cpp +++ b/osal/windows/TcWinUdpPollingTask.cpp @@ -119,7 +119,7 @@ void TcWinUdpPollingTask::setTimeout(double timeoutSeconds) { int result = setsockopt(serverUdpSocket, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast(&timeoutMs), sizeof(DWORD)); if(result == -1) { - sif::error << "TcSocketPollingTask::TcSocketPollingTask: Setting " + sif::error << "TcWinUdpPollingTask::TcSocketPollingTask: Setting " "receive timeout failed with " << strerror(errno) << std::endl; } } @@ -128,17 +128,22 @@ void TcWinUdpPollingTask::handleReadError() { int error = WSAGetLastError(); switch(error) { case(WSANOTINITIALISED): { - sif::info << "TmTcWinUdpBridge::handleReadError: WSANOTINITIALISED: " + sif::info << "TcWinUdpPollingTask::handleReadError: WSANOTINITIALISED: " << "WSAStartup(...) call " << "necessary" << std::endl; break; } case(WSAEFAULT): { - sif::info << "TmTcWinUdpBridge::handleReadError: WSADEFAULT: " + sif::info << "TcWinUdpPollingTask::handleReadError: WSADEFAULT: " << "Bad address " << std::endl; break; } + case(WSAEINVAL): { + sif::info << "TcWinUdpPollingTask::handleReadError: WSAEINVAL: " + << "Invalid input parameters. " << std::endl; + break; + } default: { - sif::info << "TmTcWinUdpBridge::handleReadError: Error code: " + sif::info << "TcWinUdpPollingTask::handleReadError: Error code: " << error << std::endl; break; } From a0d5b2331183d40edacc4a81a6022573d00a18a0 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 20 Dec 2020 02:09:08 +0100 Subject: [PATCH 14/26] small improvement --- osal/host/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/host/CMakeLists.txt b/osal/host/CMakeLists.txt index d73e6f275..aa32990be 100644 --- a/osal/host/CMakeLists.txt +++ b/osal/host/CMakeLists.txt @@ -13,9 +13,9 @@ target_sources(${LIB_FSFW_NAME} ) if(UNIX) - add_definitions(-pthread) target_link_libraries(${LIB_FSFW_NAME} PRIVATE rt + pthread ) endif() \ No newline at end of file From 3540adf022c792c5ba3470482a2cc4e83aad96fa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 20 Dec 2020 13:21:12 +0100 Subject: [PATCH 15/26] added warning flags --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fc33e588..084bd4ae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,15 @@ else() ) endif() +set(WARNING_FLAGS + -Wall + -Wextra + -Wshadow=local + -Wimplicit-fallthrough=1 + -Wno-unused-parameter + -Wno-psabi +) + # Required include paths to compile the FSFW target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_SOURCE_DIR} @@ -122,5 +131,6 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE # Machine specific options can be set with the ABI_FLAGS variable. target_compile_options(${LIB_FSFW_NAME} PRIVATE + ${WARNING_FLAGS} ${ABI_FLAGS} ) From d8e5000d47c705e4527f9cd8fe5c5960bdcea64f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 20 Dec 2020 15:32:03 +0100 Subject: [PATCH 16/26] msvc tests --- CMakeLists.txt | 23 +++++++++++++++-------- coordinates/Sgp4Propagator.h | 2 ++ globalfunctions/timevalOperations.h | 6 ++++++ osal/Endiness.h | 14 ++++++++++++++ serviceinterface/ServiceInterfaceBuffer.h | 2 +- timemanager/Clock.h | 2 ++ 6 files changed, 40 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 084bd4ae9..02849ca44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,14 +106,20 @@ else() ) endif() -set(WARNING_FLAGS - -Wall - -Wextra - -Wshadow=local - -Wimplicit-fallthrough=1 - -Wno-unused-parameter - -Wno-psabi -) +if(CMAKE_COMPILER_IS_GNUCXX) + set(WARNING_FLAGS + -Wall + -Wextra + -Wshadow=local + -Wimplicit-fallthrough=1 + -Wno-unused-parameter + -Wno-psabi + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(COMPILER_FLAGS "/permissive-") +endif() # Required include paths to compile the FSFW target_include_directories(${LIB_FSFW_NAME} INTERFACE @@ -132,5 +138,6 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE # Machine specific options can be set with the ABI_FLAGS variable. target_compile_options(${LIB_FSFW_NAME} PRIVATE ${WARNING_FLAGS} + ${COMPILER_FLAGS} ${ABI_FLAGS} ) diff --git a/coordinates/Sgp4Propagator.h b/coordinates/Sgp4Propagator.h index 3949547e1..f813c6f4d 100644 --- a/coordinates/Sgp4Propagator.h +++ b/coordinates/Sgp4Propagator.h @@ -1,7 +1,9 @@ #ifndef SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_ +#ifndef WIN32 #include +#endif #include "../contrib/sgp4/sgp4unit.h" #include "../returnvalues/HasReturnvaluesIF.h" diff --git a/globalfunctions/timevalOperations.h b/globalfunctions/timevalOperations.h index 3977d5d96..18eef866d 100644 --- a/globalfunctions/timevalOperations.h +++ b/globalfunctions/timevalOperations.h @@ -2,7 +2,13 @@ #define TIMEVALOPERATIONS_H_ #include + +#ifdef WIN32 +// Why MSVC? Why? :))) +#include +#else #include +#endif timeval& operator+=(timeval& lhs, const timeval& rhs); diff --git a/osal/Endiness.h b/osal/Endiness.h index 65cc0a10f..9d3fdef0f 100644 --- a/osal/Endiness.h +++ b/osal/Endiness.h @@ -22,9 +22,23 @@ #else #error "Can't decide which end is which!" #endif +#else + +#ifdef WIN32 +#include +#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN +#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN +#else +#define BYTE_ORDER_SYSTEM BIG_ENDIAN +#endif + + #else #error __BYTE_ORDER__ not defined #endif + +#endif + #endif diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/serviceinterface/ServiceInterfaceBuffer.h index c5d5b2584..e69538d1d 100644 --- a/serviceinterface/ServiceInterfaceBuffer.h +++ b/serviceinterface/ServiceInterfaceBuffer.h @@ -30,7 +30,7 @@ protected: //! This is called when buffer becomes full. If //! buffer is not used, then this is called every //! time when characters are put to stream. - int overflow(int c = Traits::eof()) override; + int overflow(int c = std::ostream::traits_type::eof()) override; //! This function is called when stream is flushed, //! for example when std::endl is put to stream. diff --git a/timemanager/Clock.h b/timemanager/Clock.h index d8b06fda5..7e27e40db 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -6,7 +6,9 @@ #include "../globalfunctions/timevalOperations.h" #include +#ifndef WIN32 #include +#endif //! Don't use these for time points, type is not large enough for UNIX epoch. using dur_millis_t = uint32_t; From de183e6c6589386cbbfefe6ba56e0dc45a2f6faa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 20 Dec 2020 17:01:22 +0100 Subject: [PATCH 17/26] removed comment --- globalfunctions/timevalOperations.h | 1 - 1 file changed, 1 deletion(-) diff --git a/globalfunctions/timevalOperations.h b/globalfunctions/timevalOperations.h index 18eef866d..46f763b97 100644 --- a/globalfunctions/timevalOperations.h +++ b/globalfunctions/timevalOperations.h @@ -4,7 +4,6 @@ #include #ifdef WIN32 -// Why MSVC? Why? :))) #include #else #include From 5c45b823ad8807d4cd83e109eed7da87feceb56e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Dec 2020 13:52:41 +0100 Subject: [PATCH 18/26] include fix --- globalfunctions/timevalOperations.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalfunctions/timevalOperations.h b/globalfunctions/timevalOperations.h index 46f763b97..db68f3304 100644 --- a/globalfunctions/timevalOperations.h +++ b/globalfunctions/timevalOperations.h @@ -4,7 +4,7 @@ #include #ifdef WIN32 -#include +#include #else #include #endif From 1d080ba6cb3d6a73fa5647c32033ec718fe3bb72 Mon Sep 17 00:00:00 2001 From: Spacefish Date: Mon, 21 Dec 2020 14:07:06 +0100 Subject: [PATCH 19/26] clock update --- timemanager/Clock.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/timemanager/Clock.h b/timemanager/Clock.h index 7e27e40db..fcc602a2d 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -6,7 +6,10 @@ #include "../globalfunctions/timevalOperations.h" #include -#ifndef WIN32 + +#ifdef WIN32 +#include +#else #include #endif From 5317391f8a1077eebc179e3ce3df8cdb9e753315 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Dec 2020 17:19:43 +0100 Subject: [PATCH 20/26] reverted change --- serviceinterface/ServiceInterfaceBuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/serviceinterface/ServiceInterfaceBuffer.h index e69538d1d..c5d5b2584 100644 --- a/serviceinterface/ServiceInterfaceBuffer.h +++ b/serviceinterface/ServiceInterfaceBuffer.h @@ -30,7 +30,7 @@ protected: //! This is called when buffer becomes full. If //! buffer is not used, then this is called every //! time when characters are put to stream. - int overflow(int c = std::ostream::traits_type::eof()) override; + int overflow(int c = Traits::eof()) override; //! This function is called when stream is flushed, //! for example when std::endl is put to stream. From b28bf35fc340cf9718af100c7531f15ea6bf1a8f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 12:44:55 +0100 Subject: [PATCH 21/26] devicehandler updates --- devicehandlers/DeviceHandlerBase.cpp | 10 +++- devicehandlers/DeviceHandlerBase.h | 69 ++++++++++++++-------------- devicehandlers/DeviceHandlerIF.h | 2 +- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index f095834e2..cb0407145 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -928,7 +928,7 @@ void DeviceHandlerBase::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { uint32_t DeviceHandlerBase::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { - return 0; + return 5000; } ReturnValue_t DeviceHandlerBase::getStateOfSwitches(void) { @@ -1459,3 +1459,11 @@ DeviceCommandId_t DeviceHandlerBase::getPendingCommand() const { } return DeviceHandlerIF::NO_COMMAND; } + +void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() { + for(const auto& reply: deviceReplyMap) { + if(reply.second.dataSet != nullptr) { + reply.second.dataSet->setValidity(false, true); + } + } +} diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 9a5287e03..ee4447ed1 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -254,9 +254,10 @@ protected: * * @param[out] id the device command id that has been built * @return - * - @c RETURN_OK to send command after setting #rawPacket and #rawPacketLen. - * - @c NOTHING_TO_SEND when no command is to be sent. - * - Anything else triggers an even with the returnvalue as a parameter. + * - @c RETURN_OK to send command after setting #rawPacket and + * #rawPacketLen. + * - @c NOTHING_TO_SEND when no command is to be sent. + * - Anything else triggers an even with the returnvalue as a parameter. */ virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) = 0; @@ -273,7 +274,8 @@ protected: * and filling them in doStartUp(), doShutDown() and doTransition() so no * modes have to be checked here. * - * #rawPacket and #rawPacketLen must be set by this method to the packet to be sent. + * #rawPacket and #rawPacketLen must be set by this method to the + * packet to be sent. * * @param[out] id the device command id built * @return @@ -284,19 +286,23 @@ protected: virtual ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) = 0; /** - * @brief Build a device command packet from data supplied by a direct command. + * @brief Build a device command packet from data supplied by a + * direct command. * * @details - * #rawPacket and #rawPacketLen should be set by this method to the packet to be sent. - * The existence of the command in the command map and the command size check - * against 0 are done by the base class. + * #rawPacket and #rawPacketLen should be set by this method to the packet + * to be sent. The existence of the command in the command map and the + * command size check against 0 are done by the base class. * - * @param deviceCommand the command to build, already checked against deviceCommandMap + * @param deviceCommand the command to build, already checked against + * deviceCommandMap * @param commandData pointer to the data from the direct command * @param commandDataLen length of commandData * @return - * - @c RETURN_OK to send command after #rawPacket and #rawPacketLen have been set. - * - Anything else triggers an event with the returnvalue as a parameter + * - @c RETURN_OK to send command after #rawPacket and #rawPacketLen + * have been set. + * - Anything else triggers an event with the + * returnvalue as a parameter */ virtual ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t * commandData, size_t commandDataLen) = 0; @@ -681,7 +687,7 @@ protected: //! The dataset used to access housekeeping data related to the //! respective device reply. Will point to a dataset held by //! the child handler (if one is specified) - LocalPoolDataSetBase* dataSet; + LocalPoolDataSetBase* dataSet = nullptr; //! The command that expects this reply. DeviceCommandMap::iterator command; }; @@ -743,6 +749,17 @@ protected: //!< Object which may be the root cause of an identified fault. static object_id_t defaultFdirParentId; + /** + * @brief Set all datapool variables that are update periodically in + * normal mode invalid + * @details + * The default implementation will set all datasets which have been added + * in #fillCommandAndReplyMap to invalid. It will also set all pool + * variables inside the dataset to invalid. The user can override this + * method optionally. + */ + virtual void setNormalDatapoolEntriesInvalid(); + /** * Helper function to get pending command. This is useful for devices * like SPI sensors to identify the last sent command. @@ -785,7 +802,6 @@ protected: * * The submode is left unchanged. * - * * @param newMode */ void setMode(Mode_t newMode); @@ -838,8 +854,6 @@ protected: virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom); /** - * Is the combination of mode and submode valid? - * * @param mode * @param submode * @return @@ -850,13 +864,10 @@ protected: Submode_t submode); /** - * Get the Rmap action for the current step. - * + * Get the communication action for the current step. * The step number can be read from #pstStep. - * - * @return The Rmap action to execute in this step + * @return The communication action to execute in this step */ - virtual CommunicationAction getComAction(); /** @@ -898,8 +909,8 @@ protected: * It gets space in the #IPCStore, copies data there, then sends a raw reply * containing the store address. * - * This method is virtual, as the STR has a different channel to send - * raw replies and overwrites it accordingly. + * This method is virtual, as devices can have different channels to send + * raw replies * * @param data data to send * @param len length of @c data @@ -918,7 +929,7 @@ protected: void replyRawReplyIfnotWiretapped(const uint8_t *data, size_t len); /** - * notify child about mode change + * @brief Notify child about mode change. */ virtual void modeChanged(void); @@ -950,8 +961,7 @@ protected: DeviceCommandId_t alternateReplyID = 0); /** - * get the state of the PCDU switches in the datapool - * + * Get the state of the PCDU switches in the local datapool * @return * - @c PowerSwitchIF::SWITCH_ON if all switches specified * by #switches are on @@ -961,15 +971,6 @@ protected: */ ReturnValue_t getStateOfSwitches(void); - /** - * @brief Set all datapool variables that are update periodically in - * normal mode invalid - * @details TODO: Use local pools - * Child classes should provide an implementation which sets all those - * variables invalid which are set periodically during any normal mode. - */ - virtual void setNormalDatapoolEntriesInvalid() = 0; - /** * build a list of sids and pass it to the #hkSwitcher */ diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index dba6b2288..e56487515 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -131,7 +131,7 @@ public: // Standard codes used in interpretDeviceReply static const ReturnValue_t DEVICE_DID_NOT_EXECUTE = MAKE_RETURN_CODE(0xC0); //the device reported, that it did not execute the command static const ReturnValue_t DEVICE_REPORTED_ERROR = MAKE_RETURN_CODE(0xC1); - static const ReturnValue_t UNKNOW_DEVICE_REPLY = MAKE_RETURN_CODE(0xC2); //the deviceCommandId reported by scanforReply is unknown + static const ReturnValue_t UNKNOWN_DEVICE_REPLY = MAKE_RETURN_CODE(0xC2); //the deviceCommandId reported by scanforReply is unknown static const ReturnValue_t DEVICE_REPLY_INVALID = MAKE_RETURN_CODE(0xC3); //syntax etc is correct but still not ok, eg parameters where none are expected // Standard codes used in buildCommandFromCommand From 9de2b054ef6155293237cc928ca97bf2a5b0c718 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 12:53:03 +0100 Subject: [PATCH 22/26] updated changelog --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 7b07db082..4e51bc64e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -53,6 +53,12 @@ ID for now. - There is an additional `PERFORM_OPERATION` step for the device handler base. It is important that DHB users adapt their polling sequence tables to perform this step. This steps allows for aclear distinction between operation and communication steps +- setNormalDatapoolEntriesInvalid is not an abstract method and a default implementation was provided +- getTransitionDelayMs now return 5000 ms instead of 0 in default implementation + +### DeviceHandlerIF + +- Typo for UNKNOWN_DEVICE_REPLY ### Events From 820731de7bfa40d88a592a927031793bbc73f873 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 13:23:19 +0100 Subject: [PATCH 23/26] updated docs, added new doc folder --- README.md | 100 ++++++++++++---------------------- doc/README-config.md | 21 +++++++ doc/README-core.md | 50 +++++++++++++++++ doc/README-devicehandlers.txt | 0 4 files changed, 106 insertions(+), 65 deletions(-) create mode 100644 doc/README-config.md create mode 100644 doc/README-core.md create mode 100644 doc/README-devicehandlers.txt diff --git a/README.md b/README.md index 4aabe36a9..8552e0c81 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![FSFW Logo](logo/FSFW_Logo_V3_bw.png) + # Flight Software Framework (FSFW) The Flight Software Framework is a C++ Object Oriented Framework for unmanned, @@ -14,83 +15,54 @@ The framework is designed for systems, which communicate with external devices, Therefore, a mode and health system provides control over the states of the software and the controlled devices. In addition, a simple mechanism of event based fault detection, isolation and recovery is implemented as well. -The recommended hardware is a microprocessor with more than 2 MB of RAM and 1 MB of non-volatile Memory. +The recommended hardware is a microprocessor with more than 1 MB of RAM and 1 MB of non-volatile Memory. For reference, current Applications use a Cobham Gaisler UT699 (LEON3FT), a ISISPACE IOBC or a Zynq-7020 SoC. +The `fsfw` was also tested on the STM32H743ZI-Nucleo board. +## How to Use + +The [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example) provides a good starting point and a demo +to see the FSFW capabilities and build it with the Make or the CMake build system. +Generally, the FSFW is included in a project by compiling the FSFW sources and providing +a configuration folder and adding it to the include path. +A template configuration folder was provided and can be copied into the project root to have +a starting point. The [configuration section](doc/README-config.md#top) provides more specific information about +the possible options. ## Structure -The general structure is driven by the usage of interfaces provided by objects. The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be widely available, even with older compilers. +The general structure is driven by the usage of interfaces provided by objects. +The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be widely available, even with older compilers. The FSFW uses dynamic allocation during the initialization but provides static containers during runtime. This simplifies the instantiation of objects and allows the usage of some standard containers. Dynamic Allocation after initialization is discouraged and different solutions are provided in the FSFW to achieve that. -The fsfw uses Run-time type information. -Exceptions are not allowed. +The fsfw uses run-time type information but exceptions are not allowed. ### Failure Handling -Functions should return a defined ReturnValue_t to signal to the caller that something is gone wrong. +Functions should return a defined ReturnValue_t to signal to the caller that something has gone wrong. Returnvalues must be unique. For this the function HasReturnvaluesIF::makeReturnCode or the Macro MAKE_RETURN can be used. The CLASS_ID is a unique id for that type of object. See returnvalues/FwClassIds. ### OSAL -The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS. A independent OSAL called "host" is currently not finished. This aims to be running on windows as well. -The OSAL provides periodic tasks, message queues, clocks and Semaphores as well as Mutexes. + +The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS. +A independent Host OSAL is in development which will provide abstraction for common type of +host OSes (tested for Linux and Windows, not for MacOS yet). +The OSAL provides periodic tasks, message queues, clocks and semaphores as well as mutexes. ### Core Components -Clock: - * This is a class of static functions that can be used at anytime - * Leap Seconds must be set if any time conversions from UTC to other times is used - -ObjectManager (must be created): - -* The component which handles all references. All SystemObjects register at this component. -* Any SystemObject needs to have a unique ObjectId. Those can be managed like objects::framework_objects. -* A reference to an object can be get by calling the following function. T must be the specific Interface you want to call. -A nullptr check of the returning Pointer must be done. This function is based on Run-time type information. - -``` c++ - template T* ObjectManagerIF::get( object_id_t id ) - -``` -* A typical way to create all objects on startup is a handing a static produce function to the ObjectManager on creation. -By calling objectManager->initialize() the produce function will be called and all SystemObjects will be initialized afterwards. - -Event Manager: - -* Component which allows routing of events -* Other objects can subscribe to specific events, ranges of events or all events of an object. -* Subscriptions can be done during runtime but should be done during initialization -* Amounts of allowed subscriptions must be configured by setting this parameters: - -``` c++ -namespace fsfwconfig { -//! Configure the allocated pool sizes for the event manager. -static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; -static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; -static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; -} -``` - - -Health Table: - -* A component which holds every health state -* Provides a thread safe way to access all health states without the need of message exchanges - -Stores - -* The message based communication can only exchange a few bytes of information inside the message itself. Therefore, additional information can be exchanged with Stores. With this, only the store address must be exchanged in the message. -* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC Store is used. For outgoing TM a TM store is used. -* All of them should use the Thread Safe Class storagemanager/PoolManager - -Tasks - -There are two different types of tasks: - * The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the insertion to the Tasks. - * FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for DeviceHandlers, where polling should be in a defined order. An example can be found in defaultcfg/fsfwconfig/pollingSequence +The FSFW has following core components. More detailed informations can be found in the +[core component section](doc/README-core.md#top): +1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks with fixed timeslots +2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID to the object handles. +3. Static Stores: Different stores are provided to store data of variable size (like telecommands or small telemetry) in a pool structure without + using dynamic memory allocation. These pools are allocated up front. +3. Clock: This module provided common time related functions +4. EventManager: This module allows routing of events generated by `SystemObjects` +5. HealthTable: A component which stores the health states of objects ### Static Ids in the framework @@ -121,13 +93,15 @@ If the communication is based on CCSDS Frames and Space Packets, several classes If Space Packets are used, a timestamper must be created. An example can be found in the timemanager folder, this uses CCSDSTime::CDS_short. -#### DeviceHandling +#### Device Handlers -DeviceHandlers are a core component of the FSFW. +DeviceHandlers are another important component of the FSFW. The idea is, to have a software counterpart of every physical device to provide a simple mode, health and commanding interface. -By separating the underlying Communication Interface with DeviceCommunicationIF, a DH can be tested on different hardware. +By separating the underlying Communication Interface with DeviceCommunicationIF, a device handler (DH) can be tested on different hardware. The DH has mechanisms to monitor the communication with the physical device which allow for FDIR reaction. +Device Handlers can be created by overriding `DeviceHandlerBase`. A standard FDIR component for the DH will be created automatically but can be overwritten by the user. +More information on DeviceHandlers can be found in the related [documentation section](doc/README-devicehandlers.md#top). #### Modes, Health @@ -149,10 +123,6 @@ The health state represents if the component is able to perform its tasks. This can be used to signal the system to avoid using this component instead of a redundant one. The on-board FDIR uses the health state for isolation and recovery. -## Example config - -A example config can be found in defaultcfg/fsfwconfig. - ## Unit Tests Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include catch2 itself. diff --git a/doc/README-config.md b/doc/README-config.md new file mode 100644 index 000000000..036a7d14c --- /dev/null +++ b/doc/README-config.md @@ -0,0 +1,21 @@ + +## Configuring the FSFW + +The FSFW can be configured via the `fsfwconfig` folder. A template folder has +been provided to have a starting point for this. The folder should be added +to the include path. + + +### Configuring the Event Manager + +The number of allowed subscriptions can be modified with the following +parameters: + +``` c++ +namespace fsfwconfig { +//! Configure the allocated pool sizes for the event manager. +static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; +static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; +static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; +} +``` \ No newline at end of file diff --git a/doc/README-core.md b/doc/README-core.md new file mode 100644 index 000000000..c47ae0f29 --- /dev/null +++ b/doc/README-core.md @@ -0,0 +1,50 @@ +## FSFW Core Modules + +These core modules provide the most important functionalities of the +Flight Software Framework + +### Clock + + * This is a class of static functions that can be used at anytime + * Leap Seconds must be set if any time conversions from UTC to other times is used + +### ObjectManager + +* Must be created during program startup +* The component which handles all references. All SystemObjects register at this component. +* Any SystemObject needs to have a unique ObjectId. Those can be managed like objects::framework_objects. +* A reference to an object can be get by calling the following function. T must be the specific Interface you want to call. +A nullptr check of the returning Pointer must be done. This function is based on Run-time type information. + +``` c++ + template T* ObjectManagerIF::get( object_id_t id ) + +``` +* A typical way to create all objects on startup is a handing a static produce function to the ObjectManager on creation. +By calling objectManager->initialize() the produce function will be called and all SystemObjects will be initialized afterwards. + +### Event Manager + +* Component which allows routing of events +* Other objects can subscribe to specific events, ranges of events or all events of an object. +* Subscriptions can be done during runtime but should be done during initialization +* Amounts of allowed subscriptions can be configured in `FSFWConfig.h` + +### Health Table + +* A component which holds every health state +* Provides a thread safe way to access all health states without the need of message exchanges + +### Stores + +* The message based communication can only exchange a few bytes of information inside the message itself. Therefore, additional information can + be exchanged with Stores. With this, only the store address must be exchanged in the message. +* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC Store is used. For outgoing TM a TM store is used. +* All of them should use the Thread Safe Class storagemanager/PoolManager + +### Tasks + +There are two different types of tasks: + * The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the insertion to the Tasks. + * FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for DeviceHandlers, where polling should be in a defined order. An example can be found in defaultcfg/fsfwconfig/pollingSequence + diff --git a/doc/README-devicehandlers.txt b/doc/README-devicehandlers.txt new file mode 100644 index 000000000..e69de29bb From 9937842ded66d2ffca374bff275719cbba0fe4c1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 14:11:36 +0100 Subject: [PATCH 24/26] get transiition delay abstract --- devicehandlers/DeviceHandlerBase.cpp | 5 ----- devicehandlers/DeviceHandlerBase.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index cb0407145..d2d4ecb8d 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -926,11 +926,6 @@ void DeviceHandlerBase::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { setMode(getBaseMode(mode)); } -uint32_t DeviceHandlerBase::getTransitionDelayMs(Mode_t modeFrom, - Mode_t modeTo) { - return 5000; -} - ReturnValue_t DeviceHandlerBase::getStateOfSwitches(void) { if(powerSwitcher == nullptr) { return NO_SWITCH; diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index ee4447ed1..45450f627 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -490,7 +490,7 @@ protected: * @param modeTo * @return time in ms */ - virtual uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo); + virtual uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) = 0; /** * Return the switches connected to the device. From 9ac07368da3fab3a60fa0caffe0f10f8c35e2fd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 14:26:42 +0100 Subject: [PATCH 25/26] changelog update --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 4e51bc64e..8b13b68d5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,7 +54,7 @@ ID for now. - There is an additional `PERFORM_OPERATION` step for the device handler base. It is important that DHB users adapt their polling sequence tables to perform this step. This steps allows for aclear distinction between operation and communication steps - setNormalDatapoolEntriesInvalid is not an abstract method and a default implementation was provided -- getTransitionDelayMs now return 5000 ms instead of 0 in default implementation +- getTransitionDelayMs is now an abstract method ### DeviceHandlerIF From 822cc0306c90603bbd66365293670e1163dc36cd Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 22 Dec 2020 15:35:23 +0100 Subject: [PATCH 26/26] Fixed file ending of devicehanlder remake --- doc/README-devicehandlers.md | 1 + doc/README-devicehandlers.txt | 0 2 files changed, 1 insertion(+) create mode 100644 doc/README-devicehandlers.md delete mode 100644 doc/README-devicehandlers.txt diff --git a/doc/README-devicehandlers.md b/doc/README-devicehandlers.md new file mode 100644 index 000000000..6e737cc5a --- /dev/null +++ b/doc/README-devicehandlers.md @@ -0,0 +1 @@ +## FSFW DeviceHandlers \ No newline at end of file diff --git a/doc/README-devicehandlers.txt b/doc/README-devicehandlers.txt deleted file mode 100644 index e69de29bb..000000000