Merge remote-tracking branch 'upstream/development' into mueller/timeman-update

This commit is contained in:
Robin Müller 2020-12-22 14:27:36 +01:00
commit 1ad94bae7d
14 changed files with 170 additions and 42 deletions

View File

@ -3,30 +3,42 @@ cmake_minimum_required(VERSION 3.13)
set(LIB_FSFW_NAME fsfw) set(LIB_FSFW_NAME fsfw)
add_library(${LIB_FSFW_NAME}) 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) set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos)
if(${OS_FSFW} STREQUAL host) if(NOT OS_FSFW)
set(OS_FSFW_NAME "Host") message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS")
elseif(${OS_FSFW} STREQUAL linux) # Assume host OS and autodetermine from OS_FSFW
set(OS_FSFW_NAME "Linux") if(UNIX)
elseif(${OS_FSFW} STREQUAL freertos) set(OS_FSFW "linux"
set(OS_FSFW_NAME "FreeRTOS") CACHE STRING
elseif(${OS_FSFW} STREQUAL rtems) "OS abstraction layer used in the FSFW"
set(OS_FSFW_NAME "RTEMS") )
else() elseif(WIN32)
message(WARNING "Invalid operating system for FSFW specified! Setting to host..") set(OS_FSFW "host"
set(OS_FSFW_NAME "Host") CACHE STRING "OS abstraction layer used in the FSFW"
set(OS_FSFW "host") )
endif()
endif() endif()
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system") if(${OS_FSFW} STREQUAL host)
set(OS_FSFW_NAME "Host")
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()
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.")
# Options to exclude parts of the FSFW from compilation. # Options to exclude parts of the FSFW from compilation.
option(FSFW_USE_RMAP "Compile with RMAP" ON) option(FSFW_USE_RMAP "Compile with RMAP" ON)
@ -36,8 +48,14 @@ add_subdirectory(action)
add_subdirectory(container) add_subdirectory(container)
add_subdirectory(controller) add_subdirectory(controller)
add_subdirectory(coordinates) add_subdirectory(coordinates)
add_subdirectory(datalinklayer)
if(FSFW_USE_DATALINKLAYER)
add_subdirectory(datalinklayer)
endif()
add_subdirectory(datapool) add_subdirectory(datapool)
add_subdirectory(datapoollocal)
add_subdirectory(housekeeping)
add_subdirectory(devicehandlers) add_subdirectory(devicehandlers)
add_subdirectory(events) add_subdirectory(events)
add_subdirectory(fdir) add_subdirectory(fdir)
@ -55,7 +73,7 @@ add_subdirectory(power)
add_subdirectory(pus) add_subdirectory(pus)
if(FSFW_USE_RMAP) if(FSFW_USE_RMAP)
add_subdirectory(rmap) add_subdirectory(rmap)
endif() endif()
add_subdirectory(serialize) add_subdirectory(serialize)
@ -73,13 +91,53 @@ add_subdirectory(tmtcservices)
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # 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 this is not given, we include the default configuration and emit a warning.
if(NOT FSFW_CONFIG_PATH) if(NOT FSFW_CONFIG_PATH)
message(WARNING "Flight Software Framework configuration path not set!") message(WARNING "Flight Software Framework configuration path not set!")
message(WARNING "Setting default configuration!") message(WARNING "Setting default configuration!")
add_subdirectory(defaultcfg/fsfwconfig) 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} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
)
endif()
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() endif()
# Required include paths to compile the FSFW # Required include paths to compile the FSFW
target_include_directories(${LIB_FSFW_NAME} target_include_directories(${LIB_FSFW_NAME} INTERFACE
INTERFACE ${CMAKE_SOURCE_DIR}
${FSFW_CONFIG_PATH} ${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}
)
# Machine specific options can be set with the ABI_FLAGS variable.
target_compile_options(${LIB_FSFW_NAME} PRIVATE
${WARNING_FLAGS}
${COMPILER_FLAGS}
${ABI_FLAGS}
) )

View File

@ -1,7 +1,9 @@
#ifndef SGP4PROPAGATOR_H_ #ifndef SGP4PROPAGATOR_H_
#define SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_
#ifndef WIN32
#include <sys/time.h> #include <sys/time.h>
#endif
#include "../contrib/sgp4/sgp4unit.h" #include "../contrib/sgp4/sgp4unit.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"

View File

@ -1,11 +1,6 @@
target_sources(${LIB_FSFW_NAME} target_sources(${LIB_FSFW_NAME}
PRIVATE PRIVATE
ControllerSet.cpp
DataPool.cpp
DataPoolAdmin.cpp
DataPoolParameterWrapper.cpp
DataSet.cpp
HkSwitchHelper.cpp HkSwitchHelper.cpp
PoolDataSetBase.cpp
PoolEntry.cpp PoolEntry.cpp
PoolRawAccess.cpp
) )

View File

@ -0,0 +1,8 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
LocalDataPoolManager.cpp
LocalDataSet.cpp
LocalPoolDataSetBase.cpp
LocalPoolObjectBase.cpp
SharedLocalDataSet.cpp
)

View File

