Added Unittests #103

Merged
meierj merged 18 commits from mueller/added-unittests into develop 2021-10-07 17:22:24 +02:00
39 changed files with 702 additions and 72 deletions

3
.gitmodules vendored
View File

@ -22,3 +22,6 @@
[submodule "thirdparty/json"] [submodule "thirdparty/json"]
path = thirdparty/json path = thirdparty/json
url = https://github.com/nlohmann/json.git url = https://github.com/nlohmann/json.git
[submodule "thirdparty/Catch2"]
path = thirdparty/Catch2
url = https://github.com/catchorg/Catch2.git

View File

@ -18,8 +18,9 @@ if(TGT_BSP MATCHES "arm/q7s")
option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function") option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
endif() endif()
option(ADD_ETL_LIB "Add ETL library" ON) option(EIVE_BUILD_UNITTESTS "Build Catch2 unittests" OFF)
option(ADD_JSON_LIB "Add JSON library" ON) option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF) option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
if(NOT FSFW_OSAL) if(NOT FSFW_OSAL)
@ -34,9 +35,14 @@ endif()
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake) include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config() pre_project_config()
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
if(EIVE_BUILD_WATCHDOG) if(EIVE_BUILD_WATCHDOG)
set(PROJECT_NAME_TO_SET eive-watchdog) set(PROJECT_NAME_TO_SET eive-watchdog)
elseif(EIVE_BUILD_UNITTESTS)
set(PROJECT_NAME_TO_SET eive-unittest)
elseif(TGT_BSP MATCHES "arm/q7s")
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
else()
set(PROJECT_NAME_TO_SET eive-obsw)
endif() endif()
# Project Name # Project Name
@ -59,26 +65,41 @@ set(LIB_LWGPS_NAME lwgps)
set(LIB_ARCSEC wire) set(LIB_ARCSEC wire)
set(THIRD_PARTY_FOLDER thirdparty) set(THIRD_PARTY_FOLDER thirdparty)
set(LIB_CXX_FS -lstdc++fs) set(LIB_CXX_FS -lstdc++fs)
set(LIB_CATCH2 Catch2)
set(LIB_JSON_NAME nlohmann_json::nlohmann_json) set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
# Set path names # Set path names
set(FSFW_PATH fsfw) set(FSFW_PATH fsfw)
set(MISSION_PATH mission) set(MISSION_PATH mission)
set(TEST_PATH test/testtasks) set(TEST_PATH test/testtasks)
set(UNITTEST_PATH unittest)
set(LINUX_PATH linux) set(LINUX_PATH linux)
set(COMMON_PATH common) set(COMMON_PATH common)
set(WATCHDOG_PATH watchdog) set(WATCHDOG_PATH watchdog)
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config) set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
set(FSFW_HAL_LIB_PATH fsfw_hal) set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp) set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl) set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps) set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
set(ARCSEC_LIB_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker) set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json) set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(ADD_LINUX_FILES False) set(EIVE_ADD_LINUX_FILES False)
if(EIVE_BUILD_UNITTESTS)
option(FSFW_ADD_UNITTESTS "Build the FSFW unittests as well" ON)
# Use FSFW custom main for unittests
set(FSFW_CUSTOM_UNITTEST_RUNNER ON)
endif()
if(FSFW_CUSTOM_UNITTEST_RUNNER OR FSFW_ADD_UNITTESTS)
set(CATCH2_TARGET Catch2)
else()
set(CATCH2_TARGET Catch2WithMain)
endif()
# Analyse different OS and architecture/target options, determine BSP_PATH, # Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc. # display information about compiler etc.
@ -91,7 +112,7 @@ if(TGT_BSP)
) )
set(FSFW_CONFIG_PATH "linux/fsfwconfig") set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE) if(NOT BUILD_Q7S_SIMPLE_MODE)
set(ADD_LINUX_FILES TRUE) set(EIVE_ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE) set(ADD_CSP_LIB TRUE)
set(FSFW_HAL_ADD_LINUX ON) set(FSFW_HAL_ADD_LINUX ON)
endif() endif()
@ -117,6 +138,11 @@ else()
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
endif() endif()
if(EIVE_BUILD_UNITTESTS)
configure_file(${UNITTEST_CFG_PATH}/TestsConfig.h.in TestsConfig.h)
set(FSFW_CONFIG_PATH ${UNITTEST_CFG_PATH})
endif()
# Configuration files # Configuration files
if(NOT EIVE_BUILD_WATCHDOG) if(NOT EIVE_BUILD_WATCHDOG)
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
@ -128,6 +154,9 @@ if(NOT EIVE_BUILD_WATCHDOG)
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif() endif()
endif() endif()
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h) configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
# Set common config path for FSFW # Set common config path for FSFW
@ -143,31 +172,38 @@ set(FSFW_ADDITIONAL_INC_PATHS
# Add executable # Add executable
add_executable(${TARGET_NAME}) add_executable(${TARGET_NAME})
if(ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)
add_subdirectory(${ETL_LIB_PATH}) add_subdirectory(${LIB_ETL_PATH})
endif() endif()
if(ADD_JSON_LIB) if(EIVE_ADD_JSON_LIB)
add_subdirectory(${LIB_JSON_PATH}) add_subdirectory(${LIB_JSON_PATH})
endif() endif()
if(NOT EIVE_BUILD_WATCHDOG) if(NOT EIVE_BUILD_WATCHDOG)
if(ADD_LINUX_FILES) if(NOT EIVE_BUILD_UNITTESTS)
if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH}) add_subdirectory(${LINUX_PATH})
endif() endif()
add_subdirectory(${BSP_PATH}) add_subdirectory(${BSP_PATH})
add_subdirectory(${COMMON_PATH})
if(ADD_CSP_LIB) if(ADD_CSP_LIB)
add_subdirectory(${CSP_LIB_PATH}) add_subdirectory(${LIB_CSP_PATH})
endif() endif()
endif()
add_subdirectory(${COMMON_PATH})
endif() endif()
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG)) if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
add_subdirectory(${LWGPS_LIB_PATH}) add_subdirectory(${LIB_LWGPS_PATH})
add_subdirectory(${FSFW_PATH}) add_subdirectory(${FSFW_PATH})
add_subdirectory(${MISSION_PATH}) add_subdirectory(${MISSION_PATH})
add_subdirectory(${TEST_PATH}) add_subdirectory(${TEST_PATH})
add_subdirectory(${ARCSEC_LIB_PATH}) add_subdirectory(${LIB_ARCSEC_PATH})
endif()
if(EIVE_BUILD_UNITTESTS)
add_subdirectory(${LIB_CATCH2_PATH})
add_subdirectory(${UNITTEST_PATH})
endif() endif()
if(EIVE_BUILD_WATCHDOG) if(EIVE_BUILD_WATCHDOG)
@ -195,6 +231,7 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
endif() endif()
endif() endif()
if(NOT EIVE_BUILD_WATCHDOG) if(NOT EIVE_BUILD_WATCHDOG)
if(ADD_CSP_LIB) if(ADD_CSP_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE target_link_libraries(${TARGET_NAME} PRIVATE
@ -203,18 +240,24 @@ if(NOT EIVE_BUILD_WATCHDOG)
endif() endif()
endif() endif()
if(ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_ETL_NAME} ${LIB_ETL_NAME}
) )
endif() endif()
if(ADD_JSON_LIB) if(EIVE_ADD_JSON_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_JSON_NAME} ${LIB_JSON_NAME}
) )
endif() endif()
if(EIVE_BUILD_UNITTESTS)
target_link_libraries(${TARGET_NAME} PRIVATE
${CATCH2_TARGET}
)
endif()
target_link_libraries(${TARGET_NAME} PRIVATE target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_CXX_FS} ${LIB_CXX_FS}
) )
@ -224,7 +267,7 @@ target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${FSFW_CONFIG_PATH} ${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${ARCSEC_LIB_PATH} ${LIB_ARCSEC_PATH}
) )
if(TGT_BSP MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")

View File

@ -171,6 +171,26 @@ cmake -DTGT_BSP=arm/q7s -DFSFW_OSAL=linux -DEIVE_BUILD_WATCHDOG=ON -DCMAKE_BUILD
cmake --build . -j cmake --build . -j
``` ```
### Hosted
You can also replace `linux` by `host` for this command to build on Windows or for generic OSes
```sh
mkdir build-Debug-Host && cd build-Debug-Host
cmake -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j
```
### Unittests
You can also replace `linux` by `host` for this command to build on Windows
```sh
mkdir build-Debug-Unittest && cd build-Debug-Unittest
cmake -DFSFW_OSAL=linux -DEIVE_BUILD_UNITTESTS=ON ..
cmake --build . -j
```
## Connect to EIVE flatsat ## Connect to EIVE flatsat
### DNS ### DNS

View File

@ -44,18 +44,5 @@ void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
sif::info << "Setting up UDP TMTC bridge with listener port " <<
UdpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#else
sif::info << "Setting up TCP TMTC bridge with listener port " <<
TcpTmTcServer::DEFAULT_SERVER_PORT << std::endl;
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#endif
new TestTask(objects::TEST_TASK); new TestTask(objects::TEST_TASK);
} }

