From ae4305e22e53f915a09bc7b23259ec05bd993394 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Nov 2020 18:10:39 +0100 Subject: [PATCH] restructured.. a bit --- Makefile | 6 +- Makefile-Hosted | 2 +- {mission/core => bsp_linux}/InitMission.cpp | 9 +- bsp_linux/InitMission.h | 9 + {mission/core => bsp_linux}/ObjectFactory.cpp | 29 +--- {mission/core => bsp_linux}/ObjectFactory.h | 6 +- bsp_linux/main.cpp | 7 +- config/tmtc/tmTcSize.h | 10 -- config/version.h | 9 - {hosted/config => fsfwconfig}/FSFWConfig.h | 6 +- {config => fsfwconfig}/OBSWConfig.h | 8 +- fsfwconfig/OBSWVersion.h | 12 ++ .../cdatapool/dataPoolInit.cpp | 2 +- .../cdatapool/dataPoolInit.h | 6 +- .../devices/logicalAddresses.cpp | 2 +- .../devices/logicalAddresses.h | 8 +- .../devices/powerSwitcherList.cpp | 2 +- .../devices/powerSwitcherList.h | 6 +- .../events/subsystemIdRanges.h | 6 +- .../events/translateEvents.cpp | 2 +- .../events/translateEvents.h | 6 +- config/config.mk => fsfwconfig/fsfwconfig.mk | 0 .../ipc/MissionMessageTypes.cpp | 2 +- .../ipc/MissionMessageTypes.h | 6 +- .../objects/systemObjectList.h | 0 .../objects/translateObjects.cpp | 2 +- .../objects/translateObjects.h | 6 +- .../PollingSequenceFactory.cpp | 5 +- .../pollingsequence/PollingSequenceFactory.h | 0 .../returnvalues/classIds.h | 6 +- {config => fsfwconfig}/tmtc/apid.h | 6 +- {config => fsfwconfig}/tmtc/pusIds.h | 0 fsfwconfig/tmtc/tmTcSize.h | 10 ++ hosted/InitMission.cpp | 159 ++++++++++++++++++ hosted/InitMission.h | 9 + hosted/ObjectFactory.cpp | 61 +++++++ hosted/ObjectFactory.h | 17 ++ hosted/config/version.h | 9 - {config => hosted/fsfwconfig}/FSFWConfig.h | 0 hosted/{config => fsfwconfig}/OBSWConfig.h | 0 hosted/fsfwconfig/OBSWVersion.h | 12 ++ .../events/subsystemIdRanges.h | 0 .../config.mk => fsfwconfig/fsfwconfig.mk} | 0 .../ipc/MissionMessageTypes.cpp | 2 +- .../fsfwconfig}/ipc/MissionMessageTypes.h | 0 .../fsfwconfig}/returnvalues/classIds.h | 0 hosted/main.cpp | 8 +- mission/core/GenericFactory.cpp | 83 +++++++++ mission/core/GenericFactory.h | 12 ++ mission/core/InitMission.h | 9 - 50 files changed, 455 insertions(+), 122 deletions(-) rename {mission/core => bsp_linux}/InitMission.cpp (97%) create mode 100644 bsp_linux/InitMission.h rename {mission/core => bsp_linux}/ObjectFactory.cpp (85%) rename {mission/core => bsp_linux}/ObjectFactory.h (56%) delete mode 100644 config/tmtc/tmTcSize.h delete mode 100644 config/version.h rename {hosted/config => fsfwconfig}/FSFWConfig.h (94%) rename {config => fsfwconfig}/OBSWConfig.h (67%) create mode 100644 fsfwconfig/OBSWVersion.h rename {config => fsfwconfig}/cdatapool/dataPoolInit.cpp (62%) rename {config => fsfwconfig}/cdatapool/dataPoolInit.h (55%) rename {config => fsfwconfig}/devices/logicalAddresses.cpp (52%) rename {config => fsfwconfig}/devices/logicalAddresses.h (60%) rename {config => fsfwconfig}/devices/powerSwitcherList.cpp (50%) rename {config => fsfwconfig}/devices/powerSwitcherList.h (54%) rename {config => fsfwconfig}/events/subsystemIdRanges.h (73%) rename {config => fsfwconfig}/events/translateEvents.cpp (99%) rename {config => fsfwconfig}/events/translateEvents.h (53%) rename config/config.mk => fsfwconfig/fsfwconfig.mk (100%) rename {config => fsfwconfig}/ipc/MissionMessageTypes.cpp (78%) rename {hosted/config => fsfwconfig}/ipc/MissionMessageTypes.h (73%) rename {config => fsfwconfig}/objects/systemObjectList.h (100%) rename {config => fsfwconfig}/objects/translateObjects.cpp (96%) rename {config => fsfwconfig}/objects/translateObjects.h (55%) rename {config => fsfwconfig}/pollingsequence/PollingSequenceFactory.cpp (90%) rename {config => fsfwconfig}/pollingsequence/PollingSequenceFactory.h (100%) rename {hosted/config => fsfwconfig}/returnvalues/classIds.h (67%) rename {config => fsfwconfig}/tmtc/apid.h (77%) rename {config => fsfwconfig}/tmtc/pusIds.h (100%) create mode 100644 fsfwconfig/tmtc/tmTcSize.h create mode 100644 hosted/InitMission.cpp create mode 100644 hosted/InitMission.h create mode 100644 hosted/ObjectFactory.cpp create mode 100644 hosted/ObjectFactory.h delete mode 100644 hosted/config/version.h rename {config => hosted/fsfwconfig}/FSFWConfig.h (100%) rename hosted/{config => fsfwconfig}/OBSWConfig.h (100%) create mode 100644 hosted/fsfwconfig/OBSWVersion.h rename hosted/{config => fsfwconfig}/events/subsystemIdRanges.h (100%) rename hosted/{config/config.mk => fsfwconfig/fsfwconfig.mk} (100%) rename hosted/{config => fsfwconfig}/ipc/MissionMessageTypes.cpp (75%) rename {config => hosted/fsfwconfig}/ipc/MissionMessageTypes.h (100%) rename {config => hosted/fsfwconfig}/returnvalues/classIds.h (100%) create mode 100644 mission/core/GenericFactory.cpp create mode 100644 mission/core/GenericFactory.h delete mode 100644 mission/core/InitMission.h diff --git a/Makefile b/Makefile index df94de6f..c02a9067 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ CUSTOM_DEFINES += -DLINUX # General folder paths FRAMEWORK_PATH = fsfw MISSION_PATH = mission -CONFIG_PATH = config +CONFIG_PATH = fsfwconfig TEST_PATH = test UNITTEST_PATH = unittest @@ -70,7 +70,11 @@ CLEANBIN2 = $(BUILDPATH)/$(OUTPUT_FOLDER)/devel #------------------------------------------------------------------------------- # Tool suffix when cross-compiling +ifdef HOST_LINUX +CROSS_COMPILE = +else CROSS_COMPILE = arm-linux-gnueabihf- +endif ifdef WINDOWS # C Compiler diff --git a/Makefile-Hosted b/Makefile-Hosted index 50953643..bb56fec5 100644 --- a/Makefile-Hosted +++ b/Makefile-Hosted @@ -58,7 +58,7 @@ endif # General folder paths FRAMEWORK_PATH = fsfw MISSION_PATH = mission -CONFIG_PATH = $(BOARD_FILE_ROOT)/config +CONFIG_PATH = $(BOARD_FILE_ROOT)/fsfwconfig TEST_PATH = test UNITTEST_PATH = unittest diff --git a/mission/core/InitMission.cpp b/bsp_linux/InitMission.cpp similarity index 97% rename from mission/core/InitMission.cpp rename to bsp_linux/InitMission.cpp index be16750d..cf84ab0d 100644 --- a/mission/core/InitMission.cpp +++ b/bsp_linux/InitMission.cpp @@ -1,8 +1,5 @@ -#include "InitMission.h" - -#include -#include -#include +#include +#include #include #include @@ -12,6 +9,8 @@ #include #include #include +#include +#include #include diff --git a/bsp_linux/InitMission.h b/bsp_linux/InitMission.h new file mode 100644 index 00000000..5ecf9e41 --- /dev/null +++ b/bsp_linux/InitMission.h @@ -0,0 +1,9 @@ +#ifndef BSP_LINUX_INITMISSION_H_ +#define BSP_LINUX_INITMISSION_H_ + +namespace InitMission { +void initMission(); +void initTasks(); +}; + +#endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/mission/core/ObjectFactory.cpp b/bsp_linux/ObjectFactory.cpp similarity index 85% rename from mission/core/ObjectFactory.cpp rename to bsp_linux/ObjectFactory.cpp index 78b4de6f..d08912bb 100644 --- a/mission/core/ObjectFactory.cpp +++ b/bsp_linux/ObjectFactory.cpp @@ -1,9 +1,8 @@ #include "ObjectFactory.h" - -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -23,22 +22,13 @@ #include #include #include -#include -#ifdef LINUX #include #include -#elif WIN32 -#include -#include -#endif #include -#if ADD_TEST_CODE == 1 -//#include -//#include +#if OBSW_ADD_TEST_CODE == 1 #include -//#include #endif void Factory::setStaticFrameworkObjectIds(){ @@ -99,11 +89,9 @@ void ObjectFactory::produce(){ /* TMTC Reception via UDP socket */ new TmFunnel(objects::TM_FUNNEL); - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); /* PUS stack */ @@ -123,12 +111,7 @@ void ObjectFactory::produce(){ apid::EIVE_OBSW, pus::PUS_SERVICE_200); /* Test Device Handler */ -#if ADD_TEST_CODE == 1 +#if OBSW_ADD_TEST_CODE == 1 new TestTask(objects::TEST_TASK); -// CookieIF* testCookie = new TestCookie(0); -// new TestEchoComIF(objects::TEST_ECHO_COM_IF); -// new TestDevice(objects::TEST_DEVICE_HANDLER, objects::TEST_ECHO_COM_IF, -// testCookie, true); - new ArduinoComIF(objects::ARDUINO_COM_IF, true, nullptr); #endif } diff --git a/mission/core/ObjectFactory.h b/bsp_linux/ObjectFactory.h similarity index 56% rename from mission/core/ObjectFactory.h rename to bsp_linux/ObjectFactory.h index 9bf0d688..f7fa81ac 100644 --- a/mission/core/ObjectFactory.h +++ b/bsp_linux/ObjectFactory.h @@ -5,8 +5,8 @@ * Author: steffen */ -#ifndef MISSION_CORE_OBJECTFACTORY_H_ -#define MISSION_CORE_OBJECTFACTORY_H_ +#ifndef BSP_LINUX_OBJECTFACTORY_H_ +#define BSP_LINUX_OBJECTFACTORY_H_ namespace ObjectFactory { @@ -14,4 +14,4 @@ namespace ObjectFactory { void produce(); }; -#endif /* MISSION_CORE_OBJECTFACTORY_H_ */ +#endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/bsp_linux/main.cpp b/bsp_linux/main.cpp index a2bd4fbf..a8e34769 100644 --- a/bsp_linux/main.cpp +++ b/bsp_linux/main.cpp @@ -1,12 +1,13 @@ + #if defined(GCOV) #include #endif -#include +#include #include #include -#include +#include #include /** @@ -19,7 +20,7 @@ int main(void) std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- Compiled for Linux " << " --" << std::endl; std::cout << "-- Software version v" << SW_VERSION << "." << SW_SUBVERSION - << " -- " << std::endl; + << "." << SW_SUBSUBVERSION << " -- " << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; InitMission::initMission(); diff --git a/config/tmtc/tmTcSize.h b/config/tmtc/tmTcSize.h deleted file mode 100644 index de7f4adc..00000000 --- a/config/tmtc/tmTcSize.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CONFIG_TMTC_TMTCSIZE_H_ -#define CONFIG_TMTC_TMTCSIZE_H_ - -#include - -namespace tmtcsize { -static const uint32_t MAX_TM_PACKET = 50; -} - -#endif /* CONFIG_TMTC_TMTCSIZE_H_ */ diff --git a/config/version.h b/config/version.h deleted file mode 100644 index 386cbc09..00000000 --- a/config/version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CONFIG_VERSION_H_ -#define CONFIG_VERSION_H_ - -#define SW_VERSION 0 -#define SW_SUBVERSION 1 - - - -#endif /* CONFIG_VERSION_H_ */ diff --git a/hosted/config/FSFWConfig.h b/fsfwconfig/FSFWConfig.h similarity index 94% rename from hosted/config/FSFWConfig.h rename to fsfwconfig/FSFWConfig.h index ea86152c..fe97ee6e 100644 --- a/hosted/config/FSFWConfig.h +++ b/fsfwconfig/FSFWConfig.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_FSFWCONFIG_H_ -#define CONFIG_FSFWCONFIG_H_ +#ifndef FSFWCONFIG_FSFWCONFIG_H_ +#define FSFWCONFIG_FSFWCONFIG_H_ #include #include @@ -51,4 +51,4 @@ static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; } -#endif /* CONFIG_FSFWCONFIG_H_ */ +#endif /* FSFWCONFIG_FSFWCONFIG_H_ */ diff --git a/config/OBSWConfig.h b/fsfwconfig/OBSWConfig.h similarity index 67% rename from config/OBSWConfig.h rename to fsfwconfig/OBSWConfig.h index 7a569b87..6d181093 100644 --- a/config/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -3,12 +3,12 @@ * code inclusion exclusion or various other project constants and * properties in one place. */ -#ifndef CONFIG_OBSWCONFIG_H_ -#define CONFIG_OBSWCONFIG_H_ +#ifndef FSFWCONFIG_OBSWCONFIG_H_ +#define FSFWCONFIG_OBSWCONFIG_H_ -#define OBSW_ADD_TEST_CODE 1 +#define OBSW_ADD_TEST_CODE 0 // Define not used yet, PUS stack and TMTC tasks are always started #define ADD_PUS_STACK 1 -#endif /* CONFIG_OBSWCONFIG_H_ */ +#endif /* FSFWCONFIG_OBSWCONFIG_H_ */ diff --git a/fsfwconfig/OBSWVersion.h b/fsfwconfig/OBSWVersion.h new file mode 100644 index 00000000..e1afa204 --- /dev/null +++ b/fsfwconfig/OBSWVersion.h @@ -0,0 +1,12 @@ +#ifndef FSFWCONFIG_OBSWVERSION_H_ +#define FSFWCONFIG_OBSWVERSION_H_ + +const char* const SW_NAME = "eive"; + +#define SW_VERSION 0 +#define SW_SUBVERSION 2 +#define SW_SUBSUBVERSION 0 + + + +#endif /* FSFWCONFIG_OBSWVERSION_H_ */ diff --git a/config/cdatapool/dataPoolInit.cpp b/fsfwconfig/cdatapool/dataPoolInit.cpp similarity index 62% rename from config/cdatapool/dataPoolInit.cpp rename to fsfwconfig/cdatapool/dataPoolInit.cpp index 80840724..fd536af5 100644 --- a/config/cdatapool/dataPoolInit.cpp +++ b/fsfwconfig/cdatapool/dataPoolInit.cpp @@ -1,4 +1,4 @@ -#include "dataPoolInit.h" +#include void datapool::dataPoolInit(std::map* poolMap) { diff --git a/config/cdatapool/dataPoolInit.h b/fsfwconfig/cdatapool/dataPoolInit.h similarity index 55% rename from config/cdatapool/dataPoolInit.h rename to fsfwconfig/cdatapool/dataPoolInit.h index 915bd11f..f97fe7a3 100644 --- a/config/cdatapool/dataPoolInit.h +++ b/fsfwconfig/cdatapool/dataPoolInit.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_CDATAPOOL_DATAPOOLINIT_H_ -#define CONFIG_CDATAPOOL_DATAPOOLINIT_H_ +#ifndef FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_ +#define FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_ #include @@ -10,4 +10,4 @@ namespace datapool{ NO_PARAMETER = 0, }; } -#endif /* CONFIG_CDATAPOOL_DATAPOOLINIT_H_ */ +#endif /* FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_ */ diff --git a/config/devices/logicalAddresses.cpp b/fsfwconfig/devices/logicalAddresses.cpp similarity index 52% rename from config/devices/logicalAddresses.cpp rename to fsfwconfig/devices/logicalAddresses.cpp index 20cabdb1..a6f0aa15 100644 --- a/config/devices/logicalAddresses.cpp +++ b/fsfwconfig/devices/logicalAddresses.cpp @@ -4,7 +4,7 @@ * \date 06.11.2019 */ -#include "logicalAddresses.h" +#include diff --git a/config/devices/logicalAddresses.h b/fsfwconfig/devices/logicalAddresses.h similarity index 60% rename from config/devices/logicalAddresses.h rename to fsfwconfig/devices/logicalAddresses.h index 58683bee..922c9ce1 100644 --- a/config/devices/logicalAddresses.h +++ b/fsfwconfig/devices/logicalAddresses.h @@ -4,11 +4,11 @@ * \date 07.11.2019 */ -#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_ -#define CONFIG_DEVICES_LOGICALADDRESSES_H_ +#ifndef FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_ +#define FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_ #include -#include #include +#include namespace addresses { /* Logical addresses have uint32_t datatype */ @@ -23,4 +23,4 @@ namespace addresses { } -#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */ +#endif /* FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_ */ diff --git a/config/devices/powerSwitcherList.cpp b/fsfwconfig/devices/powerSwitcherList.cpp similarity index 50% rename from config/devices/powerSwitcherList.cpp rename to fsfwconfig/devices/powerSwitcherList.cpp index 24679907..a7603185 100644 --- a/config/devices/powerSwitcherList.cpp +++ b/fsfwconfig/devices/powerSwitcherList.cpp @@ -4,7 +4,7 @@ * @date 28.11.2019 */ -#include "powerSwitcherList.h" +#include diff --git a/config/devices/powerSwitcherList.h b/fsfwconfig/devices/powerSwitcherList.h similarity index 54% rename from config/devices/powerSwitcherList.h rename to fsfwconfig/devices/powerSwitcherList.h index 2d10ae8d..98f7af8d 100644 --- a/config/devices/powerSwitcherList.h +++ b/fsfwconfig/devices/powerSwitcherList.h @@ -4,8 +4,8 @@ * @date 28.11.2019 */ -#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_ -#define CONFIG_DEVICES_POWERSWITCHERLIST_H_ +#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ +#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ namespace switches { /* Switches are uint8_t datatype and go from 0 to 255 */ @@ -19,4 +19,4 @@ namespace switches { } -#endif /* CONFIG_DEVICES_POWERSWITCHERLIST_H_ */ +#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */ diff --git a/config/events/subsystemIdRanges.h b/fsfwconfig/events/subsystemIdRanges.h similarity index 73% rename from config/events/subsystemIdRanges.h rename to fsfwconfig/events/subsystemIdRanges.h index 2c3ff90d..ece990b2 100644 --- a/config/events/subsystemIdRanges.h +++ b/fsfwconfig/events/subsystemIdRanges.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ -#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ +#ifndef FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ +#define FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #include #include @@ -21,4 +21,4 @@ enum: uint8_t { }; } -#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */ +#endif /* FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */ diff --git a/config/events/translateEvents.cpp b/fsfwconfig/events/translateEvents.cpp similarity index 99% rename from config/events/translateEvents.cpp rename to fsfwconfig/events/translateEvents.cpp index f955a56f..49e1223a 100644 --- a/config/events/translateEvents.cpp +++ b/fsfwconfig/events/translateEvents.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated event translation file. Contains 80 translations. * Generated on: 2020-05-02 20:13:41 */ -#include "translateEvents.h" +#include const char *GPS_STARTUP_FAILED_STRING = "GPS_STARTUP_FAILED"; const char *GPS_FIX_STRING = "GPS_FIX"; diff --git a/config/events/translateEvents.h b/fsfwconfig/events/translateEvents.h similarity index 53% rename from config/events/translateEvents.h rename to fsfwconfig/events/translateEvents.h index 0e40ef8b..e7a88326 100644 --- a/config/events/translateEvents.h +++ b/fsfwconfig/events/translateEvents.h @@ -5,12 +5,12 @@ * Author: Robin */ -#ifndef CONFIG_EVENTS_TRANSLATEEVENTS_H_ -#define CONFIG_EVENTS_TRANSLATEEVENTS_H_ +#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ +#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ #include const char * translateEvents(Event event); -#endif /* CONFIG_EVENTS_TRANSLATEEVENTS_H_ */ +#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */ diff --git a/config/config.mk b/fsfwconfig/fsfwconfig.mk similarity index 100% rename from config/config.mk rename to fsfwconfig/fsfwconfig.mk diff --git a/config/ipc/MissionMessageTypes.cpp b/fsfwconfig/ipc/MissionMessageTypes.cpp similarity index 78% rename from config/ipc/MissionMessageTypes.cpp rename to fsfwconfig/ipc/MissionMessageTypes.cpp index 3eef97fc..8536245f 100644 --- a/config/ipc/MissionMessageTypes.cpp +++ b/fsfwconfig/ipc/MissionMessageTypes.cpp @@ -1,5 +1,5 @@ -#include "MissionMessageTypes.h" #include +#include void messagetypes::clearMissionMessage(CommandMessage* message) { // switch(message->getMessageType()) { diff --git a/hosted/config/ipc/MissionMessageTypes.h b/fsfwconfig/ipc/MissionMessageTypes.h similarity index 73% rename from hosted/config/ipc/MissionMessageTypes.h rename to fsfwconfig/ipc/MissionMessageTypes.h index 832d8e58..ab2a84b5 100644 --- a/hosted/config/ipc/MissionMessageTypes.h +++ b/fsfwconfig/ipc/MissionMessageTypes.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_ -#define CONFIG_IPC_MISSIONMESSAGETYPES_H_ +#ifndef FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ +#define FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ #include @@ -19,4 +19,4 @@ enum MESSAGE_TYPE { void clearMissionMessage(CommandMessage* message); } -#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */ +#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */ diff --git a/config/objects/systemObjectList.h b/fsfwconfig/objects/systemObjectList.h similarity index 100% rename from config/objects/systemObjectList.h rename to fsfwconfig/objects/systemObjectList.h diff --git a/config/objects/translateObjects.cpp b/fsfwconfig/objects/translateObjects.cpp similarity index 96% rename from config/objects/translateObjects.cpp rename to fsfwconfig/objects/translateObjects.cpp index 84e4011c..bfb8fb85 100644 --- a/config/objects/translateObjects.cpp +++ b/fsfwconfig/objects/translateObjects.cpp @@ -1,5 +1,5 @@ /* Auto-generated event translation file. Contains 77 translations. */ -#include +#include const char *AT91_UART2_TEST_TASK_STRING = "AT91_UART2_TEST_TASK"; const char *ARDUINO_0_STRING = "ARDUINO_0"; diff --git a/config/objects/translateObjects.h b/fsfwconfig/objects/translateObjects.h similarity index 55% rename from config/objects/translateObjects.h rename to fsfwconfig/objects/translateObjects.h index 18c237eb..2e5a8c40 100644 --- a/config/objects/translateObjects.h +++ b/fsfwconfig/objects/translateObjects.h @@ -5,12 +5,12 @@ * Author: Robin */ -#ifndef CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ -#define CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ +#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ +#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ #include const char* translateObject(object_id_t object); -#endif /* CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ +#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ diff --git a/config/pollingsequence/PollingSequenceFactory.cpp b/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp similarity index 90% rename from config/pollingsequence/PollingSequenceFactory.cpp rename to fsfwconfig/pollingsequence/PollingSequenceFactory.cpp index dbe13add..22c00034 100644 --- a/config/pollingsequence/PollingSequenceFactory.cpp +++ b/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence) { diff --git a/config/pollingsequence/PollingSequenceFactory.h b/fsfwconfig/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from config/pollingsequence/PollingSequenceFactory.h rename to fsfwconfig/pollingsequence/PollingSequenceFactory.h diff --git a/hosted/config/returnvalues/classIds.h b/fsfwconfig/returnvalues/classIds.h similarity index 67% rename from hosted/config/returnvalues/classIds.h rename to fsfwconfig/returnvalues/classIds.h index f6427a1f..b5835c84 100644 --- a/hosted/config/returnvalues/classIds.h +++ b/fsfwconfig/returnvalues/classIds.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ -#define CONFIG_RETURNVALUES_CLASSIDS_H_ +#ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ +#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ #include @@ -16,4 +16,4 @@ enum { } -#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */ +#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */ diff --git a/config/tmtc/apid.h b/fsfwconfig/tmtc/apid.h similarity index 77% rename from config/tmtc/apid.h rename to fsfwconfig/tmtc/apid.h index 64d3763c..ee2fc7c4 100644 --- a/config/tmtc/apid.h +++ b/fsfwconfig/tmtc/apid.h @@ -1,5 +1,5 @@ -#ifndef CONFIG_TMTC_APID_H_ -#define CONFIG_TMTC_APID_H_ +#ifndef FSFWCONFIG_TMTC_APID_H_ +#define FSFWCONFIG_TMTC_APID_H_ #include @@ -16,4 +16,4 @@ namespace apid { } -#endif /* CONFIG_TMTC_APID_H_ */ +#endif /* FSFWCONFIG_TMTC_APID_H_ */ diff --git a/config/tmtc/pusIds.h b/fsfwconfig/tmtc/pusIds.h similarity index 100% rename from config/tmtc/pusIds.h rename to fsfwconfig/tmtc/pusIds.h diff --git a/fsfwconfig/tmtc/tmTcSize.h b/fsfwconfig/tmtc/tmTcSize.h new file mode 100644 index 00000000..c3c83d31 --- /dev/null +++ b/fsfwconfig/tmtc/tmTcSize.h @@ -0,0 +1,10 @@ +#ifndef FSFWCONFIG_TMTC_TMTCSIZE_H_ +#define FSFWCONFIG_TMTC_TMTCSIZE_H_ + +#include + +namespace tmtcsize { +static const uint32_t MAX_TM_PACKET = 50; +} + +#endif /* FSFWCONFIG_TMTC_TMTCSIZE_H_ */ diff --git a/hosted/InitMission.cpp b/hosted/InitMission.cpp new file mode 100644 index 00000000..8bee1b2e --- /dev/null +++ b/hosted/InitMission.cpp @@ -0,0 +1,159 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// This is configured for linux without \cr +#ifdef LINUX +ServiceInterfaceStream sif::debug("DEBUG"); +ServiceInterfaceStream sif::info("INFO"); +ServiceInterfaceStream sif::warning("WARNING"); +ServiceInterfaceStream sif::error("ERROR", false, false, true); +#else +ServiceInterfaceStream sif::debug("DEBUG", true); +ServiceInterfaceStream sif::info("INFO", true); +ServiceInterfaceStream sif::warning("WARNING", true); +ServiceInterfaceStream sif::error("ERROR", true, false, true); +#endif + +ObjectManagerIF *objectManager = nullptr; + +//Initialize Data Pool +DataPool dataPool(nullptr); + +void InitMission::initMission() { + sif::info << "Building global objects.." << std::endl; + /* Instantiate global object manager and also create all objects */ + objectManager = new ObjectManager(ObjectFactory::produce); + sif::info << "Initializing all objects.." << std::endl; + objectManager->initialize(); + + /* This function creates and starts all tasks */ + initTasks(); +} + +void InitMission::initTasks(){ + /* TMTC Distribution */ + PeriodicTaskIF* TmTcDistributor = TaskFactory::instance()-> + createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.100, nullptr); + ReturnValue_t result = TmTcDistributor->addComponent( + objects::CCSDS_PACKET_DISTRIBUTOR); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = TmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = TmTcDistributor->addComponent(objects::TM_FUNNEL); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Object add component failed" << std::endl; + } + + /* UDP bridge */ + PeriodicTaskIF* UdpBridgeTask = TaskFactory::instance()->createPeriodicTask( + "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.2, nullptr); + result = UdpBridgeTask->addComponent(objects::UDP_BRIDGE); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component UDP Unix Bridge failed" << std::endl; + } + PeriodicTaskIF* UdpPollingTask = TaskFactory::instance()-> + createPeriodicTask("UDP_POLLING", 80, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr); + result = UdpPollingTask->addComponent(objects::UDP_POLLING_TASK); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component UDP Polling failed" << std::endl; + } + + /* PUS Services */ + PeriodicTaskIF* PusVerification = TaskFactory::instance()-> + createPeriodicTask("PUS_VERIF_1", 40, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); + result = PusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusEvents = TaskFactory::instance()-> + createPeriodicTask("PUS_VERIF_1", 60, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); + result = PusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusHighPrio = TaskFactory::instance()-> + createPeriodicTask("PUS_HIGH_PRIO", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.200, nullptr); + result = PusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = PusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusMedPrio = TaskFactory::instance()-> + createPeriodicTask("PUS_HIGH_PRIO", 40, + PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.8, nullptr); + result = PusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = PusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusLowPrio = TaskFactory::instance()-> + createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 1.6, nullptr); + result = PusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + +#if OBSW_ADD_TEST_CODE == 1 + FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()-> + createFixedTimeslotTask("PST_TEST_TASK", 10, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); + result = pst::pollingSequenceTestFunction(TestTimeslotTask); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::createTasks: Test PST initialization " + << "failed!" << std::endl; + } +#endif + + //Main thread sleep + sif::info << "Starting tasks.." << std::endl; + TmTcDistributor->startTask(); + UdpBridgeTask->startTask(); + UdpPollingTask->startTask(); + + PusVerification->startTask(); + PusEvents->startTask(); + PusHighPrio->startTask(); + PusMedPrio->startTask(); + PusLowPrio->startTask(); +#if OBSW_ADD_TEST_CODE == 1 + TestTimeslotTask->startTask(); +#endif + sif::info << "Tasks started.." << std::endl; +} diff --git a/hosted/InitMission.h b/hosted/InitMission.h new file mode 100644 index 00000000..5ecf9e41 --- /dev/null +++ b/hosted/InitMission.h @@ -0,0 +1,9 @@ +#ifndef BSP_LINUX_INITMISSION_H_ +#define BSP_LINUX_INITMISSION_H_ + +namespace InitMission { +void initMission(); +void initTasks(); +}; + +#endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/hosted/ObjectFactory.cpp b/hosted/ObjectFactory.cpp new file mode 100644 index 00000000..dbdb42fa --- /dev/null +++ b/hosted/ObjectFactory.cpp @@ -0,0 +1,61 @@ +#include "ObjectFactory.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifdef LINUX +#include +#include +#elif WIN32 +#include +#include +#endif + +#include + + +#if OBSW_ADD_TEST_CODE == 1 +#include +#endif + +void Factory::setStaticFrameworkObjectIds(){ + PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; + PusServiceBase::packetDestination = objects::TM_FUNNEL; + + CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; + CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; + + TmFunnel::downlinkDestination = objects::UDP_BRIDGE; + // No storage object for now. + TmFunnel::storageDestination = objects::NO_OBJECT; + + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + TmPacketStored::timeStamperId = objects::TIME_STAMPER; +} + +void ObjectFactory::produce(){ + Factory::setStaticFrameworkObjectIds(); + ObjectFactory::produceGenericObjects(); + +#ifdef LINUX + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, + objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); +#elif WIN32 + new TmTcWinUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, + objects::TC_STORE); + new TcWinUdpPollingTask(objects::UDP_POLLING_TASK, + objects::UDP_BRIDGE); +#endif + +} diff --git a/hosted/ObjectFactory.h b/hosted/ObjectFactory.h new file mode 100644 index 00000000..f7fa81ac --- /dev/null +++ b/hosted/ObjectFactory.h @@ -0,0 +1,17 @@ +/* + * ObjectFactory.h + * + * Created on: Sep 22, 2020 + * Author: steffen + */ + +#ifndef BSP_LINUX_OBJECTFACTORY_H_ +#define BSP_LINUX_OBJECTFACTORY_H_ + + +namespace ObjectFactory { + void setStatics(); + void produce(); +}; + +#endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/hosted/config/version.h b/hosted/config/version.h deleted file mode 100644 index 386cbc09..00000000 --- a/hosted/config/version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CONFIG_VERSION_H_ -#define CONFIG_VERSION_H_ - -#define SW_VERSION 0 -#define SW_SUBVERSION 1 - - - -#endif /* CONFIG_VERSION_H_ */ diff --git a/config/FSFWConfig.h b/hosted/fsfwconfig/FSFWConfig.h similarity index 100% rename from config/FSFWConfig.h rename to hosted/fsfwconfig/FSFWConfig.h diff --git a/hosted/config/OBSWConfig.h b/hosted/fsfwconfig/OBSWConfig.h similarity index 100% rename from hosted/config/OBSWConfig.h rename to hosted/fsfwconfig/OBSWConfig.h diff --git a/hosted/fsfwconfig/OBSWVersion.h b/hosted/fsfwconfig/OBSWVersion.h new file mode 100644 index 00000000..e1afa204 --- /dev/null +++ b/hosted/fsfwconfig/OBSWVersion.h @@ -0,0 +1,12 @@ +#ifndef FSFWCONFIG_OBSWVERSION_H_ +#define FSFWCONFIG_OBSWVERSION_H_ + +const char* const SW_NAME = "eive"; + +#define SW_VERSION 0 +#define SW_SUBVERSION 2 +#define SW_SUBSUBVERSION 0 + + + +#endif /* FSFWCONFIG_OBSWVERSION_H_ */ diff --git a/hosted/config/events/subsystemIdRanges.h b/hosted/fsfwconfig/events/subsystemIdRanges.h similarity index 100% rename from hosted/config/events/subsystemIdRanges.h rename to hosted/fsfwconfig/events/subsystemIdRanges.h diff --git a/hosted/config/config.mk b/hosted/fsfwconfig/fsfwconfig.mk similarity index 100% rename from hosted/config/config.mk rename to hosted/fsfwconfig/fsfwconfig.mk diff --git a/hosted/config/ipc/MissionMessageTypes.cpp b/hosted/fsfwconfig/ipc/MissionMessageTypes.cpp similarity index 75% rename from hosted/config/ipc/MissionMessageTypes.cpp rename to hosted/fsfwconfig/ipc/MissionMessageTypes.cpp index 36ef1b73..b91abcd3 100644 --- a/hosted/config/ipc/MissionMessageTypes.cpp +++ b/hosted/fsfwconfig/ipc/MissionMessageTypes.cpp @@ -1,5 +1,5 @@ -#include "MissionMessageTypes.h" #include +#include void messagetypes::clearMissionMessage(CommandMessage* message) { switch(message->getMessageType()) { diff --git a/config/ipc/MissionMessageTypes.h b/hosted/fsfwconfig/ipc/MissionMessageTypes.h similarity index 100% rename from config/ipc/MissionMessageTypes.h rename to hosted/fsfwconfig/ipc/MissionMessageTypes.h diff --git a/config/returnvalues/classIds.h b/hosted/fsfwconfig/returnvalues/classIds.h similarity index 100% rename from config/returnvalues/classIds.h rename to hosted/fsfwconfig/returnvalues/classIds.h diff --git a/hosted/main.cpp b/hosted/main.cpp index 77c5145e..e5ca6d02 100644 --- a/hosted/main.cpp +++ b/hosted/main.cpp @@ -1,8 +1,8 @@ -#include +#include #include +#include #include -#include #ifdef WIN32 static const char* COMPILE_PRINTOUT = "Windows"; @@ -20,8 +20,8 @@ int main(void) { std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl; - std::cout << "-- Software version v" << SW_VERSION << "." << SW_SUBVERSION - << " -- " << std::endl; + std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." + << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; InitMission::initMission(); diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp new file mode 100644 index 00000000..5305dc82 --- /dev/null +++ b/mission/core/GenericFactory.cpp @@ -0,0 +1,83 @@ +#include "GenericFactory.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +void ObjectFactory::produceGenericObjects() { + /* Framework objects */ + new EventManager(objects::EVENT_MANAGER); + new HealthTable(objects::HEALTH_TABLE); + new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER, 0, 0, 0); + new TimeStamper(objects::TIME_STAMPER); + + { + static constexpr uint8_t NUMBER_OF_POOLS = 5; + const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024}; + const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5}; + new PoolManager(objects::TC_STORE, element_sizes, + n_elements); + } + + { + static constexpr uint8_t NUMBER_OF_POOLS = 5; + const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024}; + const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5}; + new PoolManager(objects::TM_STORE, element_sizes, + n_elements); + } + + { + static constexpr uint8_t NUMBER_OF_POOLS = 6; + const uint16_t element_sizes[NUMBER_OF_POOLS] = {32, 64, 512, + 1024, 2048, 4096}; + const uint16_t n_elements[NUMBER_OF_POOLS] = {200, 100, 50, 25, 15, 5}; + new PoolManager(objects::IPC_STORE, element_sizes, + n_elements); + } + + new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR); + new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, + objects::CCSDS_PACKET_DISTRIBUTOR); + + + /* TMTC Reception via UDP socket */ + new TmFunnel(objects::TM_FUNNEL); + + /* PUS stack */ + new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, + apid::EIVE_OBSW, pus::PUS_SERVICE_1, objects::TM_FUNNEL); + new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, + apid::EIVE_OBSW, pus::PUS_SERVICE_2, 3, 10); + new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, + apid::EIVE_OBSW, pus::PUS_SERVICE_5, 50); + new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, + apid::EIVE_OBSW, pus::PUS_SERVICE_8, 3, 10); + new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, + apid::EIVE_OBSW, pus::PUS_SERVICE_9); + new Service17Test(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, + pus::PUS_SERVICE_17); + new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, + apid::EIVE_OBSW, pus::PUS_SERVICE_200); + + /* Test Device Handler */ +#if OBSW_ADD_TEST_CODE == 1 + new TestTask(objects::TEST_TASK); +#endif +} diff --git a/mission/core/GenericFactory.h b/mission/core/GenericFactory.h new file mode 100644 index 00000000..c96c7818 --- /dev/null +++ b/mission/core/GenericFactory.h @@ -0,0 +1,12 @@ +#ifndef MISSION_CORE_GENERICFACTORY_H_ +#define MISSION_CORE_GENERICFACTORY_H_ + +namespace ObjectFactory { + +void produceGenericObjects(); + + +} + + +#endif /* MISSION_CORE_GENERICFACTORY_H_ */ diff --git a/mission/core/InitMission.h b/mission/core/InitMission.h deleted file mode 100644 index 8e4471ce..00000000 --- a/mission/core/InitMission.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MISSION_CORE_INITMISSION_H_ -#define MISSION_CORE_INITMISSION_H_ - -namespace InitMission { -void initMission(); -void initTasks(); -}; - -#endif /* MISSION_CORE_INITMISSION_H_ */