@ -1,6 +1,5 @@
target_sources(${LIB_FSFW_NAME} target_sources(${LIB_FSFW_NAME}
PRIVATE PRIVATE
Event.cpp
EventManager.cpp EventManager.cpp
EventMessage.cpp EventMessage.cpp
) )

View File

@ -2,7 +2,12 @@
#define TIMEVALOPERATIONS_H_ #define TIMEVALOPERATIONS_H_
#include <stdint.h> #include <stdint.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/time.h> #include <sys/time.h>
#endif
timeval& operator+=(timeval& lhs, const timeval& rhs); timeval& operator+=(timeval& lhs, const timeval& rhs);

View File

@ -0,0 +1,5 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
HousekeepingMessage.cpp
PeriodicHousekeepingHelper.cpp
)

View File

@ -22,9 +22,23 @@
#else #else
#error "Can't decide which end is which!" #error "Can't decide which end is which!"
#endif #endif
#else
#ifdef WIN32
#include <Windows.h>
#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN
#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN
#else
#define BYTE_ORDER_SYSTEM BIG_ENDIAN
#endif
#else #else
#error __BYTE_ORDER__ not defined #error __BYTE_ORDER__ not defined
#endif #endif
#endif
#endif #endif

View File

@ -0,0 +1,30 @@
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
SemaphoreFactory.cpp
TaskFactory.cpp
Timekeeper.cpp
TaskManagement.cpp
)
# 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})

View File

@ -13,9 +13,9 @@ target_sources(${LIB_FSFW_NAME}
) )
if(UNIX) if(UNIX)
add_definitions(-pthread)
target_link_libraries(${LIB_FSFW_NAME} target_link_libraries(${LIB_FSFW_NAME}
PRIVATE PRIVATE
rt rt
pthread
) )
endif() endif()

View File

@ -119,7 +119,7 @@ void TcWinUdpPollingTask::setTimeout(double timeoutSeconds) {
int result = setsockopt(serverUdpSocket, SOL_SOCKET, SO_RCVTIMEO, int result = setsockopt(serverUdpSocket, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<const char*>(&timeoutMs), sizeof(DWORD)); reinterpret_cast<const char*>(&timeoutMs), sizeof(DWORD));
if(result == -1) { if(result == -1) {
sif::error << "TcSocketPollingTask::TcSocketPollingTask: Setting " sif::error << "TcWinUdpPollingTask::TcSocketPollingTask: Setting "
"receive timeout failed with " << strerror(errno) << std::endl; "receive timeout failed with " << strerror(errno) << std::endl;
} }
} }
@ -128,17 +128,22 @@ void TcWinUdpPollingTask::handleReadError() {
int error = WSAGetLastError(); int error = WSAGetLastError();
switch(error) { switch(error) {
case(WSANOTINITIALISED): { case(WSANOTINITIALISED): {
sif::info << "TmTcWinUdpBridge::handleReadError: WSANOTINITIALISED: " sif::info << "TcWinUdpPollingTask::handleReadError: WSANOTINITIALISED: "
<< "WSAStartup(...) call " << "necessary" << std::endl; << "WSAStartup(...) call " << "necessary" << std::endl;
break; break;
} }
case(WSAEFAULT): { case(WSAEFAULT): {
sif::info << "TmTcWinUdpBridge::handleReadError: WSADEFAULT: " sif::info << "TcWinUdpPollingTask::handleReadError: WSADEFAULT: "
<< "Bad address " << std::endl; << "Bad address " << std::endl;
break; break;
} }
case(WSAEINVAL): {
sif::info << "TcWinUdpPollingTask::handleReadError: WSAEINVAL: "
<< "Invalid input parameters. " << std::endl;
break;
}
default: { default: {
sif::info << "TmTcWinUdpBridge::handleReadError: Error code: " sif::info << "TcWinUdpPollingTask::handleReadError: Error code: "
<< error << std::endl; << error << std::endl;
break; break;
} }

View File

@ -2,4 +2,6 @@ target_sources(${LIB_FSFW_NAME}
PRIVATE PRIVATE
ConstStorageAccessor.cpp ConstStorageAccessor.cpp
StorageAccessor.cpp StorageAccessor.cpp
LocalPool.cpp
PoolManager.cpp
) )

View File

@ -1,10 +1,10 @@
target_sources(${LIB_FSFW_NAME} target_sources(${LIB_FSFW_NAME}
PRIVATE PRIVATE
AbstractTemperatureSensor.cpp AbstractTemperatureSensor.cpp
CoreComponent.cpp
Heater.cpp Heater.cpp
RedundantHeater.cpp RedundantHeater.cpp
ThermalComponentCore.cpp
ThermalComponent.cpp ThermalComponent.cpp
ThermalModule.cpp ThermalModule.cpp
ThermalMonitor.cpp ThermalMonitorReporter.cpp
) )

View File

@ -7,7 +7,12 @@
#include "../globalfunctions/timevalOperations.h" #include "../globalfunctions/timevalOperations.h"
#include <cstdint> #include <cstdint>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/time.h> #include <sys/time.h>
#endif
class Clock { class Clock {
public: public: