diff --git a/CMakeLists.txt b/CMakeLists.txt index c4497b22..2587740e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ pre_source_hw_os_config() if(TGT_BSP) if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi" - OR TGT_BSP MATCHES "arm/beagleboneblack" + OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse" ) set(FSFW_CONFIG_PATH "linux/fsfwconfig") if(NOT BUILD_Q7S_SIMPLE_MODE) @@ -109,11 +109,17 @@ if(TGT_BSP) endif() endif() - if(TGT_BSP MATCHES "arm/raspberrypi") + if(TGT_BSP MATCHES "arm/raspberrypi" ) # Used by configure file set(RASPBERRY_PI ON) set(FSFW_HAL_ADD_RASPBERRY_PI ON) endif() + + if(TGT_BSP MATCHES "arm/egse") + # Used by configure file + set(EGSE ON) + set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF) + endif() if(TGT_BSP MATCHES "arm/beagleboneblack") # Used by configure file @@ -140,7 +146,7 @@ configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) if(TGT_BSP MATCHES "arm/q7s") configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) -elseif(TGT_BSP MATCHES "arm/raspberrypi") +elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse") configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) endif() @@ -266,7 +272,11 @@ if(TGT_BSP MATCHES "arm/q7s") ) endif() - +if(TGT_BSP MATCHES "arm/egse") + target_link_libraries(${OBSW_NAME} PRIVATE + ${LIB_ARCSEC} + ) +endif() if(ADD_CSP_LIB) target_link_libraries(${OBSW_NAME} PRIVATE @@ -305,7 +315,7 @@ target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${LIB_ARCSEC_PATH} ) -if(TGT_BSP MATCHES "arm/q7s") +if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse") target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH} ) diff --git a/README.md b/README.md index 262132fd..0effabb8 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ 12. [Static Code Analysis](#static-code-analysis) 13. [Eclipse](#eclipse) 14. [Running the OBSW on a Raspberry Pi](#rpi) -15. [Manually preparing sysroots to compile gpsd](#gpsd) -16. [FSFW](#fsfw) -17. [Coding Style](#coding-style) +15. [Running OBSW on EGSE](#egse) +16. [Manually preparing sysroots to compile gpsd](#gpsd) +17. [FSFW](#fsfw) +18. [Coding Style](#coding-style) # General information @@ -1152,6 +1153,35 @@ sudo apt-get install gpiod libgpiod-dev to install the required GPIO libraries before cloning the system root folder. +# Running OBSW on EGSE +The EGSE is a test system from arcsec build arround a raspberry pi 4 to test the star tracker. The IP address of the EGSE (raspberry pi) is 192.168.18.31. An ssh session can be opened with +```` +ssh pi@192.168.18.31 +```` +Password: raspberry + +To run the obsw perform the following steps: +1. Build the cmake EGSE Configuration + * the sysroots for the EGSE can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/egse&fileid=1190471) + * toolchain for linux host can be downloaded from [here](https://github.com/Pro/raspi-toolchain) + * toolchain for windows host from [here](https://gnutoolchains.com/raspberry/) (the raspios-buster-armhf toolchain is the right one for the EGSE) +2. Disable the ser2net systemd service on the EGSE +````sh +$ sudo systemctl stop ser2net.service +```` +3. Power on the star tracker by running +````sh +$ ~/powerctrl/enable0.sh` +```` +4. Run portforwarding script for tmtc tcp connection and tcf agent on host PC +````sh +$ ./scripts/egse-port.sh +```` +5. The star tracker can be powered off by running +````sh +$ ~/powerctrl/disable0.sh +```` + # Manually preparing sysroots to compile gpsd Copy all header files from [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/gpsd&fileid=1189985) to the /usr/include directory and all static libraries to /usr/lib. diff --git a/bsp_egse/CMakeLists.txt b/bsp_egse/CMakeLists.txt new file mode 100644 index 00000000..cb02f937 --- /dev/null +++ b/bsp_egse/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${OBSW_NAME} PUBLIC + InitMission.cpp + main.cpp + ObjectFactory.cpp +) + +add_subdirectory(boardconfig) diff --git a/bsp_egse/InitMission.cpp b/bsp_egse/InitMission.cpp new file mode 100644 index 00000000..d6b192c2 --- /dev/null +++ b/bsp_egse/InitMission.cpp @@ -0,0 +1,192 @@ +#include "InitMission.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "OBSWConfig.h" +#include "ObjectFactory.h" +#include "objects/systemObjectList.h" +#include "pollingsequence/pollingSequenceFactory.h" + +ServiceInterfaceStream sif::debug("DEBUG"); +ServiceInterfaceStream sif::info("INFO"); +ServiceInterfaceStream sif::warning("WARNING"); +ServiceInterfaceStream sif::error("ERROR"); + +ObjectManagerIF* objectManager = nullptr; + +void initmission::initMission() { + sif::info << "Make sure the systemd service ser2net on the egse has been stopped " + << "(alias stop-ser2net)" << std::endl; + sif::info << "Make sure the power lines of the star tracker have been enabled " + << "(alias enable-startracker)" << std::endl; + sif::info << "Building global objects.." << std::endl; + /* Instantiate global object manager and also create all objects */ + ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr); + sif::info << "Initializing all objects.." << std::endl; + ObjectManager::instance()->initialize(); + + /* This function creates and starts all tasks */ + initTasks(); +} + +void initmission::initTasks() { + TaskFactory* factory = TaskFactory::instance(); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + if (factory == nullptr) { + /* Should never happen ! */ + return; + } +#if OBSW_PRINT_MISSED_DEADLINES == 1 + void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline; +#else + void (*missedDeadlineFunc)(void) = nullptr; +#endif + + /* TMTC Distribution */ + PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask( + "DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + 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; + } + + PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( + "TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component TMTC Bridge failed" << std::endl; + } + PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( + "TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component TMTC Polling failed" << std::endl; + } + + /* PUS Services */ + std::vector pusTasks; + createPusTasks(*factory, missedDeadlineFunc, pusTasks); + + std::vector pstTasks; + FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask( + "STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); + result = pst::pstUart(pst); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + } + pstTasks.push_back(pst); + + PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( + "STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = strHelperTask->addComponent(objects::STR_HELPER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER); + } + pstTasks.push_back(strHelperTask); + + auto taskStarter = [](std::vector& taskVector, std::string name) { + for (const auto& task : taskVector) { + if (task != nullptr) { + task->startTask(); + } else { + sif::error << "Task in vector " << name << " is invalid!" << std::endl; + } + } + }; + + sif::info << "Starting tasks.." << std::endl; + tmtcDistributor->startTask(); + tmtcBridgeTask->startTask(); + tmtcPollingTask->startTask(); + + taskStarter(pstTasks, "PST Tasks"); + taskStarter(pusTasks, "PUS Tasks"); + + sif::info << "Tasks started.." << std::endl; +} + +void initmission::createPusTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* pusVerification = factory.createPeriodicTask( + "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Object add component failed" << std::endl; + } + taskVec.push_back(pusVerification); + + PeriodicTaskIF* pusEvents = factory.createPeriodicTask( + "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING); + } + result = pusEvents->addComponent(objects::EVENT_MANAGER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER); + } + taskVec.push_back(pusEvents); + + PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask( + "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS); + } + result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); + } + taskVec.push_back(pusHighPrio); + + PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask( + "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); + result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); + } + taskVec.push_back(pusMedPrio); + + PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask( + "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); + result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); + } + result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER); + } + taskVec.push_back(pusLowPrio); +} diff --git a/bsp_egse/InitMission.h b/bsp_egse/InitMission.h new file mode 100644 index 00000000..c3ba58ec --- /dev/null +++ b/bsp_egse/InitMission.h @@ -0,0 +1,21 @@ +#ifndef BSP_LINUX_INITMISSION_H_ +#define BSP_LINUX_INITMISSION_H_ + +#include + +#include "fsfw/tasks/Typedef.h" + +class PeriodicTaskIF; +class TaskFactory; + +namespace initmission { +void initMission(); +void initTasks(); + +void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec); +void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec); +}; // namespace initmission + +#endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/bsp_egse/ObjectFactory.cpp b/bsp_egse/ObjectFactory.cpp new file mode 100644 index 00000000..10eea471 --- /dev/null +++ b/bsp_egse/ObjectFactory.cpp @@ -0,0 +1,49 @@ +#include "ObjectFactory.h" + +#include +#include +#include +#include + +#include "OBSWConfig.h" +#include "busConf.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/tmtcpacket/pus/tm.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" +#include "linux/devices/startracker/StarTrackerHandler.h" +#include "mission/core/GenericFactory.h" +#include "mission/utility/TmFunnel.h" +#include "objects/systemObjectList.h" +#include "tmtc/apid.h" +#include "tmtc/pusIds.h" + +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::TMTC_BRIDGE; + TmFunnel::storageDestination = objects::NO_OBJECT; + + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + TmPacketBase::timeStamperId = objects::TIME_STAMPER; +} + +void ObjectFactory::produce(void* args) { + Factory::setStaticFrameworkObjectIds(); + ObjectFactory::produceGenericObjects(); + + UartCookie* starTrackerCookie = + new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL, + uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2); + new UartComIF(objects::UART_COM_IF); + starTrackerCookie->setNoFixedSizeReply(); + StrHelper* strHelper = new StrHelper(objects::STR_HELPER); + StarTrackerHandler* starTrackerHandler = new StarTrackerHandler( + objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper); + starTrackerHandler->setStartUpImmediately(); +} diff --git a/bsp_egse/ObjectFactory.h b/bsp_egse/ObjectFactory.h new file mode 100644 index 00000000..b24dd321 --- /dev/null +++ b/bsp_egse/ObjectFactory.h @@ -0,0 +1,8 @@ +#ifndef BSP_LINUX_OBJECTFACTORY_H_ +#define BSP_LINUX_OBJECTFACTORY_H_ + +namespace ObjectFactory { +void produce(void* args); +}; // namespace ObjectFactory + +#endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/bsp_egse/boardconfig/CMakeLists.txt b/bsp_egse/boardconfig/CMakeLists.txt new file mode 100644 index 00000000..f9136e3e --- /dev/null +++ b/bsp_egse/boardconfig/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${OBSW_NAME} PRIVATE + print.c +) + +target_include_directories(${OBSW_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/bsp_egse/boardconfig/busConf.h b/bsp_egse/boardconfig/busConf.h new file mode 100644 index 00000000..4df55edc --- /dev/null +++ b/bsp_egse/boardconfig/busConf.h @@ -0,0 +1,8 @@ +#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_ +#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_ + +namespace egse { +static constexpr char STAR_TRACKER_UART[] = "/dev/serial0"; +} + +#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */ diff --git a/bsp_egse/boardconfig/etl_profile.h b/bsp_egse/boardconfig/etl_profile.h new file mode 100644 index 00000000..54aca344 --- /dev/null +++ b/bsp_egse/boardconfig/etl_profile.h @@ -0,0 +1,38 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2019 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ +#ifndef __ETL_PROFILE_H__ +#define __ETL_PROFILE_H__ + +#define ETL_CHECK_PUSH_POP + +#define ETL_CPP11_SUPPORTED 1 +#define ETL_NO_NULLPTR_SUPPORT 0 + +#endif diff --git a/bsp_egse/boardconfig/gcov.h b/bsp_egse/boardconfig/gcov.h new file mode 100644 index 00000000..80acdd86 --- /dev/null +++ b/bsp_egse/boardconfig/gcov.h @@ -0,0 +1,15 @@ +#ifndef LINUX_GCOV_H_ +#define LINUX_GCOV_H_ +#include + +#ifdef GCOV +extern "C" void __gcov_flush(); +#else +void __gcov_flush() { + sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if " + "coverage information is desired.\n" + << std::flush; +} +#endif + +#endif /* LINUX_GCOV_H_ */ diff --git a/bsp_egse/boardconfig/print.c b/bsp_egse/boardconfig/print.c new file mode 100644 index 00000000..5b3a0f91 --- /dev/null +++ b/bsp_egse/boardconfig/print.c @@ -0,0 +1,10 @@ +#include +#include + +void printChar(const char* character, bool errStream) { + if (errStream) { + putc(*character, stderr); + return; + } + putc(*character, stdout); +} diff --git a/bsp_egse/boardconfig/print.h b/bsp_egse/boardconfig/print.h new file mode 100644 index 00000000..8e7e2e5d --- /dev/null +++ b/bsp_egse/boardconfig/print.h @@ -0,0 +1,8 @@ +#ifndef HOSTED_BOARDCONFIG_PRINT_H_ +#define HOSTED_BOARDCONFIG_PRINT_H_ + +#include + +void printChar(const char* character, bool errStream); + +#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */ diff --git a/bsp_egse/boardconfig/rpiConfig.h.in b/bsp_egse/boardconfig/rpiConfig.h.in new file mode 100644 index 00000000..af4f0dd2 --- /dev/null +++ b/bsp_egse/boardconfig/rpiConfig.h.in @@ -0,0 +1,6 @@ +#ifndef BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ +#define BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ + +#include + +#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */ diff --git a/bsp_egse/main.cpp b/bsp_egse/main.cpp new file mode 100644 index 00000000..ce7966ff --- /dev/null +++ b/bsp_egse/main.cpp @@ -0,0 +1,28 @@ +#include + +#include "InitMission.h" +#include "OBSWConfig.h" +#include "OBSWVersion.h" +#include "fsfw/FSFWVersion.h" +#include "fsfw/tasks/TaskFactory.h" + +/** + * @brief This is the main program entry point for the egse (raspberry pi 4) + * @return + */ +int main(void) { + std::cout << "-- EIVE OBSW --" << std::endl; + std::cout << "-- Compiled for EGSE from Arcsec" + << " --" << std::endl; + std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "." + << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION + << "--" << std::endl; + std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; + + initmission::initMission(); + + for (;;) { + /* Suspend main thread by sleeping it. */ + TaskFactory::delayTask(5000); + } +} diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index b8da1b3e..6dfe3af1 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -64,17 +64,17 @@ void initmission::initTasks() { } /* UDP bridge */ - PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( - "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); - result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE); + PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( + "TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "Add component UDP Unix Bridge failed" << std::endl; + sif::error << "Add component TMTC Bridge failed" << std::endl; } - PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( - "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); - result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK); + PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( + "TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK); if (result != HasReturnvaluesIF::RETURN_OK) { - sif::error << "Add component UDP Polling failed" << std::endl; + sif::error << "Add component TMTC Polling failed" << std::endl; } /* PUS Services */ @@ -100,8 +100,8 @@ void initmission::initTasks() { sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); - udpBridgeTask->startTask(); - udpPollingTask->startTask(); + tmtcBridgeTask->startTask(); + tmtcPollingTask->startTask(); taskStarter(pusTasks, "PUS Tasks"); #if OBSW_ADD_TEST_CODE == 1 diff --git a/bsp_linux_board/boardconfig/print.c b/bsp_linux_board/boardconfig/print.c index 3aba2d73..c2b2e15d 100644 --- a/bsp_linux_board/boardconfig/print.c +++ b/bsp_linux_board/boardconfig/print.c @@ -1,4 +1,4 @@ -#include +#include #include void printChar(const char* character, bool errStream) { diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index c4e3805d..76807438 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -86,7 +86,7 @@ void initmission::initTasks() { "TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE); + initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE); } PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask( "TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); @@ -135,9 +135,9 @@ void initmission::initTasks() { } #if OBSW_ADD_STAR_TRACKER == 1 - PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask( + PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( "STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); - result = strImgLoaderTask->addComponent(objects::STR_HELPER); + result = strHelperTask->addComponent(objects::STR_HELPER); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER); } @@ -204,7 +204,7 @@ void initmission::initTasks() { #if BOARD_TE0720 == 0 fsTask->startTask(); #if OBSW_ADD_STAR_TRACKER == 1 - strImgLoaderTask->startTask(); + strHelperTask > startTask(); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif @@ -266,7 +266,7 @@ void initmission::createPstTasks(TaskFactory& factory, sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl; } taskVec.push_back(gomSpacePstTask); -#else /* BOARD_TE7020 == 0 */ +#else /* BOARD_TE7020 == 0 */ FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask( "PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc); result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 2000f3d5..3999425a 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -16,9 +16,6 @@ #include "bsp_q7s/devices/PlocMemoryDumper.h" #include "bsp_q7s/devices/PlocSupervisorHandler.h" #include "bsp_q7s/devices/PlocUpdater.h" -#include "bsp_q7s/devices/startracker/StarTrackerDefinitions.h" -#include "bsp_q7s/devices/startracker/StarTrackerHandler.h" -#include "bsp_q7s/devices/startracker/StrHelper.h" #include "bsp_q7s/memory/FileSystemHandler.h" #include "busConf.h" #include "ccsdsConfig.h" @@ -32,6 +29,12 @@ #include "linux/csp/CspComIF.h" #include "linux/csp/CspCookie.h" #include "linux/devices/GPSHyperionLinuxController.h" +#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h" +#include "linux/devices/startracker/StarTrackerHandler.h" +#include "linux/devices/startracker/StrHelper.h" +#include "linux/boardtest/SpiTestClass.h" +#include "linux/csp/CspComIF.h" +#include "linux/csp/CspCookie.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" #if OBSW_TEST_LIBGPIOD == 1 @@ -55,9 +58,7 @@ #include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartCookie.h" -#include "linux/boardtest/SpiTestClass.h" -#include "linux/csp/CspComIF.h" -#include "linux/csp/CspCookie.h" + #include "mission/core/GenericFactory.h" #include "mission/devices/ACUHandler.h" #include "mission/devices/BpxBatteryHandler.h" diff --git a/bsp_q7s/devices/CMakeLists.txt b/bsp_q7s/devices/CMakeLists.txt index eed234f5..e0f6ee2f 100644 --- a/bsp_q7s/devices/CMakeLists.txt +++ b/bsp_q7s/devices/CMakeLists.txt @@ -2,6 +2,4 @@ target_sources(${OBSW_NAME} PRIVATE PlocSupervisorHandler.cpp PlocUpdater.cpp PlocMemoryDumper.cpp -) - -add_subdirectory(startracker) \ No newline at end of file +) \ No newline at end of file diff --git a/cmake/HardwareOsPreConfig.cmake b/cmake/HardwareOsPreConfig.cmake index 3ff67565..88df808c 100644 --- a/cmake/HardwareOsPreConfig.cmake +++ b/cmake/HardwareOsPreConfig.cmake @@ -47,7 +47,7 @@ if(CMAKE_CROSSCOMPILING) set_property(CACHE TGT_BSP PROPERTY STRINGS - "arm/q7s" "arm/raspberrypi" + "arm/q7s" "arm/raspberrypi" "arm/egse" ) endif() @@ -57,6 +57,8 @@ if(TGT_BSP) set(BSP_PATH "bsp_linux_board") elseif(TGT_BSP MATCHES "arm/q7s") set(BSP_PATH "bsp_q7s") + elseif(TGT_BSP MATCHES "arm/egse") + set(BSP_PATH "bsp_egse") else() message(WARNING "CMake not configured for this target!") message(FATAL_ERROR "Target: ${TGT_BSP}!") diff --git a/cmake/PreProjectConfig.cmake b/cmake/PreProjectConfig.cmake index fa64c7d8..fa50baf3 100644 --- a/cmake/PreProjectConfig.cmake +++ b/cmake/PreProjectConfig.cmake @@ -17,8 +17,7 @@ if(FSFW_OSAL MATCHES linux AND TGT_BSP) "${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake" PARENT_SCOPE ) - - elseif(TGT_BSP MATCHES "arm/raspberrypi") + elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse") if(NOT DEFINED ENV{LINUX_ROOTFS}) if(NOT DEFINED LINUX_ROOTFS) message(WARNING "No LINUX_ROOTFS environmental or CMake variable set!") diff --git a/cmake/scripts/Q7S/q7s-env-win.sh b/cmake/scripts/Q7S/q7s-env-win.sh index a8352331..2cbc0bab 100644 --- a/cmake/scripts/Q7S/q7s-env-win.sh +++ b/cmake/scripts/Q7S/q7s-env-win.sh @@ -1,5 +1,49 @@ #!/bin/sh -export PATH=$PATH:"/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" -export CROSS_COMPILE="arm-linux-gnueabihf" +# Run with: source q7s-env-win-sh [OPTIONS] +function help () { + echo "source q7s-env-win-sh [options] -t|--toolchain= -s|--sysroot=" +} -export Q7S_SYSROOT="/c/Users/${USER}/Documents/EIVE/cortexa9hf-neon-xiphos-linux-gnueabi" +TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" +SYSROOT="/c/Users/${USER}/eive-software/cortexa9hf-neon-xiphos-linux-gnueabi" + +for i in "$@"; do + case $i in + -t=*|--toolchain=*) + TOOLCHAIN_PATH="${i#*=}" + shift + ;; + -s=*|--sysroot=*) + SYSROOT="${i#*=}" + shift + ;; + -h|--help) + help + shift + ;; + -*|--*) + echo "Unknown option $i" + help + return + ;; + *) + ;; + esac +done + +if [ -d "$TOOLCHAIN_PATH" ]; then + export PATH=$PATH:"/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" + export CROSS_COMPILE="arm-linux-gnueabihf" + echo "Set toolchain path to /c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" +else + echo "Toolchain path $TOOLCHAIN_PATH does not exist" + return +fi + +if [ -d "$SYSROOT" ]; then + export Q7S_SYSROOT=$SYSROOT + echo "Set sysroot path to $SYSROOT" +else + echo "Sysroot path $SYSROOT does not exist" + return +fi \ No newline at end of file diff --git a/cmake/scripts/egse/egse_path_helper_win.sh b/cmake/scripts/egse/egse_path_helper_win.sh new file mode 100644 index 00000000..4bda17b0 --- /dev/null +++ b/cmake/scripts/egse/egse_path_helper_win.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Script to set path to raspberry pi toolchain +# Run script with: source egse_path_helper_win.sh +TOOLCHAIN_PATH="/c/SysGCC/raspberry/bin" +if [ $# -eq 1 ];then + export PATH=$PATH:"$1" +else + export PATH=$PATH:$TOOLCHAIN_PATH +fi + +echo "Path of toolchain set to $TOOLCHAIN_PATH" +export CROSS_COMPILE="arm-linux-gnueabihf" +export RASPBERRY_VERSION="4" \ No newline at end of file diff --git a/cmake/scripts/egse/make-debug-cfg.sh b/cmake/scripts/egse/make-debug-cfg.sh new file mode 100644 index 00000000..9a611373 --- /dev/null +++ b/cmake/scripts/egse/make-debug-cfg.sh @@ -0,0 +1,34 @@ +#!/bin/sh +counter=0 +cfg_script_name="cmake-build-cfg.py" +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f ${cfg_script_name} ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "${cfg_script_name} not found in upper directories!" + exit 1 +fi + + +os_fsfw="linux" +tgt_bsp="arm/egse" +build_generator="make" +build_dir="build-Debug-egse" +if [ "${OS}" = "Windows_NT" ]; then + python="py" +# Could be other OS but this works for now. +else + python="python3" +fi + +echo "Running command (without the leading +):" +set -x # Print command +${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ + -l"${build_dir}" +# set +x diff --git a/common/config/devConf.h b/common/config/devConf.h index deea6aa2..ae730e46 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -48,9 +48,9 @@ namespace uart { static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024; static constexpr uint32_t SYRLINKS_BAUD = 38400; static constexpr uint32_t GNSS_BAUD = 9600; -static constexpr uint32_t PLOC_MPSOC_BAUD = 115200; +static constexpr uint32_t PLOC_MPSOC_BAUD = 921600; static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200; -static constexpr uint32_t STAR_TRACKER_BAUD = 115200; +static constexpr uint32_t STAR_TRACKER_BAUD = 921600; } diff --git a/fsfw b/fsfw index 123f2ff3..2d9216ba 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 123f2ff360e71228e1c0c786d80a4c93d7144a2e +Subproject commit 2d9216ba19f1931225daa5b6b6f244a48c09f1b9 diff --git a/generators/.run/events.run.xml b/generators/.run/events.run.xml index 18f71033..f495007e 100644 --- a/generators/.run/events.run.xml +++ b/generators/.run/events.run.xml @@ -6,9 +6,9 @@ -