diff --git a/CMakeLists.txt b/CMakeLists.txt index b959b5a7..b0c009c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,8 @@ 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/egse" + OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse" + OR TGT_BSP MATCHES "arm/te0720-1cfa" ) set(FSFW_CONFIG_PATH "linux/fsfwconfig") if(NOT BUILD_Q7S_SIMPLE_MODE) @@ -128,6 +129,10 @@ if(TGT_BSP) # Used by configure file set(XIPHOS_Q7S ON) endif() + + if(TGT_BSP MATCHES "arm/te0720-1cfa") + set(TE0720_1CFA ON) + endif() else() # Required by FSFW library set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") @@ -200,7 +205,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(COMPILER_FLAGS "/permissive-") endif() +if (TGT_BSP MATCHES "arm/q7s") + set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -lxiphos) +endif() +if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa")) # Not installed, so use FetchContent to download and provide Catch2 if(NOT Catch2_FOUND) message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it") @@ -218,7 +227,7 @@ if(NOT Catch2_FOUND) set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true") set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true") endif() - +endif() add_library(${LIB_EIVE_MISSION}) diff --git a/bsp_egse/ObjectFactory.cpp b/bsp_egse/ObjectFactory.cpp index 10eea471..8d5e3416 100644 --- a/bsp_egse/ObjectFactory.cpp +++ b/bsp_egse/ObjectFactory.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "OBSWConfig.h" #include "busConf.h" diff --git a/bsp_q7s/devices/CMakeLists.txt b/bsp_q7s/devices/CMakeLists.txt deleted file mode 100644 index 4a931082..00000000 --- a/bsp_q7s/devices/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(ploc) diff --git a/bsp_te0720_1cfa/CMakeLists.txt b/bsp_te0720_1cfa/CMakeLists.txt new file mode 100644 index 00000000..cb02f937 --- /dev/null +++ b/bsp_te0720_1cfa/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${OBSW_NAME} PUBLIC + InitMission.cpp + main.cpp + ObjectFactory.cpp +) + +add_subdirectory(boardconfig) diff --git a/bsp_te0720_1cfa/InitMission.cpp b/bsp_te0720_1cfa/InitMission.cpp new file mode 100644 index 00000000..22601ea4 --- /dev/null +++ b/bsp_te0720_1cfa/InitMission.cpp @@ -0,0 +1,188 @@ +#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 << "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( + "UART_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* mpsocHelperTask = factory->createPeriodicTask( + "PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); + result = mpsocHelperTask->addComponent(objects::STR_HELPER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER); + } + pstTasks.push_back(mpsocHelperTask); + + 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_te0720_1cfa/InitMission.h b/bsp_te0720_1cfa/InitMission.h new file mode 100644 index 00000000..c3ba58ec --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/ObjectFactory.cpp b/bsp_te0720_1cfa/ObjectFactory.cpp new file mode 100644 index 00000000..08cd246e --- /dev/null +++ b/bsp_te0720_1cfa/ObjectFactory.cpp @@ -0,0 +1,50 @@ +#include "ObjectFactory.h" + +#include +#include +#include + +#include "OBSWConfig.h" +#include "busConf.h" +#include "devConf.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/ploc/PlocMPSoCHandler.h" +#include "linux/devices/ploc/PlocMPSoCHelper.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(); + +#if OBSW_ADD_PLOC_MPSOC == 1 + UartCookie* mpsocUartCookie = + new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, + UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); + PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); + new UartComIF(objects::UART_COM_IF); + PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler( + objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper); + plocMPSoCHandler->setStartUpImmediately(); +#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ +} diff --git a/bsp_te0720_1cfa/ObjectFactory.h b/bsp_te0720_1cfa/ObjectFactory.h new file mode 100644 index 00000000..b24dd321 --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/boardconfig/CMakeLists.txt b/bsp_te0720_1cfa/boardconfig/CMakeLists.txt new file mode 100644 index 00000000..f9136e3e --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/boardconfig/busConf.h b/bsp_te0720_1cfa/boardconfig/busConf.h new file mode 100644 index 00000000..9248fac9 --- /dev/null +++ b/bsp_te0720_1cfa/boardconfig/busConf.h @@ -0,0 +1,11 @@ +#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_ +#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_ + +namespace te0720_1cfa { +static constexpr char MPSOC_UART[] = "/dev/ttyPS2"; +namespace baudrate { + +} +} + +#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */ diff --git a/bsp_te0720_1cfa/boardconfig/etl_profile.h b/bsp_te0720_1cfa/boardconfig/etl_profile.h new file mode 100644 index 00000000..54aca344 --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/boardconfig/gcov.h b/bsp_te0720_1cfa/boardconfig/gcov.h new file mode 100644 index 00000000..80acdd86 --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/boardconfig/print.c b/bsp_te0720_1cfa/boardconfig/print.c new file mode 100644 index 00000000..1739e90b --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/boardconfig/print.h b/bsp_te0720_1cfa/boardconfig/print.h new file mode 100644 index 00000000..8e7e2e5d --- /dev/null +++ b/bsp_te0720_1cfa/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_te0720_1cfa/main.cpp b/bsp_te0720_1cfa/main.cpp new file mode 100644 index 00000000..3281b559 --- /dev/null +++ b/bsp_te0720_1cfa/main.cpp @@ -0,0 +1,29 @@ +#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 obsw running on the trenz electronic + * te0720-1cfa. + * @return + */ +int main(void) { + std::cout << "-- EIVE OBSW --" << std::endl; + std::cout << "-- Compiled for Trenz TE0720-1CFA" + << " --" << 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/cmake/HardwareOsPreConfig.cmake b/cmake/HardwareOsPreConfig.cmake index 88df808c..7b90eb54 100644 --- a/cmake/HardwareOsPreConfig.cmake +++ b/cmake/HardwareOsPreConfig.cmake @@ -59,6 +59,8 @@ if(TGT_BSP) set(BSP_PATH "bsp_q7s") elseif(TGT_BSP MATCHES "arm/egse") set(BSP_PATH "bsp_egse") + elseif(TGT_BSP MATCHES "arm/te0720-1cfa") + set(BSP_PATH "bsp_te0720_1cfa") 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 fa50baf3..41dd7de4 100644 --- a/cmake/PreProjectConfig.cmake +++ b/cmake/PreProjectConfig.cmake @@ -12,9 +12,9 @@ endif() # Disable compiler checks for cross-compiling. if(FSFW_OSAL MATCHES linux AND TGT_BSP) - if(TGT_BSP MATCHES "arm/q7s") + if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa") set(CMAKE_TOOLCHAIN_FILE - "${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake" + "${CMAKE_SCRIPT_PATH}/Zynq7020CrossCompileConfig.cmake" PARENT_SCOPE ) elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse") diff --git a/cmake/Q7SCrossCompileConfig.cmake b/cmake/Zynq7020CrossCompileConfig.cmake similarity index 88% rename from cmake/Q7SCrossCompileConfig.cmake rename to cmake/Zynq7020CrossCompileConfig.cmake index db05c8f0..8d3dab7e 100644 --- a/cmake/Q7SCrossCompileConfig.cmake +++ b/cmake/Zynq7020CrossCompileConfig.cmake @@ -1,16 +1,16 @@ -if(DEFINED ENV{Q7S_SYSROOT}) - set(ENV{Q7S_ROOTFS} $ENV{Q7S_SYSROOT}) +if(DEFINED ENV{ZYNQ_7020_SYSROOT}) + set(ENV{ZYNQ_7020_ROOTFS} $ENV{ZYNQ_7020_SYSROOT}) endif() # CROSS_COMPILE also needs to be set accordingly or passed to the CMake command -if(NOT DEFINED ENV{Q7S_ROOTFS}) +if(NOT DEFINED ENV{ZYNQ_7020_ROOTFS}) # Sysroot has not been cached yet and was not set in environment either if(NOT DEFINED SYSROOT_PATH) message(FATAL_ERROR - "Define the Q7S_ROOTFS variable to point to the Q7S rootfs." + "Define the ZYNQ_7020_ROOTFS variable to point to the Zynq-7020 rootfs." ) endif() else() - set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}" CACHE PATH "Q7S root filesystem path") + set(SYSROOT_PATH "$ENV{ZYNQ_7020_ROOTFS}" CACHE PATH "Zynq-7020 root filesystem path") endif() if(NOT DEFINED ENV{CROSS_COMPILE}) @@ -87,18 +87,17 @@ set(C_FLAGS -mfloat-abi=hard ${COMMON_FLAGS} -lgpiod - -lxiphos ) string (REPLACE ";" " " C_FLAGS "${C_FLAGS}") set(CMAKE_C_FLAGS ${C_FLAGS} - CACHE STRING "C flags for Q7S" + CACHE STRING "C flags for Zynq-7020" ) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" - CACHE STRING "CPP flags for Q7S" + CACHE STRING "CPP flags for Zynq-7020" ) # search for programs in the build host directories diff --git a/cmake/scripts/Q7S/q7s-env-win.sh b/cmake/scripts/Q7S/q7s-env-win.sh index 2cbc0bab..8c86ba5d 100644 --- a/cmake/scripts/Q7S/q7s-env-win.sh +++ b/cmake/scripts/Q7S/q7s-env-win.sh @@ -41,7 +41,7 @@ else fi if [ -d "$SYSROOT" ]; then - export Q7S_SYSROOT=$SYSROOT + export ZYNQ_7020_SYSROOT=$SYSROOT echo "Set sysroot path to $SYSROOT" else echo "Sysroot path $SYSROOT does not exist" diff --git a/cmake/scripts/Q7S/q7s-env.sh b/cmake/scripts/Q7S/q7s-env.sh index 818ff213..df9dbadc 100755 --- a/cmake/scripts/Q7S/q7s-env.sh +++ b/cmake/scripts/Q7S/q7s-env.sh @@ -2,6 +2,6 @@ export PATH=$PATH:"$HOME/EIVE/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin" export CROSS_COMPILE="arm-linux-gnueabihf" -export Q7S_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi" +export ZYNQ_7020_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi" export CONSOLE_PREFIX="[Q7S ENV]" /bin/bash diff --git a/cmake/scripts/te0720-1cfa/make-debug-cfg.sh b/cmake/scripts/te0720-1cfa/make-debug-cfg.sh new file mode 100644 index 00000000..46008c41 --- /dev/null +++ b/cmake/scripts/te0720-1cfa/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/te0720-1cfa" +build_generator="make" +build_dir="build-Debug-te0720-1cfa" +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/cmake/scripts/te0720-1cfa/win-env-te0720-1cfa.sh b/cmake/scripts/te0720-1cfa/win-env-te0720-1cfa.sh new file mode 100644 index 00000000..e77de4c8 --- /dev/null +++ b/cmake/scripts/te0720-1cfa/win-env-te0720-1cfa.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# Run with: source q7s-env-win-sh [OPTIONS] +function help () { + echo "source q7s-env-win-sh [options] -t|--toolchain= -s|--sysroot=" +} + +TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" +SYSROOT="/c/Users/${USER}/eive-software/sysroots-petalinux-2019-2/cortexa9t2hf-neon-xilinx-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 ZYNQ_7020_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/common/config/devConf.h b/common/config/devConf.h index 8a35a0fa..d779e7bb 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -50,7 +50,7 @@ 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 = 921600; +static constexpr uint32_t PLOC_MPSOC_BAUD = 115200; static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200; static constexpr uint32_t STAR_TRACKER_BAUD = 921600; diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 5287b6e9..ff721967 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -339,6 +339,8 @@ void SpiTestClass::performMax1227Test() { std::string deviceName = ""; #elif defined(EGSE) std::string deviceName = ""; +#elif defined(TE0720_1CFA) + std::string deviceName = ""; #endif int fd = 0; UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface"); diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 7d39837d..00d407e8 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -4,4 +4,5 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) ) endif() +add_subdirectory(ploc) add_subdirectory(startracker) diff --git a/bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h similarity index 100% rename from bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h rename to linux/devices/devicedefinitions/PlocMPSoCDefinitions.h diff --git a/bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h b/linux/devices/devicedefinitions/PlocMemDumpDefinitions.h similarity index 100% rename from bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h rename to linux/devices/devicedefinitions/PlocMemDumpDefinitions.h diff --git a/bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h similarity index 100% rename from bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h rename to linux/devices/devicedefinitions/PlocSupervisorDefinitions.h diff --git a/bsp_q7s/devices/ploc/CMakeLists.txt b/linux/devices/ploc/CMakeLists.txt similarity index 100% rename from bsp_q7s/devices/ploc/CMakeLists.txt rename to linux/devices/ploc/CMakeLists.txt diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp similarity index 100% rename from bsp_q7s/devices/ploc/PlocMPSoCHandler.cpp rename to linux/devices/ploc/PlocMPSoCHandler.cpp diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h similarity index 99% rename from bsp_q7s/devices/ploc/PlocMPSoCHandler.h rename to linux/devices/ploc/PlocMPSoCHandler.h index 02c2a490..ec81451f 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -6,7 +6,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw/ipc/QueueFactory.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h" -#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h" +#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "PlocMPSoCHelper.h" /** diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp b/linux/devices/ploc/PlocMPSoCHelper.cpp similarity index 99% rename from bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp rename to linux/devices/ploc/PlocMPSoCHelper.cpp index e8bd118a..66f320b2 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHelper.cpp +++ b/linux/devices/ploc/PlocMPSoCHelper.cpp @@ -3,7 +3,10 @@ #include #include +#ifdef XIPHOS_Q7S #include "bsp_q7s/memory/FileSystemHelper.h" +#endif + #include "mission/utility/Timestamp.h" PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId) {} @@ -11,11 +14,13 @@ PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId) PlocMPSoCHelper::~PlocMPSoCHelper() {} ReturnValue_t PlocMPSoCHelper::initialize() { +#ifdef XIPHOS_Q7S sdcMan = SdCardManager::instance(); if (sdcMan == nullptr) { sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl; return RETURN_FAILED; } +#endif return RETURN_OK; } @@ -61,6 +66,7 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) { } ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) { +#ifdef XIPHOS_Q7S ReturnValue_t result = FilesystemHelper::checkPath(file); if (result != RETURN_OK) { return result; @@ -69,6 +75,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) { if (result != RETURN_OK) { return result; } +#endif flashWrite.file = file; internalState = InternalState::FLASH_WRITE; semaphore.release(); diff --git a/bsp_q7s/devices/ploc/PlocMPSoCHelper.h b/linux/devices/ploc/PlocMPSoCHelper.h similarity index 98% rename from bsp_q7s/devices/ploc/PlocMPSoCHelper.h rename to linux/devices/ploc/PlocMPSoCHelper.h index ac30ba49..05df63ad 100644 --- a/bsp_q7s/devices/ploc/PlocMPSoCHelper.h +++ b/linux/devices/ploc/PlocMPSoCHelper.h @@ -3,14 +3,16 @@ #include #include "fsfw/osal/linux/BinarySemaphore.h" -#include "bsp_q7s/memory/SdCardManager.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw/devicehandlers/CookieIF.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h" -#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h" +#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" +#ifdef XIPHOS_Q7S +#include "bsp_q7s/memory/SdCardManager.h" +#endif /** * @brief Helper class for MPSoC of PLOC intended to accelerate large data transfers between @@ -116,9 +118,9 @@ private: InternalState internalState = InternalState::IDLE; BinarySemaphore semaphore; - +#ifdef XIPHOS_Q7S SdCardManager* sdcMan = nullptr; - +#endif uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE]; bool terminate = false; diff --git a/bsp_q7s/devices/ploc/PlocMemoryDumper.cpp b/linux/devices/ploc/PlocMemoryDumper.cpp similarity index 100% rename from bsp_q7s/devices/ploc/PlocMemoryDumper.cpp rename to linux/devices/ploc/PlocMemoryDumper.cpp diff --git a/bsp_q7s/devices/ploc/PlocMemoryDumper.h b/linux/devices/ploc/PlocMemoryDumper.h similarity index 96% rename from bsp_q7s/devices/ploc/PlocMemoryDumper.h rename to linux/devices/ploc/PlocMemoryDumper.h index 2ee26824..559e7ec8 100644 --- a/bsp_q7s/devices/ploc/PlocMemoryDumper.h +++ b/linux/devices/ploc/PlocMemoryDumper.h @@ -1,8 +1,8 @@ #ifndef MISSION_DEVICES_PLOCMEMORYDUMPER_H_ #define MISSION_DEVICES_PLOCMEMORYDUMPER_H_ -#include -#include +#include +#include #include "OBSWConfig.h" #include "bsp_q7s/memory/SdCardManager.h" diff --git a/bsp_q7s/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp similarity index 100% rename from bsp_q7s/devices/ploc/PlocSupervisorHandler.cpp rename to linux/devices/ploc/PlocSupervisorHandler.cpp diff --git a/bsp_q7s/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h similarity index 99% rename from bsp_q7s/devices/ploc/PlocSupervisorHandler.h rename to linux/devices/ploc/PlocSupervisorHandler.h index c40037e2..43530944 100644 --- a/bsp_q7s/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -2,7 +2,7 @@ #define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ #include "OBSWconfig.h" -#include +#include #include #include #include diff --git a/bsp_q7s/devices/ploc/PlocUpdater.cpp b/linux/devices/ploc/PlocUpdater.cpp similarity index 100% rename from bsp_q7s/devices/ploc/PlocUpdater.cpp rename to linux/devices/ploc/PlocUpdater.cpp diff --git a/bsp_q7s/devices/ploc/PlocUpdater.h b/linux/devices/ploc/PlocUpdater.h similarity index 98% rename from bsp_q7s/devices/ploc/PlocUpdater.h rename to linux/devices/ploc/PlocUpdater.h index 52f8a6b8..1664442f 100644 --- a/bsp_q7s/devices/ploc/PlocUpdater.h +++ b/linux/devices/ploc/PlocUpdater.h @@ -2,7 +2,7 @@ #define MISSION_DEVICES_PLOCUPDATER_H_ #include "OBSWConfig.h" -#include +#include #include "fsfw/action/CommandActionHelper.h" #include "bsp_q7s/memory/SdCardManager.h" #include "fsfw/action/ActionHelper.h" diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 2941d9ca..34e1998e 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -10,6 +10,7 @@ #cmakedefine XIPHOS_Q7S #cmakedefine BEAGLEBONEBLACK #cmakedefine EGSE +#cmakedefine TE0720_1CFA #ifdef RASPBERRY_PI #include "rpiConfig.h" @@ -36,11 +37,11 @@ debugging. */ #define Q7S_EM 0 -#define OBSW_USE_CCSDS_IP_CORE 1 +#define OBSW_USE_CCSDS_IP_CORE 0 // Set to 1 if all telemetry should be sent to the PTME IP Core -#define OBSW_TM_TO_PTME 1 +#define OBSW_TM_TO_PTME 0 // Set to 1 if telecommands are received via the PDEC IP Core -#define OBSW_TC_FROM_PDEC 1 +#define OBSW_TC_FROM_PDEC 0 #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_MGT 1 @@ -69,6 +70,36 @@ debugging. */ #define OBSW_ADD_STAR_TRACKER 1 #endif +#ifdef TE0720_1CFA + +#define OBSW_USE_CCSDS_IP_CORE 0 +// Set to 1 if all telemetry should be sent to the PTME IP Core +#define OBSW_TM_TO_PTME 0 +// Set to 1 if telecommands are received via the PDEC IP Core +#define OBSW_TC_FROM_PDEC 0 +#define OBSW_ENABLE_TIMERS 1 +#define OBSW_ADD_MGT 0 +#define OBSW_ADD_BPX_BATTERY_HANDLER 0 +#define OBSW_ADD_STAR_TRACKER 0 +#define OBSW_ADD_PLOC_SUPERVISOR 0 +#define OBSW_ADD_PLOC_MPSOC 1 +#define OBSW_ADD_SUN_SENSORS 0 +#define OBSW_ADD_ACS_BOARD 1 +#define OBSW_ADD_ACS_HANDLERS 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_PL_PCDU 0 +#define OBSW_ADD_SYRLINKS 0 +#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 +#define OBSW_SYRLINKS_SIMULATED 1 +#define OBSW_STAR_TRACKER_GROUND_CONFIG 1 +#define OBSW_ENABLE_PERIODIC_HK 0 +#define OBSW_PRINT_CORE_HK 0 + +#endif + /*******************************************************************/ /** All of the following flags should be disabled for mission code */ /*******************************************************************/ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index bc8fa8cf..f512aad8 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -524,6 +524,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); +#ifndef TE0720_1CFA #if Q7S_EM != 1 // PCDU handlers receives two messages and both must be handled thisSequence->addSlot(objects::PCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -558,6 +559,7 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) { return HasReturnvaluesIF::RETURN_FAILED; } #endif /* Q7S_EM == 0 */ +#endif static_cast(length); return HasReturnvaluesIF::RETURN_OK; }