From a728a6d04b1a99f9ee4edc67462addf6d41fcb0f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Apr 2022 09:59:46 +0200 Subject: [PATCH 01/43] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 8f2ff303..2accfef0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8f2ff3034fff627b807f32c02fd9e676126bae5f +Subproject commit 2accfef011152afdee4974c0136a73e29b89de6b From a5881a238bbdccd2d9f7d0e822bfac82fd5df2e5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 9 Apr 2022 18:51:46 +0200 Subject: [PATCH 02/43] store time file with lower frequency --- bsp_q7s/core/CoreController.cpp | 22 +++++++++++++++------- tmtc | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 42ba4307..a99618ef 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1693,14 +1693,22 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C ReturnValue_t CoreController::timeFileHandler() { if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) { - // It is assumed that the system time is set from the GPS time - timeval currentTime = {}; - ReturnValue_t result = Clock::getClock_timeval(¤tTime); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; + if(opDivider.check()) { + // It is assumed that the system time is set from the GPS time + timeval currentTime = {}; + ReturnValue_t result = Clock::getClock_timeval(¤tTime); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + std::string fileName = currMntPrefix + TIME_FILE; + std::ofstream timeFile(fileName); + if (not timeFile.good()) { + sif::error << "CoreController::timeFileHandler: Error opening time file: " << + strerror(errno) << std::endl; + return RETURN_FAILED; + } + timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; } - std::ofstream timeFile(currMntPrefix + TIME_FILE); - timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; } return RETURN_OK; } diff --git a/tmtc b/tmtc index 9055281d..19768cb1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9055281da4c08c154b0cb7cf81bb94aed9e3d443 +Subproject commit 19768cb1b125568734e77432cc2c636637e4894d From d5bdc00abf235b981815adc09f0a78ac3c64cab2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 9 Apr 2022 18:56:32 +0200 Subject: [PATCH 03/43] start bpx batt immediately but defer it until the com mode was set to i2c --- bsp_q7s/core/ObjectFactory.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index d72beb8d..14f674cf 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -175,12 +175,8 @@ void ObjectFactory::produce(void* args) { I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV); BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie); -#if OBSW_TEST_BPX_BATT == 1 - bpxHandler->setToGoToNormalMode(true); - bpxHandler->setStartUpImmediately(); -#else - static_cast(bpxHandler); -#endif + //bpxHandler->setStartUpImmediately(); + //bpxHandler->setToGoToNormalMode(true); #endif new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); From 456f6ad6af312ae25c0706be945354e01ff2db4d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Apr 2022 14:43:24 +0200 Subject: [PATCH 04/43] submodule updates --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 85a6e4b1..cde987dd 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 85a6e4b12977f24247ed3ca3011c6f8b611a144e +Subproject commit cde987dd3599a8333c0b8aaca7ac7b9724a6c61d diff --git a/tmtc b/tmtc index 19768cb1..a6c91640 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 19768cb1b125568734e77432cc2c636637e4894d +Subproject commit a6c91640a15e1a1e1291ab9c300e93f96351ee5e From 5e0e8232dfef1dc371649fb8eee23c5054025f78 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Apr 2022 14:54:44 +0200 Subject: [PATCH 05/43] dev conf update for updated fsfw --- bsp_q7s/core/ObjectFactory.cpp | 6 +++--- common/config/devConf.h | 11 ++++++----- fsfw | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 14f674cf..48fbc2aa 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -175,8 +175,8 @@ void ObjectFactory::produce(void* args) { I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV); BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie); - //bpxHandler->setStartUpImmediately(); - //bpxHandler->setToGoToNormalMode(true); + bpxHandler->setStartUpImmediately(); + bpxHandler->setToGoToNormalMode(true); #endif new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); @@ -623,7 +623,7 @@ void ObjectFactory::createSolarArrayDeploymentComponents() { void ObjectFactory::createSyrlinksComponents() { UartCookie* syrlinksUartCookie = - new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, UartModes::NON_CANONICAL, + new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, syrlinks::MAX_REPLY_SIZE); syrlinksUartCookie->setParityEven(); diff --git a/common/config/devConf.h b/common/config/devConf.h index 7e09b50f..abb3b3e1 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -3,6 +3,7 @@ #include #include +#include /** * SPI configuration will be contained here to let the device handlers remain independent @@ -49,11 +50,11 @@ static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3; 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_SUPERVISOR_BAUD = 115200; -static constexpr uint32_t STAR_TRACKER_BAUD = 921600; +static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400; +static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600; +static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200; +static constexpr UartBaudRate PLOC_SUPERVISOR_BAUD = UartBaudRate::RATE_115200; +static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600; } diff --git a/fsfw b/fsfw index cde987dd..28166ee1 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit cde987dd3599a8333c0b8aaca7ac7b9724a6c61d +Subproject commit 28166ee19ee0154dc1849ec0bbf1fef2cf71115d From 604870d1fefee98325baaeb42df520d7b72efda9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Apr 2022 15:27:48 +0200 Subject: [PATCH 06/43] split up op divider, assing imtq power switcher --- bsp_q7s/core/CoreController.cpp | 39 +++++++++++++++++--------------- bsp_q7s/core/CoreController.h | 3 ++- bsp_q7s/core/ObjectFactory.cpp | 5 ++-- linux/fsfwconfig/OBSWConfig.h.in | 5 ++-- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index a99618ef..4e7bb02b 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -29,7 +29,8 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP; xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY; CoreController::CoreController(object_id_t objectId) - : ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5), hkSet(this) { + : ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider5(5), opDivider10(10), + hkSet(this) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; try { result = initWatchdogFifo(); @@ -75,6 +76,8 @@ void CoreController::performControlOperation() { sdStateMachine(); performMountedSdCardOperations(); readHkData(); + opDivider5.checkAndIncrement(); + opDivider10.checkAndIncrement(); } ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, @@ -1200,7 +1203,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) { void CoreController::performWatchdogControlOperation() { // Only perform each fifth iteration - if (watchdogFifoFd != 0 and opDivider.checkAndIncrement()) { + if (watchdogFifoFd != 0 and opDivider5.check()) { if (watchdogFifoFd == RETRY_FIFO_OPEN) { // Open FIFO write only and non-blocking watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK); @@ -1692,23 +1695,23 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C } ReturnValue_t CoreController::timeFileHandler() { - if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) { - if(opDivider.check()) { - // It is assumed that the system time is set from the GPS time - timeval currentTime = {}; - ReturnValue_t result = Clock::getClock_timeval(¤tTime); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - std::string fileName = currMntPrefix + TIME_FILE; - std::ofstream timeFile(fileName); - if (not timeFile.good()) { - sif::error << "CoreController::timeFileHandler: Error opening time file: " << - strerror(errno) << std::endl; - return RETURN_FAILED; - } - timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; + // Always set time. We could only set it if it is updated by GPS, but then the backup time would + // become obsolete on GPS problems. + if(opDivider10.check()) { + // It is assumed that the system time is set from the GPS time + timeval currentTime = {}; + ReturnValue_t result = Clock::getClock_timeval(¤tTime); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; } + std::string fileName = currMntPrefix + TIME_FILE; + std::ofstream timeFile(fileName); + if (not timeFile.good()) { + sif::error << "CoreController::timeFileHandler: Error opening time file: " << + strerror(errno) << std::endl; + return RETURN_FAILED; + } + timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; } return RETURN_OK; } diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index b5e4e511..1af85d48 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -188,7 +188,8 @@ class CoreController : public ExtendedControllerBase { * Index 3: Chip 1 Copy 1 */ std::array protArray; - PeriodicOperationDivider opDivider; + PeriodicOperationDivider opDivider5; + PeriodicOperationDivider opDivider10; core::HkSet hkSet; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 48fbc2aa..062b0889 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -161,12 +161,11 @@ void ObjectFactory::produce(void* args) { I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); + imtqHandler->setPowerSwitcher(pwrSwitcher); static_cast(imtqHandler); -#if OBSW_DEBUG_IMTQ == 1 +#if OBSW_TEST_IMTQ == 1 imtqHandler->setStartUpImmediately(); imtqHandler->setToGoToNormal(true); -#else - (void)imtqHandler; #endif #endif createReactionWheelComponents(gpioComIF); diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index bbf8da64..b2430bb7 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -127,6 +127,8 @@ debugging. */ #define OBSW_DEBUG_PL_PCDU 0 #define OBSW_TEST_BPX_BATT 0 #define OBSW_DEBUG_BPX_BATT 0 +#define OBSW_TEST_IMTQ 0 +#define OBSW_DEBUG_IMTQ 0 #define OBSW_TEST_LIBGPIOD 0 #define OBSW_TEST_PLOC_HANDLER 0 @@ -143,9 +145,8 @@ debugging. */ #define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_SYRLINKS 0 -#define OBSW_DEBUG_IMTQ 0 #define OBSW_DEBUG_RW 0 -#define OBSW_DEBUG_PDEC_HANDLER 0 +#define OBSW_DEBUG_PDEC_HANDLER 0 #ifdef TE0720_1CFA #define OBSW_DEBUG_PLOC_SUPERVISOR 1 From 3e4d728b10d91ca580d7179409463486a0cf9c43 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Apr 2022 18:44:35 +0200 Subject: [PATCH 07/43] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 28166ee1..cd3153b4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 28166ee19ee0154dc1849ec0bbf1fef2cf71115d +Subproject commit cd3153b4640cec7428ebf71fbfbf0b2a1c5e1de3 From 25138d8931845ca900e71f0e534389a1b44c2333 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Apr 2022 09:42:59 +0200 Subject: [PATCH 08/43] update --- bsp_q7s/callbacks/pcduSwitchCb.cpp | 8 +- common/config/devices/powerSwitcherList.h | 68 +- generators/fsfwgen | 2 +- linux/ObjectFactory.cpp | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- linux/csp/CspComIF.cpp | 3 +- linux/devices/GPSHyperionLinuxController.cpp | 1 - misc/eclipse/.cproject | 71 +- mission/devices/GomspaceDeviceHandler.cpp | 146 ++++ mission/devices/GomspaceDeviceHandler.h | 6 + mission/devices/IMTQHandler.cpp | 19 +- mission/devices/P60DockHandler.cpp | 8 +- mission/devices/PCDUHandler.cpp | 354 ++------- mission/devices/PCDUHandler.h | 19 +- mission/devices/PDU1Handler.cpp | 463 ++--------- mission/devices/PDU1Handler.h | 3 +- mission/devices/PDU2Handler.cpp | 437 ++-------- mission/devices/PDU2Handler.h | 3 +- .../devices/SolarArrayDeploymentHandler.cpp | 2 +- mission/devices/SolarArrayDeploymentHandler.h | 4 +- .../devicedefinitions/GomspaceDefinitions.h | 745 ++++++------------ mission/system/AcsBoardAssembly.cpp | 2 + mission/system/AcsBoardAssembly.h | 6 +- mission/system/DualLaneAssemblyBase.cpp | 7 +- mission/system/DualLaneAssemblyBase.h | 5 +- mission/system/SusAssembly.h | 6 +- tmtc | 2 +- 27 files changed, 658 insertions(+), 1736 deletions(-) diff --git a/bsp_q7s/callbacks/pcduSwitchCb.cpp b/bsp_q7s/callbacks/pcduSwitchCb.cpp index ec5f4dc5..f9b6c761 100644 --- a/bsp_q7s/callbacks/pcduSwitchCb.cpp +++ b/bsp_q7s/callbacks/pcduSwitchCb.cpp @@ -10,8 +10,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* return; } if (pdu == GOMSPACE::Pdu::PDU1) { - PDU1::SwitchChannels typedChannel = static_cast(channel); - if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) { + PDU1::Channels typedChannel = static_cast(channel); + if (typedChannel == PDU1::Channels::ACS_A_SIDE) { if (state) { gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET); } else { @@ -20,8 +20,8 @@ void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* } } else if (pdu == GOMSPACE::Pdu::PDU2) { - PDU2::SwitchChannels typedChannel = static_cast(channel); - if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) { + PDU2::Channels typedChannel = static_cast(channel); + if (typedChannel == PDU2::Channels::ACS_B_SIDE) { if (state) { gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET); } else { diff --git a/common/config/devices/powerSwitcherList.h b/common/config/devices/powerSwitcherList.h index 1981bb9c..d032428b 100644 --- a/common/config/devices/powerSwitcherList.h +++ b/common/config/devices/powerSwitcherList.h @@ -1,72 +1,6 @@ #ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ #define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ -#include "OBSWConfig.h" - -#include - -#include -#include - -namespace pcduSwitches { - -/* Switches are uint8_t datatype and go from 0 to 255 */ -enum Switches: power::Switch_t { - PDU1_CH0_TCS_BOARD_3V3, - PDU1_CH1_SYRLINKS_12V, - PDU1_CH2_STAR_TRACKER_5V, - PDU1_CH3_MGT_5V, - PDU1_CH4_SUS_NOMINAL_3V3, - PDU1_CH5_SOLAR_CELL_EXP_5V, - PDU1_CH6_PLOC_12V, - PDU1_CH7_ACS_A_SIDE_3V3, - PDU1_CH8_UNOCCUPIED, - - PDU2_CH0_Q7S, - PDU2_CH1_PL_PCDU_BATT_0_14V8, - PDU2_CH2_RW_5V, - PDU2_CH3_TCS_BOARD_HEATER_IN_8V, - PDU2_CH4_SUS_REDUNDANT_3V3, - PDU2_CH5_DEPLOYMENT_MECHANISM_8V, - PDU2_CH6_PL_PCDU_BATT_1_14V8, - PDU2_CH7_ACS_BOARD_SIDE_B_3V3, - PDU2_CH8_PAYLOAD_CAMERA, - NUMBER_OF_SWITCHES -}; - -static const uint8_t ON = 1; -static const uint8_t OFF = 0; - -// Output states after reboot of the PDUs - -const std::array INIT_SWITCH_STATES = { - // PDU 1 -// Because the TE0720 is not connected to the PCDU, this switch is always on -#ifdef TE0720_1CFA - ON, -#else - OFF, -#endif - OFF, - OFF, - OFF, - OFF, - OFF, - OFF, - OFF, - OFF, - - // PDU 2 - ON, - OFF, - OFF, - OFF, - OFF, - OFF, - OFF, - OFF, - OFF -}; -} +#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" #endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */ diff --git a/generators/fsfwgen b/generators/fsfwgen index 5ad9fb94..9a92c7de 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5 +Subproject commit 9a92c7de0a2fedfcc638c0517e3edea123e977f8 diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 267b5f4d..7811fdbe 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -280,7 +280,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, TcsBoardHelper helper(rtdIds); TcsBoardAssembly* tcsBoardAss = new TcsBoardAssembly(objects::TCS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, - pcduSwitches::Switches::PDU1_CH0_TCS_BOARD_3V3, helper); + pcdu::Switches::PDU1_CH0_TCS_BOARD_3V3, helper); static_cast(tcsBoardAss); #endif // OBSW_ADD_RTD_DEVICES == 1 } diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index ff721967..d9eb6b5a 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -408,7 +408,7 @@ void SpiTestClass::max1227RadSensorTest(int fd) { transfer(fd, gpioIds::CS_RAD_SENSOR); usleep(65); spiTransferStruct[0].len = 24; - std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, 24); + std::memmove(sendBuffer.data(), sendBuffer.data() + 1, 24); transfer(fd, gpioIds::CS_RAD_SENSOR); int16_t tempRaw = ((recvBuffer[22] & 0x0f) << 8) | recvBuffer[23]; float temp = max1227::getTemperature(tempRaw); diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index fa372d4d..9f346405 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -141,11 +141,12 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u int cmdLen, uint16_t querySize) { uint32_t timeout_ms = 1000; uint16_t bytesRead = 0; - int32_t expectedSize = (int32_t)querySize; + int32_t expectedSize = static_cast(querySize); vectorBufferIter iter = cspDeviceMap.find(cspAddress); if (iter == cspDeviceMap.end()) { sif::error << "CSP device with address " << cspAddress << " no found in" << " device map" << std::endl; + return RETURN_FAILED; } uint8_t* replyBuffer = iter->second.data(); diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index d1ef7d1b..20860211 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -3,7 +3,6 @@ #include "OBSWConfig.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/timemanager/Clock.h" - #include "linux/utility/utility.h" #include "mission/utility/compileTime.h" diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index aa59f2da..6e4535c1 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -756,6 +756,7 @@ + @@ -818,8 +819,8 @@ @@ -755,8 +758,8 @@ - + @@ -909,7 +912,7 @@ - + diff --git a/misc/eclipse/.project b/misc/eclipse/.project index 62145ff4..86d98589 100644 --- a/misc/eclipse/.project +++ b/misc/eclipse/.project @@ -7,7 +7,7 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, + full,incremental, From a4c5d8de45beef9b4388a3b8479b9dce7e2d6376 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Apr 2022 00:25:33 +0200 Subject: [PATCH 18/43] adaptions for gpsd 3.17 --- CMakeLists.txt | 4 ++-- bsp_q7s/boardtest/Q7STestTask.cpp | 4 ++-- linux/devices/GPSHyperionLinuxController.cpp | 16 ++++++++++------ linux/devices/GPSHyperionLinuxController.h | 1 - 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fe8ea55..036e2345 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,7 @@ if(TGT_BSP) OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse" OR TGT_BSP MATCHES "arm/te0720-1cfa" ) + find_library(${LIB_GPS} gps) set(FSFW_CONFIG_PATH "linux/fsfwconfig") if(NOT BUILD_Q7S_SIMPLE_MODE) set(EIVE_ADD_LINUX_FILES TRUE) @@ -310,8 +311,8 @@ target_link_libraries(${OBSW_NAME} PRIVATE if(TGT_BSP MATCHES "arm/q7s") target_link_libraries(${LIB_EIVE_MISSION} PUBLIC - ${LIB_ARCSEC} ${LIB_GPS} + ${LIB_ARCSEC} ) endif() @@ -407,6 +408,5 @@ add_custom_command( COMMENT ${POST_BUILD_COMMENT} ) - include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) set_build_type() diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 8b96450f..a33d4a95 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -246,7 +246,7 @@ void Q7STestTask::testGpsDaemon() { sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl; } sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl; - time_t timeRaw = gps->fix.time.tv_sec; + time_t timeRaw = gps->fix.time; std::tm* time = gmtime(&timeRaw); sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl; sif::info << "Visible satellites: " << gps->satellites_visible << std::endl; @@ -254,7 +254,7 @@ void Q7STestTask::testGpsDaemon() { sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; sif::info << "Latitude: " << gps->fix.latitude << std::endl; sif::info << "Longitude: " << gps->fix.longitude << std::endl; - sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl; + sif::info << "Altitude(MSL): " << gps->fix.altitude << std::endl; sif::info << "Speed(m/s): " << gps->fix.speed << std::endl; } diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 169b9618..172c5fef 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -18,7 +18,6 @@ GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, obj bool debugHyperionGps) : ExtendedControllerBase(objectId, objects::NO_OBJECT), gpsSet(this), - myGpsmm(GPSD_SHARED_MEMORY, nullptr), debugHyperionGps(debugHyperionGps) { timeUpdateCd.resetTimer(); } @@ -107,14 +106,17 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m #ifdef FSFW_OSAL_LINUX void GPSHyperionLinuxController::readGpsDataFromGpsd() { + gpsmm myGpsmm(GPSD_SHARED_MEMORY, nullptr); // The data from the device will generally be read all at once. Therefore, we // can set all field here if (not myGpsmm.is_open()) { if(gpsNotOpenSwitch) { // Opening failed #if FSFW_VERBOSE_LEVEL >= 1 - sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed" << std::endl; + sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed | " << + "Error " << errno << " | " << gps_errstr(errno) << std::endl; #endif + gpsNotOpenSwitch = false; } return; @@ -189,10 +191,12 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { gpsSet.speed.setValid(false); } - gpsSet.unixSeconds.value = gps->fix.time.tv_sec; + gpsSet.unixSeconds.value = gps->fix.time; timeval time = {}; time.tv_sec = gpsSet.unixSeconds.value; - time.tv_usec = gps->fix.time.tv_nsec / 1000; + double fractionalPart = gpsSet.unixSeconds.value - gps->fix.time; + time.tv_usec = fractionalPart * 1000 * 1000; + //time.tv_usec = gps->fix.time.tv_nsec / 1000; std::time_t t = std::time(nullptr); if (time.tv_sec == t) { timeIsConstantCounter++; @@ -231,7 +235,7 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { gpsSet.seconds = timeOfDay.second; if (debugHyperionGps) { sif::info << "-- Hyperion GPS Data --" << std::endl; - time_t timeRaw = gps->fix.time.tv_sec; + time_t timeRaw = gps->fix.time; std::tm *time = gmtime(&timeRaw); std::cout << "Time: " << std::put_time(time, "%c %Z") << std::endl; std::cout << "Visible satellites: " << gps->satellites_visible << std::endl; @@ -239,7 +243,7 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { std::cout << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; std::cout << "Latitude: " << gps->fix.latitude << std::endl; std::cout << "Longitude: " << gps->fix.longitude << std::endl; - std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl; + std::cout << "Altitude(MSL): " << gps->fix.altitude << std::endl; std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; std::time_t t = std::time(nullptr); std::tm tm = *std::gmtime(&t); diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 91f6fc8c..42e9741b 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -52,7 +52,6 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000); bool modeCommanded = true; bool timeInit = true; - gpsmm myGpsmm; bool gpsNotOpenSwitch = true; bool gpsReadFailedSwitch = true; bool debugHyperionGps = false; From d12b5958b9e4ad0cbdfaf5ca13040d4b5cea4f77 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Apr 2022 21:49:04 +0200 Subject: [PATCH 19/43] update q7s-evn script and generate stripped watchdog bin --- cmake/HardwareOsPostConfig.cmake | 9 +++++++++ cmake/scripts/Q7S/q7s-env.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/HardwareOsPostConfig.cmake b/cmake/HardwareOsPostConfig.cmake index e7fb257a..841085f5 100644 --- a/cmake/HardwareOsPostConfig.cmake +++ b/cmake/HardwareOsPostConfig.cmake @@ -42,6 +42,7 @@ add_compile_options( ) set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped) +set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped) add_custom_command( TARGET ${OBSW_NAME} @@ -51,4 +52,12 @@ add_custom_command( COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.." ) +add_custom_command( + TARGET ${WATCHDOG_NAME} + POST_BUILD + COMMAND ${CMAKE_STRIP} --strip-all eive-watchdog -o ${STRIPPED_WATCHDOG_NAME} + BYPRODUCTS ${STRIPPED_WATCHDOG_NAME} + COMMENT "Generating stripped executable ${STRIPPED_WATCHDOG_NAME}.." +) + endfunction() \ No newline at end of file diff --git a/cmake/scripts/Q7S/q7s-env.sh b/cmake/scripts/Q7S/q7s-env.sh index df9dbadc..1c273a60 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 ZYNQ_7020_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi" +export ZYNQ_7020_SYSROOT="$HOME/Xilinx/eive-compile-rootfs" export CONSOLE_PREFIX="[Q7S ENV]" /bin/bash From 1fb5b48455a7315fd77711dbd6c9260e017ed619 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:18:31 +0200 Subject: [PATCH 20/43] fix initializer list order --- mission/devices/IMTQHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/devices/IMTQHandler.cpp b/mission/devices/IMTQHandler.cpp index 2b3ba240..ad6beb0a 100644 --- a/mission/devices/IMTQHandler.cpp +++ b/mission/devices/IMTQHandler.cpp @@ -10,7 +10,6 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, power::Switch_t pwrSwitcher) : DeviceHandlerBase(objectId, comIF, comCookie), - switcher(pwrSwitcher), engHkDataset(this), calMtmMeasurementSet(this), rawMtmMeasurementSet(this), @@ -19,7 +18,8 @@ IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comC posYselfTestDataset(this), negYselfTestDataset(this), posZselfTestDataset(this), - negZselfTestDataset(this) { + negZselfTestDataset(this), + switcher(pwrSwitcher) { if (comCookie == NULL) { sif::error << "IMTQHandler: Invalid com cookie" << std::endl; } From 850722eae5a5f47bc6e9fa35ec5a7e3bedf72c00 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:24:04 +0200 Subject: [PATCH 21/43] include improvements --- bsp_q7s/core/CoreController.cpp | 2 +- bsp_q7s/core/obsw.cpp | 2 +- watchdog/Watchdog.cpp | 2 +- watchdog/definitions.h | 2 ++ watchdog/watchdogConf.h.in | 2 -- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 42ba4307..73fd49bb 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -8,7 +8,7 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/timemanager/Stopwatch.h" #include "fsfw/version.h" -#include "watchdogConf.h" +#include "watchdog/definitions.h" #if OBSW_USE_TMTC_TCP_BRIDGE == 0 #include "fsfw/osal/common/UdpTmTcBridge.h" #else diff --git a/bsp_q7s/core/obsw.cpp b/bsp_q7s/core/obsw.cpp index 27d1484e..359d04c2 100644 --- a/bsp_q7s/core/obsw.cpp +++ b/bsp_q7s/core/obsw.cpp @@ -8,7 +8,7 @@ #include "OBSWVersion.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/version.h" -#include "watchdogConf.h" +#include "watchdog/definitions.h" static int OBSW_ALREADY_RUNNING = -2; diff --git a/watchdog/Watchdog.cpp b/watchdog/Watchdog.cpp index 9ae60548..a14bae53 100644 --- a/watchdog/Watchdog.cpp +++ b/watchdog/Watchdog.cpp @@ -1,5 +1,5 @@ #include "Watchdog.h" -#include "watchdogConf.h" +#include "definitions.h" #include #include diff --git a/watchdog/definitions.h b/watchdog/definitions.h index 991de54d..bfb1ec13 100644 --- a/watchdog/definitions.h +++ b/watchdog/definitions.h @@ -1,6 +1,8 @@ #ifndef WATCHDOG_DEFINITIONS_H_ #define WATCHDOG_DEFINITIONS_H_ +#include + namespace watchdog { // Suspend watchdog operations temporarily diff --git a/watchdog/watchdogConf.h.in b/watchdog/watchdogConf.h.in index b1b9956b..41bebe72 100644 --- a/watchdog/watchdogConf.h.in +++ b/watchdog/watchdogConf.h.in @@ -1,8 +1,6 @@ #include #include -#include "watchdog/definitions.h" - #define WATCHDOG_VERBOSE_LEVEL 1 /** * This flag instructs the watchdog to create a special file in /tmp if the OBSW is running From 49561617015a8423adebafc1e5566653ddacaa4d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:47:05 +0200 Subject: [PATCH 22/43] support both gps versions --- CMakeLists.txt | 7 +++++-- bsp_q7s/boardtest/Q7STestTask.cpp | 8 ++++++++ linux/devices/GPSHyperionLinuxController.cpp | 20 ++++++++++++++++++-- linux/fsfwconfig/OBSWConfig.h.in | 3 +++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 036e2345..2ef85e12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,9 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) + set(LIBGPS_VERSION_MAJOR 3) + # I assume a newer version than 3.17 will be installed on other Linux board than the Q7S + set(LIBGPS_VERSION_MINOR 20) 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/te0720-1cfa" @@ -134,6 +137,8 @@ if(TGT_BSP) if(TGT_BSP MATCHES "arm/q7s") # Used by configure file set(XIPHOS_Q7S ON) + set(LIBGPS_VERSION_MAJOR 3) + set(LIBGPS_VERSION_MINOR 17) endif() if(TGT_BSP MATCHES "arm/te0720-1cfa") @@ -155,8 +160,6 @@ elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse") configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) endif() - - configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h) # Set common config path for FSFW diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index a33d4a95..c3eb37ca 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -246,7 +246,11 @@ void Q7STestTask::testGpsDaemon() { sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl; } sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl; +#if LIBGPS_VERSION_MINOR <= 17 time_t timeRaw = gps->fix.time; +#else + time_t timeRaw = gps->fix.time.tv_sec; +#endif std::tm* time = gmtime(&timeRaw); sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl; sif::info << "Visible satellites: " << gps->satellites_visible << std::endl; @@ -254,7 +258,11 @@ void Q7STestTask::testGpsDaemon() { sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; sif::info << "Latitude: " << gps->fix.latitude << std::endl; sif::info << "Longitude: " << gps->fix.longitude << std::endl; +#if LIBGPS_VERSION_MINOR <= 17 sif::info << "Altitude(MSL): " << gps->fix.altitude << std::endl; +#else + sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl; +#endif sif::info << "Speed(m/s): " << gps->fix.speed << std::endl; } diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index 172c5fef..2fb4f255 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -191,11 +191,19 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { gpsSet.speed.setValid(false); } +#if LIBGPS_VERSION_MINOR <= 17 gpsSet.unixSeconds.value = gps->fix.time; +#else + gpsSet.unixSeconds.value = gps->fix.time.tv_sec; +#endif timeval time = {}; time.tv_sec = gpsSet.unixSeconds.value; - double fractionalPart = gpsSet.unixSeconds.value - gps->fix.time; - time.tv_usec = fractionalPart * 1000 * 1000; +#if LIBGPS_VERSION_MINOR <= 17 + double fractionalPart = gps->fix.time - std::floor(gps->fix.time); + time.tv_usec = fractionalPart * 1000.0 * 1000.0; +#else + time.tv_usec = gps->fix.time.tv_nsec / 1000; +#endif //time.tv_usec = gps->fix.time.tv_nsec / 1000; std::time_t t = std::time(nullptr); if (time.tv_sec == t) { @@ -235,7 +243,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { gpsSet.seconds = timeOfDay.second; if (debugHyperionGps) { sif::info << "-- Hyperion GPS Data --" << std::endl; +#if LIBGPS_VERSION_MINOR <= 17 time_t timeRaw = gps->fix.time; +#else + time_t timeRaw = gps->fix.time.tv_sec; +#endif std::tm *time = gmtime(&timeRaw); std::cout << "Time: " << std::put_time(time, "%c %Z") << std::endl; std::cout << "Visible satellites: " << gps->satellites_visible << std::endl; @@ -243,7 +255,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() { std::cout << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; std::cout << "Latitude: " << gps->fix.latitude << std::endl; std::cout << "Longitude: " << gps->fix.longitude << std::endl; +#if LIBGPS_VERSION_MINOR <= 17 std::cout << "Altitude(MSL): " << gps->fix.altitude << std::endl; +#else + std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl; +#endif std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; std::time_t t = std::time(nullptr); std::tm tm = *std::gmtime(&t); diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index b2430bb7..55e6e8c5 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -192,6 +192,9 @@ debugging. */ /*******************************************************************/ #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER +#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ +#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@ + #ifdef RASPBERRY_PI #include "rpiConfig.h" #elif defined(XIPHOS_Q7S) From c3238ab1548cc3a5e4fb62ac33c6952cf9092405 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Apr 2022 17:51:53 +0200 Subject: [PATCH 23/43] update .cproject file --- misc/eclipse/.cproject | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 22969d11..b0f56271 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -589,7 +589,7 @@ - + @@ -603,7 +603,7 @@ - +