diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ba73a3f..4ff504f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,12 +43,12 @@ endif() set(FSFW_OSAL_DEFINITION FSFW_HOST) -if(${OS_FSFW} STREQUAL host) +if(OS_FSFW MATCHES host) set(OS_FSFW_NAME "Host") -elseif(${OS_FSFW} STREQUAL linux) +elseif(OS_FSFW MATCHES linux) set(OS_FSFW_NAME "Linux") set(FSFW_OSAL_DEFINITION FSFW_LINUX) -elseif(${OS_FSFW} STREQUAL freertos) +elseif(OS_FSFW MATCHES freertos) set(OS_FSFW_NAME "FreeRTOS") set(FSFW_OSAL_DEFINITION FSFW_FREERTOS) target_link_libraries(${LIB_FSFW_NAME} PRIVATE diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/osal/FreeRTOS/BinSemaphUsingTask.h index ec434853..895ccefb 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.h +++ b/osal/FreeRTOS/BinSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/BinarySemaphore.h b/osal/FreeRTOS/BinarySemaphore.h index 8969d503..2335292b 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/osal/FreeRTOS/BinarySemaphore.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS Tool to achieve synchronization of between tasks or between diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt index 4da24a71..40bdcd0f 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/osal/FreeRTOS/CMakeLists.txt @@ -22,10 +22,11 @@ target_sources(${LIB_FSFW_NAME} # 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" + message(STATUS + "LIB_OS_NAME is empty. Make sure to include the FreeRTOS header path properly." ) +else() + target_link_libraries(${LIB_FSFW_NAME} PRIVATE + ${LIB_OS_NAME} + ) endif() - -target_link_libraries(${LIB_FSWFW_NAME} ${LIB_OS_NAME}) \ No newline at end of file diff --git a/osal/FreeRTOS/Clock.cpp b/osal/FreeRTOS/Clock.cpp index 66207d75..a81f6985 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/osal/FreeRTOS/Clock.cpp @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" #include "../../globalfunctions/timevalOperations.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include #include diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/osal/FreeRTOS/CountingSemaphUsingTask.h index 45915b6b..9ac99c31 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.h +++ b/osal/FreeRTOS/CountingSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "CountingSemaphUsingTask.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/CountingSemaphore.cpp b/osal/FreeRTOS/CountingSemaphore.cpp index 40884d27..148803a6 100644 --- a/osal/FreeRTOS/CountingSemaphore.cpp +++ b/osal/FreeRTOS/CountingSemaphore.cpp @@ -3,7 +3,8 @@ #include "../../serviceinterface/ServiceInterfaceStream.h" -#include +#include "FreeRTOS.h" +#include "semphr.h" // Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in // free FreeRTOSConfig.h file. diff --git a/osal/FreeRTOS/FixedTimeslotTask.h b/osal/FreeRTOS/FixedTimeslotTask.h index f2245ba4..7494581c 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.h +++ b/osal/FreeRTOS/FixedTimeslotTask.h @@ -6,8 +6,8 @@ #include "../../tasks/FixedTimeslotTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/FreeRTOSTaskIF.h b/osal/FreeRTOS/FreeRTOSTaskIF.h index 2a2d9494..08f0df25 100644 --- a/osal/FreeRTOS/FreeRTOSTaskIF.h +++ b/osal/FreeRTOS/FreeRTOSTaskIF.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ #define FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index be74d4fe..58324cc6 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -6,10 +6,11 @@ #include "../../internalError/InternalErrorReporterIF.h" #include "../../ipc/MessageQueueIF.h" #include "../../ipc/MessageQueueMessageIF.h" +#include "../../ipc/MessageQueueMessage.h" + +#include "FreeRTOS.h" +#include "queue.h" -#include -#include -#include /** * @brief This class manages sending and receiving of diff --git a/osal/FreeRTOS/Mutex.h b/osal/FreeRTOS/Mutex.h index 156d431c..877359d8 100644 --- a/osal/FreeRTOS/Mutex.h +++ b/osal/FreeRTOS/Mutex.h @@ -3,8 +3,8 @@ #include "../../ipc/MutexIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS component to implement MUTual EXclusion diff --git a/osal/FreeRTOS/PeriodicTask.h b/osal/FreeRTOS/PeriodicTask.h index 36ef568f..04d40fcf 100644 --- a/osal/FreeRTOS/PeriodicTask.h +++ b/osal/FreeRTOS/PeriodicTask.h @@ -6,8 +6,8 @@ #include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h index 91a839f0..07ca8b9e 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/osal/FreeRTOS/QueueMapManager.h @@ -5,8 +5,8 @@ #include "../../ipc/messageQueueDefinitions.h" #include "../../ipc/MessageQueueIF.h" -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" +#include "FreeRTOS.h" +#include "queue.h" #include diff --git a/osal/FreeRTOS/SemaphoreFactory.cpp b/osal/FreeRTOS/SemaphoreFactory.cpp index df005f6a..614af75d 100644 --- a/osal/FreeRTOS/SemaphoreFactory.cpp +++ b/osal/FreeRTOS/SemaphoreFactory.cpp @@ -1,9 +1,10 @@ -#include "../../osal/FreeRTOS/BinarySemaphore.h" -#include "../../osal/FreeRTOS/BinSemaphUsingTask.h" -#include "../../osal/FreeRTOS/CountingSemaphore.h" -#include "../../osal/FreeRTOS/CountingSemaphUsingTask.h" +#include "BinarySemaphore.h" +#include "BinSemaphUsingTask.h" +#include "CountingSemaphore.h" +#include "CountingSemaphUsingTask.h" + #include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/osal/FreeRTOS/TaskManagement.h b/osal/FreeRTOS/TaskManagement.h index b9aece48..9aa10797 100644 --- a/osal/FreeRTOS/TaskManagement.h +++ b/osal/FreeRTOS/TaskManagement.h @@ -1,10 +1,10 @@ -#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ -#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#ifndef FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#define FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ #include "../../returnvalues/HasReturnvaluesIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/Timekeeper.cpp b/osal/FreeRTOS/Timekeeper.cpp index d986d832..1031f0c4 100644 --- a/osal/FreeRTOS/Timekeeper.cpp +++ b/osal/FreeRTOS/Timekeeper.cpp @@ -1,6 +1,6 @@ #include "Timekeeper.h" -#include +#include "FreeRTOSConfig.h" Timekeeper * Timekeeper::myinstance = nullptr; diff --git a/osal/FreeRTOS/Timekeeper.h b/osal/FreeRTOS/Timekeeper.h index 7d583f7d..d4d0bc07 100644 --- a/osal/FreeRTOS/Timekeeper.h +++ b/osal/FreeRTOS/Timekeeper.h @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" /** diff --git a/osal/linux/PeriodicPosixTask.cpp b/osal/linux/PeriodicPosixTask.cpp index 1cba22ee..c0152bec 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/osal/linux/PeriodicPosixTask.cpp @@ -32,7 +32,7 @@ ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) { sif::error << "PeriodicTask::addComponent: Invalid object. Make sure" << " it implements ExecutableObjectIF!" << std::endl; #else - sif::printError("PeriodicTask::addComponent: Invalid object. Make sure it" + sif::printError("PeriodicTask::addComponent: Invalid object. Make sure it " "implements ExecutableObjectIF!\n"); #endif return HasReturnvaluesIF::RETURN_FAILED; diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp index 334da4e7..d2b19206 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -8,7 +8,7 @@ TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { } void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, - uint8_t ack, uint8_t service, uint8_t subservice) { + uint8_t ack, uint8_t service, uint8_t subservice, uint16_t sourceId) { initSpacePacketHeader(true, true, apid, sequenceCount); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); @@ -18,6 +18,12 @@ void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, tcData->dataField.versionTypeAck |= (ack & 0x0F); tcData->dataField.serviceType = service; tcData->dataField.serviceSubtype = subservice; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + tcData->dataField.sourceIdH = (sourceId >> 8) | 0xff; + tcData->dataField.sourceIdL = sourceId & 0xff; +#else + tcData->dataField.sourceId = sourceId; +#endif } uint8_t TcPacketPus::getService() const { diff --git a/tmtcpacket/pus/tc/TcPacketPus.h b/tmtcpacket/pus/tc/TcPacketPus.h index b50b868d..7a28a957 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.h +++ b/tmtcpacket/pus/tc/TcPacketPus.h @@ -75,7 +75,7 @@ protected: * @param subservice PUS Subservice */ void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, - uint8_t service, uint8_t subservice); + uint8_t service, uint8_t subservice, uint16_t sourceId = 0); /** * A pointer to a structure which defines the data structure of