diff --git a/Makefile b/Makefile index 80419a88..29eb5856 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 GOMSPACE_PATH = gomspace @@ -51,7 +51,7 @@ endif BUILDPATH = _bin DEPENDPATH = _dep OBJECTPATH = _obj -ifeq ($(MAKECMDGOALS),release) +ifeq ($(MAKECMDGOALS), release) BUILD_FOLDER = mission else BUILD_FOLDER = devel @@ -71,7 +71,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/README.md b/README.md index 3f0c7f91..71f7860e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # EIVE On-Board Software ## General information + +Target systems: + * OBC * Xiphos Q7S * Based on Zynq-7020 SoC (xc7z020clg484-2) @@ -12,24 +15,36 @@ * Linux OS * Built with Yocto 2.5 * Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git +* Host System + * Generic software components which are not dependant on hardware can also + be run. All host code is contained in the hosted folder + * Tested for Linux (Ubuntu 20.04) and Windows 10 ## Setting up development environment -* Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html +* Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html. + Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of the updates. It is recommended to use the installer +* Install settings. In the Devices selection, it is sufficient to pick SoC → Zynq-7000:
+
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf * Add path of linux cross-compiler to environment variables SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin * Install make (only on windows, SDK on Linux can use the make installed with the SDK) - 1. Install NodeJS LTS - 2. Install xpm - ```` - npm install --global xpm - ```` - 3. Install Windows build tools (after installation also linux commands like mkdir can be used from windows) - ```` - xpm install --global @xpack-dev-tools/windows-build-tools@latest - ```` -### Building the software +### Installing make on Windows +1. Install NodeJS LTS +2. Install xpm + +```sh +npm install --global xpm +``` + +3. Install Windows build tools (after installation also linux commands like mkdir can be used from windows) + +```sh +xpm install --global @xpack-dev-tools/windows-build-tools@latest +``` + +## Building the software 1. Clone the repository with ```sh @@ -43,21 +58,23 @@ git submodule sync git submodule update ``` -4. Open Xilinx SDK 2018.2 -5. Import project +3. Open Xilinx SDK 2018.2 +4. Import project * File → Import → C/C++ → Existing Code as Makefile Project -6. Set build command - * When on Linux right click project → Properties → C/C++ Build → Set build command to make -j +5. Set build command. Replace \ with either debug or release. + * When on Linux right click project → Properties → C/C++ Build → Set build command to `make -j` * -j causes the compiler to use all available cores - * On windows create a make target (Windows → Show View → Make Target) + * The target is used to either compile the debug or the optimized release build. + * On windows create a make target additionally (Windows → Show View → Make Target) * Right click eive_obsw → New * Target name: all * Uncheck "Same as the target name" * Uncheck "Use builder settings" - * As build command type: \make -j all WINDOWS=1 -7. Run build command (double click the generated target) + * As build command type: `make -j WINDOWS=1` +6. Run build command by double clicking the created target or by right clicking + the project folder and selecting Build Project. -### Debugging the software (when workstation is directly conncected to Q7S) +## Debugging the software (when workstation is directly conncected to Q7S) 1. Assign static IP address to Q7S * Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user maunal chapter 10.3) * Baudrate 115200 @@ -65,35 +82,43 @@ git submodule update * user: root * pw: root * Set IP address and netmask with - ```` - ifconfig eth0 192.168.133.10 - ifconfig eth0 netmask 255.255.255.0 - ```` + + ```sh + ifconfig eth0 192.168.133.10 + ifconfig eth0 netmask 255.255.255.0 + ``` + 2. Connect Q7S to workstation via ethernet 3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S * When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation is 192.168.133.2 4. Run tcf-agent on Q7S * Tcf-agent is not yet integrated in the rootfs of the Q7S. Therefore build tcf-agent manually - ```` - git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git - cd org.eclipse.tcf.agent/agent - make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld MACHINE=arm NO_SSL=1 NO_UUID=1 - ```` + + ```sh + git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git + cd org.eclipse.tcf.agent/agent + make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld MACHINE=arm NO_SSL=1 NO_UUID=1 + ``` + * Transfer executable agent from org.eclipse.tcf.agent/agent/obj/GNU/Linux/arm/Debug to /tmp of Q7S - ```` - cd obj/GNU/Linux/arm/Debug - scp agent root@192.168.133.10:/tmp - ```` + + ```sh + cd obj/GNU/Linux/arm/Debug + scp agent root@192.168.133.10:/tmp + ``` + * On Q7S - ```` - cd /tmp - chmod +x agent - ```` + ```sh + cd /tmp + chmod +x agent + ``` + * Run agent - ```` - ./agent - ```` + ```sh + ./agent + ``` + 5. In Xilinx SDK 2018.2 right click on project → Debug As → Debug Configurations 6. Right click Xilinx C/C++ applicaton (System Debugger) → New → 7. Set Debug Type to Linux Application Debug and Connectin to Linux Agent @@ -106,15 +131,15 @@ git submodule update * Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel) * Remote File Path: /tmp/eive_obsw.elf -### Debugging the software via Flatsat PC +## Debugging the software via Flatsat PC Open SSH connection to flatsat PC: ```` ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 ```` To access the console of the Q7S run the following: -```` -sudo picocom -b 115200 /dev/ttyUSB0 -```` +```sh +picocom -b 115200 /dev/ttyUSB0 +``` To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig on the Q7S serial console. ```` ifconfig @@ -134,7 +159,7 @@ Note: When now setting up a debug session in the Xilinx SDK, the host must be se of the Q7S. -### Launching an application after boot +## Launching an application after boot Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds two xdi images). Note: It is not possible to modify the current loaded root partition. 1. Disable write protection of the desired root partition @@ -209,7 +234,7 @@ Reading data from CAN: candump can0 ```` -### Setting up UNIX environment for real-time functionalities +## Setting up UNIX environment for real-time functionalities Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities used by the UNIX pthread module are restricted, which will lead to permission errors when creating these tasks and configuring real-time properites like scheduling priorities. @@ -268,7 +293,18 @@ a permanent solution). If running the script before executing the binary does not help or an warning is issue that the soft real time value is invalid, the hard real-time limit of the system might not be high enough (see step 1). -### Flight Software Framework (FSFW) +## Building and running the software on a host system + +The host build can be built with following command + +```sh +make -f Makefile-Hosted all -j +``` + +If compiling on Windows, it is recommended to supply `WINDOWS=1` . +A release build can be built by using the `mission` target. + +## Flight Software Framework (FSFW) An EIVE fork of the FSFW is submodules into this repository. To add the master upstream branch and merge changes and updates from it diff --git a/mission/core/InitMission.cpp b/bsp_linux/InitMission.cpp similarity index 95% rename from mission/core/InitMission.cpp rename to bsp_linux/InitMission.cpp index a2697329..92cd0853 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 @@ -141,9 +140,9 @@ void InitMission::initTasks(){ // << "failed!" << std::endl; // } - PeriodicTaskIF* P60DockTestTask = TaskFactory::instance()-> - createPeriodicTask("P60 Dock", 50 , 4096, - 1, nullptr); + PeriodicTaskIF* P60DockTestTask = + TaskFactory::instance()->createPeriodicTask("P60 Dock", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, nullptr); result = PusLowPrio->addComponent(objects::P60DOCK_TEST_TASK); if(result!=HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; 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/bsp_linux/ObjectFactory.cpp b/bsp_linux/ObjectFactory.cpp new file mode 100644 index 00000000..a0f82887 --- /dev/null +++ b/bsp_linux/ObjectFactory.cpp @@ -0,0 +1,42 @@ +#include "ObjectFactory.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +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(); + + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, + objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); +} 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..5f6be8db 100644 --- a/bsp_linux/main.cpp +++ b/bsp_linux/main.cpp @@ -1,25 +1,22 @@ -#if defined(GCOV) -#include -#endif +#include "InitMission.h" -#include +#include #include #include -#include + #include /** - * @brief This is the main program for the hosted build. It can be run for - * Linux and Windows. + * @brief This is the main program for the target hardware. * @return */ 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; + 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/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/doc/img/xilinx-install.PNG b/doc/img/xilinx-install.PNG new file mode 100644 index 00000000..eff68ac4 Binary files /dev/null and b/doc/img/xilinx-install.PNG differ diff --git a/fsfwconfig/FSFWConfig.h b/fsfwconfig/FSFWConfig.h new file mode 100644 index 00000000..fe97ee6e --- /dev/null +++ b/fsfwconfig/FSFWConfig.h @@ -0,0 +1,54 @@ +#ifndef FSFWCONFIG_FSFWCONFIG_H_ +#define FSFWCONFIG_FSFWCONFIG_H_ + +#include +#include + +//! Used to determine whether C++ ostreams are used +//! Those can lead to code bloat. +#define FSFW_CPP_OSTREAM_ENABLED 1 + +//! Reduced printout to further decrese code size +//! Be careful, this also turns off most diagnostic prinouts! +#define FSFW_REDUCED_PRINTOUT 0 + +//! Can be used to enable debugging printouts for developing the FSFW +#define FSFW_DEBUGGING 0 + +//! 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 ! +#define FSFW_CSB_FIFO_DEPTH 6 + +//! 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 +#define FSFW_DEBUG_OUTPUT 1 +//! Specify whether info events are printed too. +#define FSFW_DEBUG_INFO 1 +#include +#include +#else +#define FSFW_DEBUG_OUTPUT 0 +#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 + +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; +} + +#endif /* FSFWCONFIG_FSFWCONFIG_H_ */ diff --git a/config/OBSWConfig.h b/fsfwconfig/OBSWConfig.h similarity index 74% rename from config/OBSWConfig.h rename to fsfwconfig/OBSWConfig.h index 2b8b62c4..7e59992c 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 ADD_TEST_CODE 1 // 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..d76b65c9 --- /dev/null +++ b/fsfwconfig/OBSWVersion.h @@ -0,0 +1,13 @@ +#ifndef FSFWCONFIG_OBSWVERSION_H_ +#define FSFWCONFIG_OBSWVERSION_H_ + +//! TODO: Think of a cool name for the software releases. +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/fsfwconfig/returnvalues/classIds.h b/fsfwconfig/returnvalues/classIds.h new file mode 100644 index 00000000..b5835c84 --- /dev/null +++ b/fsfwconfig/returnvalues/classIds.h @@ -0,0 +1,19 @@ +#ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ +#define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ + +#include + +/** + * Source IDs starts at 73 for now + * Framework IDs for ReturnValues run from 0 to 56 + * and are located inside + */ +namespace CLASS_ID { +enum { + MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT, + MGM_LIS3MDL +}; +} + + +#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..09c69082 --- /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/FSFWConfig.h b/hosted/config/FSFWConfig.h deleted file mode 100644 index df4075bd..00000000 --- a/hosted/config/FSFWConfig.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CONFIG_FSFWCONFIG_H_ -#define CONFIG_FSFWCONFIG_H_ - -//! 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 0 - - -#endif /* CONFIG_FSFWCONFIG_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 83% rename from config/returnvalues/classIds.h rename to hosted/fsfwconfig/returnvalues/classIds.h index 3fe99a7d..f6427a1f 100644 --- a/config/returnvalues/classIds.h +++ b/hosted/fsfwconfig/returnvalues/classIds.h @@ -1,13 +1,8 @@ -/* - * classIds.h - * - * Created on: 16.07.2018 - * Author: mohr - */ - #ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ #define CONFIG_RETURNVALUES_CLASSIDS_H_ +#include + /** * Source IDs starts at 73 for now * Framework IDs for ReturnValues run from 0 to 56 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..cfdf297f --- /dev/null +++ b/mission/core/GenericFactory.cpp @@ -0,0 +1,89 @@ +#include "GenericFactory.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if ADD_TEST_CODE == 1 +//#include +#include +#endif + +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 ADD_TEST_CODE == 1 +// new TestTask(objects::TEST_TASK); + new P60DockTestTask(objects::P60DOCK_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_ */ diff --git a/mission/core/ObjectFactory.cpp b/mission/core/ObjectFactory.cpp deleted file mode 100644 index c8f8f7bb..00000000 --- a/mission/core/ObjectFactory.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "ObjectFactory.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../fsfw/devicehandlers/CookieIF.h" -#include "../../hosted/comIF/ArduinoComIF.h" -#ifdef LINUX -#include -#include -#elif WIN32 -#include -#include -#endif -#include - - -#if ADD_TEST_CODE == 1 -//#include -//#include -//#include -//#include -#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(); - - /* 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); - - 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 */ - 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 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); - new P60DockTestTask(objects::P60DOCK_TEST_TASK); -#endif -}