restructured.. a bit

This commit is contained in:
Robin Müller 2020-11-20 18:10:39 +01:00 committed by Robin Mueller
parent ba0f874a38
commit ae4305e22e
50 changed files with 455 additions and 122 deletions

View File

@ -22,7 +22,7 @@ CUSTOM_DEFINES += -DLINUX
# General folder paths # General folder paths
FRAMEWORK_PATH = fsfw FRAMEWORK_PATH = fsfw
MISSION_PATH = mission MISSION_PATH = mission
CONFIG_PATH = config CONFIG_PATH = fsfwconfig
TEST_PATH = test TEST_PATH = test
UNITTEST_PATH = unittest UNITTEST_PATH = unittest
@ -70,7 +70,11 @@ CLEANBIN2 = $(BUILDPATH)/$(OUTPUT_FOLDER)/devel
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Tool suffix when cross-compiling # Tool suffix when cross-compiling
ifdef HOST_LINUX
CROSS_COMPILE =
else
CROSS_COMPILE = arm-linux-gnueabihf- CROSS_COMPILE = arm-linux-gnueabihf-
endif
ifdef WINDOWS ifdef WINDOWS
# C Compiler # C Compiler

View File

@ -58,7 +58,7 @@ endif
# General folder paths # General folder paths
FRAMEWORK_PATH = fsfw FRAMEWORK_PATH = fsfw
MISSION_PATH = mission MISSION_PATH = mission
CONFIG_PATH = $(BOARD_FILE_ROOT)/config CONFIG_PATH = $(BOARD_FILE_ROOT)/fsfwconfig
TEST_PATH = test TEST_PATH = test
UNITTEST_PATH = unittest UNITTEST_PATH = unittest

View File

@ -1,8 +1,5 @@
#include "InitMission.h" #include <bsp_linux/InitMission.h>
#include <bsp_linux/ObjectFactory.h>
#include <OBSWConfig.h>
#include <config/objects/systemObjectList.h>
#include <mission/core/ObjectFactory.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
@ -12,6 +9,8 @@
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <iostream> #include <iostream>

9
bsp_linux/InitMission.h Normal file
View File

@ -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_ */

View File

@ -1,9 +1,8 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <fsfwconfig/objects/systemObjectList.h>
#include <config/OBSWConfig.h> #include <fsfwconfig/OBSWConfig.h>
#include <config/objects/systemObjectList.h> #include <fsfwconfig/tmtc/apid.h>
#include <config/tmtc/apid.h> #include <fsfwconfig/tmtc/pusIds.h>
#include <config/tmtc/pusIds.h>
#include <mission/utility/TmFunnel.h> #include <mission/utility/TmFunnel.h>
@ -23,22 +22,13 @@
#include <fsfw/pus/Service17Test.h> #include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/CService200ModeCommanding.h> #include <fsfw/pus/CService200ModeCommanding.h>
#include <fsfw/devicehandlers/CookieIF.h> #include <fsfw/devicehandlers/CookieIF.h>
#include <hosted/comIF/ArduinoComIF.h>
#ifdef LINUX
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h> #include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h> #include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#elif WIN32
#include <fsfw/osal/windows/TcWinUdpPollingTask.h>
#include <fsfw/osal/windows/TmTcWinUdpBridge.h>
#endif
#include <fsfw/tmtcpacket/pus/TmPacketStored.h> #include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#if ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
//#include <test/TestCookie.h>
//#include <test/TestDeviceHandler.h>
#include <test/testtasks/TestTask.h> #include <test/testtasks/TestTask.h>
//#include <test/TestEchoComIF.h>
#endif #endif
void Factory::setStaticFrameworkObjectIds(){ void Factory::setStaticFrameworkObjectIds(){
@ -99,11 +89,9 @@ void ObjectFactory::produce(){
/* TMTC Reception via UDP socket */ /* TMTC Reception via UDP socket */
new TmFunnel(objects::TM_FUNNEL); new TmFunnel(objects::TM_FUNNEL);
new TmTcUnixUdpBridge(objects::UDP_BRIDGE, new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR, objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE); objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
/* PUS stack */ /* PUS stack */
@ -123,12 +111,7 @@ void ObjectFactory::produce(){
apid::EIVE_OBSW, pus::PUS_SERVICE_200); apid::EIVE_OBSW, pus::PUS_SERVICE_200);
/* Test Device Handler */ /* Test Device Handler */
#if ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
new TestTask(objects::TEST_TASK); 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 #endif
} }

View File

@ -5,8 +5,8 @@
* Author: steffen * Author: steffen
*/ */
#ifndef MISSION_CORE_OBJECTFACTORY_H_ #ifndef BSP_LINUX_OBJECTFACTORY_H_
#define MISSION_CORE_OBJECTFACTORY_H_ #define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory { namespace ObjectFactory {
@ -14,4 +14,4 @@ namespace ObjectFactory {
void produce(); void produce();
}; };
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */ #endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -1,12 +1,13 @@
#if defined(GCOV) #if defined(GCOV)
#include <boardconfig/gcov.h> #include <boardconfig/gcov.h>
#endif #endif
#include <mission/core/InitMission.h> #include <bsp_linux/InitMission.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <iostream> #include <iostream>
#include <version.h> #include <hosted/fsfwconfig/OBSWVersion.h>
#include <unistd.h> #include <unistd.h>
/** /**
@ -19,7 +20,7 @@ int main(void)
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux " << " --" << std::endl; std::cout << "-- Compiled for Linux " << " --" << std::endl;
std::cout << "-- Software version v" << SW_VERSION << "." << SW_SUBVERSION std::cout << "-- Software version v" << SW_VERSION << "." << SW_SUBVERSION
<< " -- " << std::endl; << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
InitMission::initMission(); InitMission::initMission();

View File

@ -1,10 +0,0 @@
#ifndef CONFIG_TMTC_TMTCSIZE_H_
#define CONFIG_TMTC_TMTCSIZE_H_
#include <cstdint>
namespace tmtcsize {
static const uint32_t MAX_TM_PACKET = 50;
}
#endif /* CONFIG_TMTC_TMTCSIZE_H_ */

View File

@ -1,9 +0,0 @@
#ifndef CONFIG_VERSION_H_
#define CONFIG_VERSION_H_
#define SW_VERSION 0
#define SW_SUBVERSION 1
#endif /* CONFIG_VERSION_H_ */

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_FSFWCONFIG_H_ #ifndef FSFWCONFIG_FSFWCONFIG_H_
#define CONFIG_FSFWCONFIG_H_ #define FSFWCONFIG_FSFWCONFIG_H_
#include <FSFWVersion.h> #include <FSFWVersion.h>
#include <cstddef> #include <cstddef>
@ -51,4 +51,4 @@ static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
} }
#endif /* CONFIG_FSFWCONFIG_H_ */ #endif /* FSFWCONFIG_FSFWCONFIG_H_ */

View File

@ -3,12 +3,12 @@
* code inclusion exclusion or various other project constants and * code inclusion exclusion or various other project constants and
* properties in one place. * properties in one place.
*/ */
#ifndef CONFIG_OBSWCONFIG_H_ #ifndef FSFWCONFIG_OBSWCONFIG_H_
#define CONFIG_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 not used yet, PUS stack and TMTC tasks are always started
#define ADD_PUS_STACK 1 #define ADD_PUS_STACK 1
#endif /* CONFIG_OBSWCONFIG_H_ */ #endif /* FSFWCONFIG_OBSWCONFIG_H_ */

12
fsfwconfig/OBSWVersion.h Normal file
View File

@ -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_ */

View File

@ -1,4 +1,4 @@
#include "dataPoolInit.h" #include <fsfwconfig/cdatapool/dataPoolInit.h>
void datapool::dataPoolInit(std::map<uint32_t, PoolEntryIF*>* poolMap) { void datapool::dataPoolInit(std::map<uint32_t, PoolEntryIF*>* poolMap) {

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_CDATAPOOL_DATAPOOLINIT_H_ #ifndef FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_
#define CONFIG_CDATAPOOL_DATAPOOLINIT_H_ #define FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_
#include <fsfw/datapool/DataPool.h> #include <fsfw/datapool/DataPool.h>
@ -10,4 +10,4 @@ namespace datapool{
NO_PARAMETER = 0, NO_PARAMETER = 0,
}; };
} }
#endif /* CONFIG_CDATAPOOL_DATAPOOLINIT_H_ */ #endif /* FSFWCONFIG_CDATAPOOL_DATAPOOLINIT_H_ */

View File

@ -4,7 +4,7 @@
* \date 06.11.2019 * \date 06.11.2019
*/ */
#include "logicalAddresses.h" #include <fsfwconfig/devices/logicalAddresses.h>

View File

@ -4,11 +4,11 @@
* \date 07.11.2019 * \date 07.11.2019
*/ */
#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_ #ifndef FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_
#define CONFIG_DEVICES_LOGICALADDRESSES_H_ #define FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_
#include <stdint.h> #include <stdint.h>
#include <config/objects/systemObjectList.h>
#include <fsfw/devicehandlers/CookieIF.h> #include <fsfw/devicehandlers/CookieIF.h>
#include <fsfwconfig/objects/systemObjectList.h>
namespace addresses { namespace addresses {
/* Logical addresses have uint32_t datatype */ /* Logical addresses have uint32_t datatype */
@ -23,4 +23,4 @@ namespace addresses {
} }
#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */ #endif /* FSFWCONFIG_DEVICES_LOGICALADDRESSES_H_ */

View File

@ -4,7 +4,7 @@
* @date 28.11.2019 * @date 28.11.2019
*/ */
#include "powerSwitcherList.h" #include <fsfwconfig/devices/powerSwitcherList.h>

View File

@ -4,8 +4,8 @@
* @date 28.11.2019 * @date 28.11.2019
*/ */
#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_ #ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define CONFIG_DEVICES_POWERSWITCHERLIST_H_ #define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
namespace switches { namespace switches {
/* Switches are uint8_t datatype and go from 0 to 255 */ /* 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_ */

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #ifndef FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #define FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#include <fsfw/events/fwSubsystemIdRanges.h> #include <fsfw/events/fwSubsystemIdRanges.h>
#include <cstdint> #include <cstdint>
@ -21,4 +21,4 @@ enum: uint8_t {
}; };
} }
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */ #endif /* FSFWCONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */

View File

@ -2,7 +2,7 @@
* @brief Auto-generated event translation file. Contains 80 translations. * @brief Auto-generated event translation file. Contains 80 translations.
* Generated on: 2020-05-02 20:13:41 * Generated on: 2020-05-02 20:13:41
*/ */
#include "translateEvents.h" #include <fsfwconfig/events/translateEvents.h>
const char *GPS_STARTUP_FAILED_STRING = "GPS_STARTUP_FAILED"; const char *GPS_STARTUP_FAILED_STRING = "GPS_STARTUP_FAILED";
const char *GPS_FIX_STRING = "GPS_FIX"; const char *GPS_FIX_STRING = "GPS_FIX";

View File

@ -5,12 +5,12 @@
* Author: Robin * Author: Robin
*/ */
#ifndef CONFIG_EVENTS_TRANSLATEEVENTS_H_ #ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
#define CONFIG_EVENTS_TRANSLATEEVENTS_H_ #define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
#include <fsfw/events/Event.h> #include <fsfw/events/Event.h>
const char * translateEvents(Event event); const char * translateEvents(Event event);
#endif /* CONFIG_EVENTS_TRANSLATEEVENTS_H_ */ #endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */

View File

@ -1,5 +1,5 @@
#include "MissionMessageTypes.h"
#include <fsfw/ipc/CommandMessage.h> #include <fsfw/ipc/CommandMessage.h>
#include <fsfwconfig/ipc/MissionMessageTypes.h>
void messagetypes::clearMissionMessage(CommandMessage* message) { void messagetypes::clearMissionMessage(CommandMessage* message) {
// switch(message->getMessageType()) { // switch(message->getMessageType()) {

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_ #ifndef FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
#define CONFIG_IPC_MISSIONMESSAGETYPES_H_ #define FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_
#include <fsfw/ipc/FwMessageTypes.h> #include <fsfw/ipc/FwMessageTypes.h>
@ -19,4 +19,4 @@ enum MESSAGE_TYPE {
void clearMissionMessage(CommandMessage* message); void clearMissionMessage(CommandMessage* message);
} }
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */ #endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */

View File

@ -1,5 +1,5 @@
/* Auto-generated event translation file. Contains 77 translations. */ /* Auto-generated event translation file. Contains 77 translations. */
#include <config/objects/translateObjects.h> #include <fsfwconfig/objects/translateObjects.h>
const char *AT91_UART2_TEST_TASK_STRING = "AT91_UART2_TEST_TASK"; const char *AT91_UART2_TEST_TASK_STRING = "AT91_UART2_TEST_TASK";
const char *ARDUINO_0_STRING = "ARDUINO_0"; const char *ARDUINO_0_STRING = "ARDUINO_0";

View File

@ -5,12 +5,12 @@
* Author: Robin * Author: Robin
*/ */
#ifndef CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ #ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
#define CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ #define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
const char* translateObject(object_id_t object); const char* translateObject(object_id_t object);
#endif /* CONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ #endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */

View File

@ -1,10 +1,9 @@
#include <PollingSequenceFactory.h>
#include <systemObjectList.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/pollingsequence/PollingSequenceFactory.h>
ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence) ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
{ {

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ #ifndef FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
#define CONFIG_RETURNVALUES_CLASSIDS_H_ #define FSFWCONFIG_RETURNVALUES_CLASSIDS_H_
#include <fsfw/returnvalues/FwClassIds.h> #include <fsfw/returnvalues/FwClassIds.h>
@ -16,4 +16,4 @@ enum {
} }
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */ #endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */

View File

@ -1,5 +1,5 @@
#ifndef CONFIG_TMTC_APID_H_ #ifndef FSFWCONFIG_TMTC_APID_H_
#define CONFIG_TMTC_APID_H_ #define FSFWCONFIG_TMTC_APID_H_
#include <stdint.h> #include <stdint.h>
@ -16,4 +16,4 @@ namespace apid {
} }
#endif /* CONFIG_TMTC_APID_H_ */ #endif /* FSFWCONFIG_TMTC_APID_H_ */

View File

@ -0,0 +1,10 @@
#ifndef FSFWCONFIG_TMTC_TMTCSIZE_H_
#define FSFWCONFIG_TMTC_TMTCSIZE_H_
#include <cstdint>
namespace tmtcsize {
static const uint32_t MAX_TM_PACKET = 50;
}
#endif /* FSFWCONFIG_TMTC_TMTCSIZE_H_ */

159
hosted/InitMission.cpp Normal file
View File

@ -0,0 +1,159 @@
#include <bsp_linux/InitMission.h>
#include <bsp_linux/ObjectFactory.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/datapool/DataPool.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <iostream>
// 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;
}

9
hosted/InitMission.h Normal file
View File

@ -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_ */

61
hosted/ObjectFactory.cpp Normal file
View File

@ -0,0 +1,61 @@
#include "ObjectFactory.h"
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <fsfwconfig/tmtc/apid.h>
#include <fsfwconfig/tmtc/pusIds.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h>
#ifdef LINUX
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#elif WIN32
#include <fsfw/osal/windows/TcWinUdpPollingTask.h>
#include <fsfw/osal/windows/TmTcWinUdpBridge.h>
#endif
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h>
#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
}

17
hosted/ObjectFactory.h Normal file
View File

@ -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_ */

View File

@ -1,9 +0,0 @@
#ifndef CONFIG_VERSION_H_
#define CONFIG_VERSION_H_
#define SW_VERSION 0
#define SW_SUBVERSION 1
#endif /* CONFIG_VERSION_H_ */

View File

@ -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_ */

View File

@ -1,5 +1,5 @@
#include "MissionMessageTypes.h"
#include <fsfw/ipc/CommandMessage.h> #include <fsfw/ipc/CommandMessage.h>
#include <hosted/fsfwconfig/ipc/MissionMessageTypes.h>
void messagetypes::clearMissionMessage(CommandMessage* message) { void messagetypes::clearMissionMessage(CommandMessage* message) {
switch(message->getMessageType()) { switch(message->getMessageType()) {

View File

@ -1,8 +1,8 @@
#include <mission/core/InitMission.h> #include <bsp_linux/InitMission.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <hosted/fsfwconfig/OBSWVersion.h>
#include <iostream> #include <iostream>
#include <version.h>
#ifdef WIN32 #ifdef WIN32
static const char* COMPILE_PRINTOUT = "Windows"; static const char* COMPILE_PRINTOUT = "Windows";
@ -20,8 +20,8 @@ int main(void)
{ {
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl; std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
std::cout << "-- Software version v" << SW_VERSION << "." << SW_SUBVERSION std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< " -- " << std::endl; << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
InitMission::initMission(); InitMission::initMission();

View File

@ -0,0 +1,83 @@
#include "GenericFactory.h"
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/tmtc/apid.h>
#include <fsfwconfig/tmtc/pusIds.h>
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/internalError/InternalErrorReporter.h>
#include <fsfw/pus/CService200ModeCommanding.h>
#include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/Service1TelecommandVerification.h>
#include <fsfw/pus/Service2DeviceAccess.h>
#include <fsfw/pus/Service5EventReporting.h>
#include <fsfw/pus/Service8FunctionManagement.h>
#include <fsfw/pus/Service9TimeManagement.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/tcdistribution/CCSDSDistributor.h>
#include <fsfw/tcdistribution/PUSDistributor.h>
#include <fsfw/timemanager/TimeStamper.h>
#include <mission/utility/TmFunnel.h>
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<NUMBER_OF_POOLS>(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<NUMBER_OF_POOLS>(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<NUMBER_OF_POOLS>(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
}

View File

@ -0,0 +1,12 @@
#ifndef MISSION_CORE_GENERICFACTORY_H_
#define MISSION_CORE_GENERICFACTORY_H_
namespace ObjectFactory {
void produceGenericObjects();
}
#endif /* MISSION_CORE_GENERICFACTORY_H_ */

View File

@ -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_ */