View File

@ -82,19 +82,21 @@ void initmission::initTasks() {
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL); initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
} }
/* UDP bridge */ #if OBSW_ADD_TCPIP_BRIDGE == 1
// TMTC bridge
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE); initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
} }
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK); result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK); initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
} }
#endif
# if BOARD_TE0720 == 0 # if BOARD_TE0720 == 0
// FS task, task interval does not matter because it runs in permanent loop, priority low // FS task, task interval does not matter because it runs in permanent loop, priority low
@ -139,8 +141,12 @@ void initmission::initTasks() {
sif::info << "Starting tasks.." << std::endl; sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask(); tmTcDistributor->startTask();
#if OBSW_ADD_TCPIP_BRIDGE == 1
tmtcBridgeTask->startTask(); tmtcBridgeTask->startTask();
tmtcPollingTask->startTask(); tmtcPollingTask->startTask();
#endif
#if BOARD_TE0720 == 0 #if BOARD_TE0720 == 0
coreController->startTask(); coreController->startTask();
#endif #endif

View File

@ -69,16 +69,6 @@
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcpacket/pus/tm.h"
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
// UDP server includes
#include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h"
#else
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include "linux/boardtest/SpiTestClass.h" #include "linux/boardtest/SpiTestClass.h"
#if OBSW_TEST_LIBGPIOD == 1 #if OBSW_TEST_LIBGPIOD == 1
@ -114,6 +104,7 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(void* args) { void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics(); ObjectFactory::setStatics();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
UartComIF* uartComIF = nullptr; UartComIF* uartComIF = nullptr;
SpiComIF* spiComIF = nullptr; SpiComIF* spiComIF = nullptr;
@ -173,19 +164,6 @@ void ObjectFactory::produce(void* args) {
#endif /* TE7020 != 0 */ #endif /* TE7020 != 0 */
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->getUdpPort() << std::endl;
#else
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl;
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
/* Test Task */ /* Test Task */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF); createTestComponents(gpioComIF);

View File

@ -1,3 +1,7 @@
target_include_directories(${TARGET_NAME} PRIVATE target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_sources(${TARGET_NAME} PRIVATE
commonConfig.cpp
)

View File

@ -0,0 +1,5 @@
#include "commonConfig.h"
#include "tmtc/apid.h"
#include "fsfw/tmtcpacket/SpacePacket.h"
const uint16_t common::TC_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW);

View File

@ -1,10 +1,18 @@
#ifndef COMMON_CONFIG_COMMONCONFIG_H_ #ifndef COMMON_CONFIG_COMMONCONFIG_H_
#define COMMON_CONFIG_COMMONCONFIG_H_ #define COMMON_CONFIG_COMMONCONFIG_H_
#include <cstdint>
#define OBSW_ADD_LWGPS_TEST 0 #define OBSW_ADD_LWGPS_TEST 0
// Disable this for mission code. It allows exchanging TMTC packets via the Ethernet port
#define OBSW_ADD_TCPIP_BRIDGE 1
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally // Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
// because UDP packets are not allowed in the VPN // because UDP packets are not allowed in the VPN
#define OBSW_USE_TMTC_TCP_BRIDGE 1 #define OBSW_USE_TCP_BRIDGE 1
namespace common {
extern const uint16_t TC_PACKET_ID;
}
#endif /* COMMON_CONFIG_COMMONCONFIG_H_ */ #endif /* COMMON_CONFIG_COMMONCONFIG_H_ */

View File

@ -0,0 +1,60 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include "OBSWConfig.h"
#include <cstdint>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum SwitcherList: uint8_t {
Q7S,
PAYLOAD_PCDU_CH1,
RW,
TCS_BOARD_8V_HEATER_IN,
SUS_REDUNDANT,
DEPLOYMENT_MECHANISM,
PAYLOAD_PCDU_CH6,
ACS_BOARD_SIDE_B,
PAYLOAD_CAMERA,
TCS_BOARD_3V3,
SYRLINKS,
STAR_TRACKER,
MGT,
SUS_NOMINAL,
SOLAR_CELL_EXP,
PLOC,
ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
/* Output states after reboot of the PDUs */
static const uint8_t INIT_STATE_Q7S = ON;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
static const uint8_t INIT_STATE_RW = OFF;
#if BOARD_TE0720 == 1
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
#else
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
#endif
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
static const uint8_t INIT_STATE_SYRLINKS = OFF;
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
static const uint8_t INIT_STATE_MGT = OFF;
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
static const uint8_t INIT_STATE_PLOC = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
}
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit a84c770dfb8447325c263da42d5cecd99b38d1f0 Subproject commit 3d0ce1998114c5d7a43034233ee03a800c8821b0

View File

@ -1357,6 +1357,68 @@
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="ilg.gnumcueclipse.managedbuild.packs"/> <storageModule moduleId="ilg.gnumcueclipse.managedbuild.packs"/>
</cconfiguration> </cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168" moduleId="org.eclipse.cdt.core.settings" name="eive-linux-unittest">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.PE64" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168" name="eive-linux-unittest" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1717261896" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF;org.eclipse.cdt.core.PE64" id="cdt.managedbuild.target.gnu.platform.base.1043596837" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder arguments="--build . -j" buildPath="${workspace_loc:/eive-obsw/build-Debug-Unittest}" command="cmake" id="cdt.managedbuild.target.gnu.builder.base.114634905" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.248254004" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1191599857" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.833492811" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.605677508" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1443212512" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1565023847" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.2022291108" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.1925957909" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1227677208" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.2114489166" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.94505849" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.962053803" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.811217555" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1916140598" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1430794311" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="eive_obsw.null.1109622296" name="eive_obsw"/> <project id="eive_obsw.null.1109622296" name="eive_obsw"/>
@ -1374,6 +1436,7 @@
<resource resourceType="PROJECT" workspacePath="/eive-obsw"/> <resource resourceType="PROJECT" workspacePath="/eive-obsw"/>
</configuration> </configuration>
<configuration configurationName="eive-rpi-release-win"/> <configuration configurationName="eive-rpi-release-win"/>
<configuration configurationName="q7s-watchdog-debug"/>
<configuration configurationName="Default"> <configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/> <resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
</configuration> </configuration>
@ -1385,6 +1448,9 @@
<configuration configurationName="eive-q7s-debug"> <configuration configurationName="eive-q7s-debug">
<resource resourceType="PROJECT" workspacePath="/eive-obsw"/> <resource resourceType="PROJECT" workspacePath="/eive-obsw"/>
</configuration> </configuration>
<configuration configurationName="eive-linux-unittest">
<resource resourceType="PROJECT" workspacePath="/eive-obsw"/>
</configuration>
<configuration configurationName="eive-linux-host-release"/> <configuration configurationName="eive-linux-host-release"/>
<configuration configurationName="eive-mingw-debug"> <configuration configurationName="eive-mingw-debug">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/> <resource resourceType="PROJECT" workspacePath="/eive_obsw"/>

View File

@ -7,7 +7,7 @@
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>full,incremental,</triggers> <triggers>clean,full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>

View File

@ -18,7 +18,7 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Host/eive_obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Host/eive-obsw"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/> <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473"/>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Unittest/eive-unittest"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive-obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -4,6 +4,7 @@
#include <tmtc/apid.h> #include <tmtc/apid.h>
#include <tmtc/pusIds.h> #include <tmtc/pusIds.h>
#include "objects/systemObjectList.h"
#include <fsfw/events/EventManager.h> #include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h> #include <fsfw/health/HealthTable.h>
@ -23,12 +24,24 @@
#include <fsfw/timemanager/TimeStamper.h> #include <fsfw/timemanager/TimeStamper.h>
#include <mission/utility/TmFunnel.h> #include <mission/utility/TmFunnel.h>
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0
// UDP server includes
#include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h"
#else
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#endif
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h> #include <test/testtasks/TestTask.h>
#endif #endif
void ObjectFactory::produceGenericObjects() { void ObjectFactory::produceGenericObjects() {
/* Framework objects */ // Framework objects
new EventManager(objects::EVENT_MANAGER); new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE); new HealthTable(objects::HEALTH_TABLE);
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
@ -61,10 +74,10 @@ void ObjectFactory::produceGenericObjects() {
objects::CCSDS_PACKET_DISTRIBUTOR); objects::CCSDS_PACKET_DISTRIBUTOR);
/* TMTC Reception via UDP socket */ // Every TM packet goes through this funnel
new TmFunnel(objects::TM_FUNNEL); new TmFunnel(objects::TM_FUNNEL);
/* PUS stack */ // PUS service stack
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION,
apid::EIVE_OBSW, pus::PUS_SERVICE_1, objects::TM_FUNNEL, 20); apid::EIVE_OBSW, pus::PUS_SERVICE_1, objects::TM_FUNNEL, 20);
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS,
@ -83,4 +96,23 @@ void ObjectFactory::produceGenericObjects() {
pus::PUS_SERVICE_20); pus::PUS_SERVICE_20);
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT,
apid::EIVE_OBSW, pus::PUS_SERVICE_200); apid::EIVE_OBSW, pus::PUS_SERVICE_200);
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->getUdpPort() << std::endl;
#else
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
tmtcBridge->setMaxNumberOfPacketsStored(50);
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
// TCP is stream based. Use packet ID as start marker when parsing for space packets
tcpServer->setSpacePacketParsingOptions({common::TC_PACKET_ID});
sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl;
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
#endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */
} }

1
thirdparty/Catch2 vendored Submodule

@ -0,0 +1 @@
Subproject commit 426954032f263754d2fff4cffce8552e7371965e

2
tmtc

@ -1 +1 @@
Subproject commit 53bf65083889af10f77c3899972b1153ea835f3c Subproject commit 82495ad785c83440ee90846bce70be1659b66209

5
unittest/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
add_subdirectory(testcfg)
target_sources(${TARGET_NAME} PRIVATE
main.cpp
)

7
unittest/main.cpp Normal file
View File

@ -0,0 +1,7 @@
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw_tests/unit/CatchRunner.h"
int main(int argc, char* argv[]) {
fsfwtest::customMain(argc, argv);
}

View File

@ -0,0 +1,9 @@
target_sources(${TARGET_NAME} PRIVATE
ipc/MissionMessageTypes.cpp
pollingsequence/PollingSequenceFactory.cpp
)
# Add include paths for the executable
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -0,0 +1,81 @@
#ifndef CONFIG_FSFWCONFIG_H_
#define CONFIG_FSFWCONFIG_H_
#include <cstddef>
#include <cstdint>
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively
#define FSFW_CPP_OSTREAM_ENABLED 1
//! More FSFW related printouts. Useful for development.
#define FSFW_ENHANCED_PRINTOUT 0
//! Can be used to completely disable printouts, even the C stdio ones.
//! By default, printouts will be disabled for the unit tests.
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0
#ifndef FSFW_DISABLE_PRINTOUT
#define FSFW_DISABLE_PRINTOUT 1
#endif
#endif
#define FSFW_USE_PUS_C_TELEMETRY 1
#define FSFW_USE_PUS_C_TELECOMMANDS 1
//! 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 0
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
//! additional output which requires the translation files translateObjects
//! and translateEvents (and their compiled source files)
#define FSFW_OBJ_EVENT_TRANSLATION 0
#if FSFW_OBJ_EVENT_TRANSLATION == 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#include "objects/translateObjects.h"
#include "events/translateEvents.h"
#else
#endif
//! When using the newlib nano library, C99 support for stdio facilities
//! will not be provided. This define should be set to 1 if this is the case.
#define FSFW_NO_C99_IO 1
//! Specify whether a special mode store is used for Subsystem components.
#define FSFW_USE_MODESTORE 0
//! Defines if the real time scheduler for linux should be used.
//! If set to 0, this will also disable priority settings for linux
//! as most systems will not allow to set nice values without privileges
//! For embedded linux system set this to 1.
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
#define FSFW_USE_REALTIME_FOR_LINUX 1
namespace fsfwconfig {
//! Default timestamp size. The default timestamp will be an eight byte CDC
//! short timestamp.
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8;
//! 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;
//! Defines the FIFO depth of each commanding service base which
//! also determines how many commands a CSB service can handle in one cycle
//! simulataneously. This will increase the required RAM for
//! each CSB service !
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500;
}
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -0,0 +1,8 @@
#ifndef TESTCFG_OBSWCONFIG_H_
#define TESTCFG_OBSWCONFIG_H_
#endif /* TESTCFG_OBSWCONFIG_H_ */

View File

@ -0,0 +1,21 @@
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1
#ifdef __cplusplus
#include "objects/systemObjectList.h"
#include "events/subsystemIdRanges.h"
#include "returnvalues/classIds.h"
namespace config {
#endif
/* Add mission configuration flags here */
#ifdef __cplusplus
}
#endif
#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */

View File

@ -0,0 +1,5 @@
#include "logicalAddresses.h"

View File

@ -0,0 +1,15 @@
#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_
#define CONFIG_DEVICES_LOGICALADDRESSES_H_
#include <fsfw/devicehandlers/CookieIF.h>
#include <fsfw/unittest/config/objects/systemObjectList.h>
#include <cstdint>
namespace addresses {
/* Logical addresses have uint32_t datatype */
enum logicalAddresses: address_t {
};
}
#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */

View File

@ -0,0 +1,4 @@
#include "powerSwitcherList.h"

View File

@ -0,0 +1,12 @@
#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_
#define CONFIG_DEVICES_POWERSWITCHERLIST_H_
namespace switches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum switcherList {
};
}
#endif /* CONFIG_DEVICES_POWERSWITCHERLIST_H_ */

View File

@ -0,0 +1,19 @@
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#include <cstdint>
#include "commonSubsystemIds.h"
#include <fsfw/events/fwSubsystemIdRanges.h>
/**
* @brief Custom subsystem IDs can be added here
* @details
* Subsystem IDs are used to create unique events.
*/
namespace SUBSYSTEM_ID {
enum: uint8_t {
SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
};
}
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */

View File

@ -0,0 +1,12 @@
#include "MissionMessageTypes.h"
#include <fsfw/ipc/CommandMessage.h>
void messagetypes::clearMissionMessage(CommandMessage* message) {
switch(message->getMessageType()) {
default:
break;
}
}

View File

@ -0,0 +1,22 @@
#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_
#define CONFIG_IPC_MISSIONMESSAGETYPES_H_
#include <fsfw/ipc/FwMessageTypes.h>
class CommandMessage;
/**
* Custom command messages are specified here.
* Most messages needed to use FSFW are already located in
* <fsfw/ipc/FwMessageTypes.h>
* @param message Generic Command Message
*/
namespace messagetypes{
enum MESSAGE_TYPE {
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
};
void clearMissionMessage(CommandMessage* message);
}
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */

View File

@ -0,0 +1,33 @@
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <cstdint>
#include "commonObjects.h"
#include <fsfw/objectmanager/frameworkObjects.h>
// The objects will be instantiated in the ID order
namespace objects {
enum sourceObjects: uint32_t {
/* All addresses between start and end are reserved for the FSFW */
FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION,
FSFW_CONFIG_RESERVED_END = TM_STORE,
CCSDS_DISTRIBUTOR = 10,
PUS_DISTRIBUTOR = 11,
TM_FUNNEL = 12,
UDP_BRIDGE = 15,
UDP_POLLING_TASK = 16,
TEST_ECHO_COM_IF = 20,
TEST_DEVICE = 21,
HK_RECEIVER_MOCK = 22,
TEST_LOCAL_POOL_OWNER_BASE = 25,
SHARED_SET_ID = 26
};
}
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */

View File

@ -0,0 +1,39 @@
#include "PollingSequenceFactory.h"
#include <TestsConfig.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
ReturnValue_t pst::pollingSequenceInitDefault(
FixedTimeslotTaskIF *thisSequence) {
/* Length of a communication cycle */
uint32_t length = thisSequence->getPeriodMs();
/* Add polling sequence table here */
thisSequence->addSlot(objects::TEST_DEVICE, 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TEST_DEVICE, 0.3,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length,
DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK;
}
else {
#if FSFW_CPP_OSTREAM_ENABLED
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
<< std::endl;
#else
sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!");
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}
}

View File

@ -0,0 +1,32 @@
#ifndef POLLINGSEQUENCEFACTORY_H_
#define POLLINGSEQUENCEFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
class FixedTimeslotTaskIF;
/**
* All device handlers are scheduled by adding them into Polling Sequence Tables (PST)
* to satisfy stricter timing requirements of device communication,
* A device handler has four different communication steps:
* 1. DeviceHandlerIF::SEND_WRITE -> Send write via interface
* 2. DeviceHandlerIF::GET_WRITE -> Get confirmation for write
* 3. DeviceHandlerIF::SEND_READ -> Send read request
* 4. DeviceHandlerIF::GET_READ -> Read from interface
* The PST specifies precisely when the respective ComIF functions are called
* during the communication cycle time.
* The task is created using the FixedTimeslotTaskIF,
* which utilises the underlying Operating System Abstraction Layer (OSAL)
*
* @param thisSequence FixedTimeslotTaskIF * object is passed inside the Factory class when creating the PST
* @return
*/
namespace pst {
/* Default PST */
ReturnValue_t pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence);
}
#endif /* POLLINGSEQUENCEINIT_H_ */

View File

@ -0,0 +1,17 @@
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
#define CONFIG_RETURNVALUES_CLASSIDS_H_
#include "commonClassIds.h"
#include <fsfw/returnvalues/FwClassIds.h>
/**
* @brief CLASS_ID defintions which are required for custom returnvalues.
*/
namespace CLASS_ID {
enum {
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
};
}
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */

View File

@ -0,0 +1,18 @@
#ifndef CONFIG_TMTC_APID_H_
#define CONFIG_TMTC_APID_H_
#include <cstdint>
/**
* Application Process Definition: entity, uniquely identified by an
* application process ID (APID), capable of generating telemetry source
* packets and receiving telecommand packets.
*
* Chose APID(s) for mission and define it here.
*/
namespace apid {
static const uint16_t EIVE_OBSW = 0x65;
}
#endif /* CONFIG_TMTC_APID_H_ */

View File

@ -0,0 +1,25 @@
#ifndef CONFIG_TMTC_PUSIDS_HPP_
#define CONFIG_TMTC_PUSIDS_HPP_
#include <cstdint>
namespace pus {
enum Ids: uint8_t {
PUS_SERVICE_1 = 1,
PUS_SERVICE_2 = 2,
PUS_SERVICE_3 = 3,
PUS_SERVICE_5 = 5,
PUS_SERVICE_6 = 6,
PUS_SERVICE_8 = 8,
PUS_SERVICE_9 = 9,
PUS_SERVICE_11 = 11,
PUS_SERVICE_17 = 17,
PUS_SERVICE_19 = 19,
PUS_SERVICE_20 = 20,
PUS_SERVICE_23 = 23,
PUS_SERVICE_200 = 200,
PUS_SERVICE_201 = 201,
};
};
#endif /* CONFIG_TMTC_PUSIDS_HPP_ */

View File