RW Assembly #224

Merged
meierj merged 53 commits from mueller/rw-ass into develop 2022-05-11 17:03:32 +02:00
19 changed files with 134 additions and 55 deletions
Showing only changes of commit 3fbebd6a9f - Show all commits

View File

@ -16,7 +16,10 @@ set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(EIVE_ADD_ETL_LIB "Add ETL library" ON) option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON) option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_HARDCODED_TOOLCHAIN_FILE "\
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
if a different toolchain file is set externally" ON
)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF) option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON) option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
@ -41,7 +44,7 @@ include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config() pre_project_config()
# Check whether the user has already installed Catch2 first. This has to come before # Check whether the user has already installed Catch2 first. This has to come before
# the project call. We could also exlcude doing this when the Q7S primary OBSW is built.. # the project call. We could also exclude doing this when the Q7S primary OBSW is built..
find_package(Catch2 3 CONFIG QUIET) find_package(Catch2 3 CONFIG QUIET)
# Project Name # Project Name
@ -99,10 +102,14 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
pre_source_hw_os_config() pre_source_hw_os_config()
if(TGT_BSP) 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" 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" OR TGT_BSP MATCHES "arm/te0720-1cfa"
) )
find_library(${LIB_GPS} gps)
set(FSFW_CONFIG_PATH "linux/fsfwconfig") set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE) if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE) set(EIVE_ADD_LINUX_FILES TRUE)
@ -133,6 +140,8 @@ if(TGT_BSP)
if(TGT_BSP MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
# Used by configure file # Used by configure file
set(XIPHOS_Q7S ON) set(XIPHOS_Q7S ON)
set(LIBGPS_VERSION_MAJOR 3)
set(LIBGPS_VERSION_MINOR 17)
endif() endif()
if(TGT_BSP MATCHES "arm/te0720-1cfa") if(TGT_BSP MATCHES "arm/te0720-1cfa")
@ -154,8 +163,6 @@ elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif() endif()
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h) configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
# Set common config path for FSFW # Set common config path for FSFW
@ -243,8 +250,13 @@ else()
endif() endif()
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME}) set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
#watchdog # Watchdog
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL) if(TGT_BSP MATCHES "arm/q7s")
add_executable(${WATCHDOG_NAME})
else()
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
endif()
add_subdirectory(${WATCHDOG_PATH}) add_subdirectory(${WATCHDOG_PATH})
target_link_libraries(${WATCHDOG_NAME} PUBLIC target_link_libraries(${WATCHDOG_NAME} PUBLIC
${LIB_CXX_FS} ${LIB_CXX_FS}
@ -310,8 +322,8 @@ target_link_libraries(${OBSW_NAME} PRIVATE
if(TGT_BSP MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
${LIB_ARCSEC}
${LIB_GPS} ${LIB_GPS}
${LIB_ARCSEC}
) )
endif() endif()
@ -369,7 +381,7 @@ endif()
if(${CMAKE_CROSSCOMPILING}) if(CMAKE_CROSSCOMPILING)
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake) include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
post_source_hw_os_config() post_source_hw_os_config()
endif() endif()
@ -391,6 +403,8 @@ else()
endif() endif()
endif() endif()
install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin)
string(CONCAT POST_BUILD_COMMENT string(CONCAT POST_BUILD_COMMENT
"Build directory: ${CMAKE_BINARY_DIR}\n" "Build directory: ${CMAKE_BINARY_DIR}\n"
"Target OSAL: ${FSFW_OSAL}\n" "Target OSAL: ${FSFW_OSAL}\n"
@ -405,6 +419,5 @@ add_custom_command(
COMMENT ${POST_BUILD_COMMENT} COMMENT ${POST_BUILD_COMMENT}
) )
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
set_build_type() set_build_type()

View File

@ -163,23 +163,26 @@ automatically.
The EIVE OBSW is the default target if no target is specified. The EIVE OBSW is the default target if no target is specified.
**Debug**
```sh ```sh
mkdir build-Debug-Q7S && cd build-Debug-Q7S mkdir build-Debug-Q7S && cd build-Debug-Q7S
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug .. cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j cmake --build . -j
``` ```
### Q7S Watchdog **Release**
To build the EIVE watchdog, the corresponding target must be specified in the build command.
The configure steps do not need to be repeated if the folder has already been configured.
```sh ```sh
mkdir build-Debug-Watchdog && cd build-Debug-Watchdog mkdir build-Release-Q7S && cd build-Release-Q7S
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug .. cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target eive-watchdog -j cmake --build . -j
``` ```
### Q7S Watchdog
The watchdog will be built along side the primary OBSW binary.
### Hosted ### Hosted
You can also use the FSFW OSAL `host` to build on Windows or for generic OSes. You can also use the FSFW OSAL `host` to build on Windows or for generic OSes.

View File

@ -8,13 +8,13 @@ RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov
# Q7S root filesystem, required for cross-compilation. # Q7S root filesystem, required for cross-compilation.
RUN mkdir -p /usr/rootfs; \ RUN mkdir -p /usr/rootfs; \
curl https://buggy.irs.uni-stuttgart.de/eive/tools/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \ curl https://buggy.irs.uni-stuttgart.de/eive/tools/eive-compile-rootfs-v0.1.0-7-gae69838.tar.xz \
| tar -xz -C /usr/rootfs | tar -xJ -C /usr/rootfs
# Cross compiler # Cross compiler
RUN mkdir -p /usr/tools; \ RUN mkdir -p /usr/tools; \
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \ curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
| tar -xz -C /usr/tools | tar -xz -C /usr/tools
ENV ZYNQ_7020_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi" ENV ZYNQ_7020_SYSROOT="/usr/rootfs/eive-compile-rootfs"
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin" ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"

View File

@ -5,7 +5,7 @@ pipeline {
} }
agent { agent {
docker { docker {
image 'eive-obsw-ci:d3' image 'eive-obsw-ci:d4'
args '--sysctl fs.mqueue.msg_max=100' args '--sysctl fs.mqueue.msg_max=100'
} }
} }

View File

@ -8,7 +8,7 @@ static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive"; static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
static constexpr char UART_GNSS_DEV[] = "/dev/ul-gps"; static constexpr char UART_GNSS_DEV[] = "/dev/gps0";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks"; static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";

View File

@ -246,7 +246,11 @@ void Q7STestTask::testGpsDaemon() {
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl; sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
} }
sif::info << "-- Q7STestTask: GPS shared memory read test --" << 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; time_t timeRaw = gps->fix.time.tv_sec;
#endif
std::tm* time = gmtime(&timeRaw); std::tm* time = gmtime(&timeRaw);
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl; sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
sif::info << "Visible satellites: " << gps->satellites_visible << 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 << "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 << "Latitude: " << gps->fix.latitude << std::endl;
sif::info << "Longitude: " << gps->fix.longitude << 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; sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
#endif
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl; sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
} }

View File

@ -29,7 +29,10 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY; xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId) 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; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
try { try {
result = initWatchdogFifo(); result = initWatchdogFifo();
@ -75,6 +78,8 @@ void CoreController::performControlOperation() {
sdStateMachine(); sdStateMachine();
performMountedSdCardOperations(); performMountedSdCardOperations();
readHkData(); readHkData();
opDivider5.checkAndIncrement();
opDivider10.checkAndIncrement();
} }
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
@ -141,7 +146,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
} }
// Add script folder to path // Add script folder to path
char *currentEnvPath = getenv("PATH"); char *currentEnvPath = getenv("PATH");
std::string updatedEnvPath = std::string(currentEnvPath) + ":/home/root/scripts"; std::string updatedEnvPath = std::string(currentEnvPath) + ":/home/root/scripts:/usr/local/bin";
setenv("PATH", updatedEnvPath.c_str(), true); setenv("PATH", updatedEnvPath.c_str(), true);
updateProtInfo(); updateProtInfo();
initPrint(); initPrint();
@ -1200,7 +1205,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
void CoreController::performWatchdogControlOperation() { void CoreController::performWatchdogControlOperation() {
// Only perform each fifth iteration // Only perform each fifth iteration
if (watchdogFifoFd != 0 and opDivider.checkAndIncrement()) { if (watchdogFifoFd != 0 and opDivider5.check()) {
if (watchdogFifoFd == RETRY_FIFO_OPEN) { if (watchdogFifoFd == RETRY_FIFO_OPEN) {
// Open FIFO write only and non-blocking // Open FIFO write only and non-blocking
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK); watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
@ -1692,14 +1697,22 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C
} }
ReturnValue_t CoreController::timeFileHandler() { ReturnValue_t CoreController::timeFileHandler() {
if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) { // 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 // It is assumed that the system time is set from the GPS time
timeval currentTime = {}; timeval currentTime = {};
ReturnValue_t result = Clock::getClock_timeval(&currentTime); ReturnValue_t result = Clock::getClock_timeval(&currentTime);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
std::ofstream timeFile(currMntPrefix + TIME_FILE); 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; timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
} }
return RETURN_OK; return RETURN_OK;

View File

@ -48,7 +48,7 @@ class CoreController : public ExtendedControllerBase {
static xsc::Chip CURRENT_CHIP; static xsc::Chip CURRENT_CHIP;
static xsc::Copy CURRENT_COPY; static xsc::Copy CURRENT_COPY;
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh"; static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh";
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt"; static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt"; static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
static constexpr char CONF_FOLDER[] = "conf"; static constexpr char CONF_FOLDER[] = "conf";
@ -188,7 +188,8 @@ class CoreController : public ExtendedControllerBase {
* Index 3: Chip 1 Copy 1 * Index 3: Chip 1 Copy 1
*/ */
std::array<bool, 4> protArray; std::array<bool, 4> protArray;
PeriodicOperationDivider opDivider; PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10;
core::HkSet hkSet; core::HkSet hkSet;

View File

@ -164,11 +164,9 @@ void ObjectFactory::produce(void* args) {
pcdu::Switches::PDU1_CH3_MGT_5V); pcdu::Switches::PDU1_CH3_MGT_5V);
imtqHandler->setPowerSwitcher(pwrSwitcher); imtqHandler->setPowerSwitcher(pwrSwitcher);
static_cast<void>(imtqHandler); static_cast<void>(imtqHandler);
#if OBSW_DEBUG_IMTQ == 1 #if OBSW_TEST_IMTQ == 1
imtqHandler->setStartUpImmediately(); imtqHandler->setStartUpImmediately();
imtqHandler->setToGoToNormal(true); imtqHandler->setToGoToNormal(true);
#else
(void)imtqHandler;
#endif #endif
#endif #endif
createReactionWheelComponents(gpioComIF); createReactionWheelComponents(gpioComIF);
@ -177,12 +175,8 @@ void ObjectFactory::produce(void* args) {
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV); I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV);
BpxBatteryHandler* bpxHandler = BpxBatteryHandler* bpxHandler =
new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie); new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie);
#if OBSW_TEST_BPX_BATT == 1
bpxHandler->setToGoToNormalMode(true);
bpxHandler->setStartUpImmediately(); bpxHandler->setStartUpImmediately();
#else bpxHandler->setToGoToNormalMode(true);
static_cast<void>(bpxHandler);
#endif
#endif #endif
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER); new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);

View File

@ -42,6 +42,7 @@ add_compile_options(
) )
set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped) set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped)
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
add_custom_command( add_custom_command(
TARGET ${OBSW_NAME} TARGET ${OBSW_NAME}
@ -51,4 +52,12 @@ add_custom_command(
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.." 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() endfunction()

View File

@ -11,7 +11,7 @@ endif()
# Disable compiler checks for cross-compiling. # Disable compiler checks for cross-compiling.
if(FSFW_OSAL MATCHES linux AND TGT_BSP) if(FSFW_OSAL MATCHES linux AND TGT_BSP AND EIVE_HARDCODED_TOOLCHAIN_FILE)
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa") if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa")
set(CMAKE_TOOLCHAIN_FILE set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/Zynq7020CrossCompileConfig.cmake" "${CMAKE_SCRIPT_PATH}/Zynq7020CrossCompileConfig.cmake"

View File

@ -2,6 +2,6 @@
export PATH=$PATH:"$HOME/EIVE/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin" export PATH=$PATH:"$HOME/EIVE/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
export CROSS_COMPILE="arm-linux-gnueabihf" export CROSS_COMPILE="arm-linux-gnueabihf"
export ZYNQ_7020_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi" export ZYNQ_7020_SYSROOT="/opt/xiphos/sdk/ark/sysroots/cortexa9hf-neon-xiphos-linux-gnueabi"
export CONSOLE_PREFIX="[Q7S ENV]" export CONSOLE_PREFIX="[Q7S ENV]"
/bin/bash /bin/bash

View File

@ -5,7 +5,7 @@ function help () {
} }
TOOLCHAIN_PATH="/c/Xilinx/Vitis/2019.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" 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" SYSROOT="/c/Users/${USER}/eive-software/eive-compile-rootfs"
for i in "$@"; do for i in "$@"; do
case $i in case $i in

View File

@ -1,6 +1,7 @@
#include "GPSHyperionLinuxController.h" #include "GPSHyperionLinuxController.h"
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/FSFW.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/timemanager/Clock.h" #include "fsfw/timemanager/Clock.h"
#include "linux/utility/utility.h" #include "linux/utility/utility.h"
@ -17,7 +18,6 @@ GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, obj
bool debugHyperionGps) bool debugHyperionGps)
: ExtendedControllerBase(objectId, objects::NO_OBJECT), : ExtendedControllerBase(objectId, objects::NO_OBJECT),
gpsSet(this), gpsSet(this),
myGpsmm(GPSD_SHARED_MEMORY, nullptr),
debugHyperionGps(debugHyperionGps) { debugHyperionGps(debugHyperionGps) {
timeUpdateCd.resetTimer(); timeUpdateCd.resetTimer();
} }
@ -36,6 +36,7 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
uint32_t *msToReachTheMode) { uint32_t *msToReachTheMode) {
if (not modeCommanded) { if (not modeCommanded) {
if (mode == MODE_ON or mode == MODE_OFF) { if (mode == MODE_ON or mode == MODE_OFF) {
gpsNotOpenSwitch = true;
// 5h time to reach fix // 5h time to reach fix
*msToReachTheMode = MAX_SECONDS_TO_REACH_FIX; *msToReachTheMode = MAX_SECONDS_TO_REACH_FIX;
maxTimeToReachFix.resetTimer(); maxTimeToReachFix.resetTimer();
@ -105,18 +106,28 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m
#ifdef FSFW_OSAL_LINUX #ifdef FSFW_OSAL_LINUX
void GPSHyperionLinuxController::readGpsDataFromGpsd() { void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsmm myGpsmm(GPSD_SHARED_MEMORY, nullptr);
// The data from the device will generally be read all at once. Therefore, we // The data from the device will generally be read all at once. Therefore, we
// can set all field here // can set all field here
if (not myGpsmm.is_open()) { if (not myGpsmm.is_open()) {
if(gpsNotOpenSwitch) {
// Opening failed // Opening failed
#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_VERBOSE_LEVEL >= 1
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed" << std::endl; sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed | " <<
#endif "Error " << errno << " | " << gps_errstr(errno) << std::endl;
#endif
gpsNotOpenSwitch = false;
}
return;
} }
gps_data_t *gps = nullptr; gps_data_t *gps = nullptr;
gps = myGpsmm.read(); gps = myGpsmm.read();
if (gps == nullptr) { if (gps == nullptr) {
if(gpsReadFailedSwitch) {
gpsReadFailedSwitch = false;
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed" << std::endl; sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed" << std::endl;
}
return; return;
} }
PoolReadGuard pg(&gpsSet); PoolReadGuard pg(&gpsSet);
@ -180,10 +191,19 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsSet.speed.setValid(false); gpsSet.speed.setValid(false);
} }
#if LIBGPS_VERSION_MINOR <= 17
gpsSet.unixSeconds.value = gps->fix.time;
#else
gpsSet.unixSeconds.value = gps->fix.time.tv_sec; gpsSet.unixSeconds.value = gps->fix.time.tv_sec;
#endif
timeval time = {}; timeval time = {};
time.tv_sec = gpsSet.unixSeconds.value; time.tv_sec = gpsSet.unixSeconds.value;
#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; time.tv_usec = gps->fix.time.tv_nsec / 1000;
#endif
std::time_t t = std::time(nullptr); std::time_t t = std::time(nullptr);
if (time.tv_sec == t) { if (time.tv_sec == t) {
timeIsConstantCounter++; timeIsConstantCounter++;
@ -222,7 +242,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsSet.seconds = timeOfDay.second; gpsSet.seconds = timeOfDay.second;
if (debugHyperionGps) { if (debugHyperionGps) {
sif::info << "-- Hyperion GPS Data --" << std::endl; 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; time_t timeRaw = gps->fix.time.tv_sec;
#endif
std::tm *time = gmtime(&timeRaw); std::tm *time = gmtime(&timeRaw);
std::cout << "Time: " << std::put_time(time, "%c %Z") << std::endl; std::cout << "Time: " << std::put_time(time, "%c %Z") << std::endl;
std::cout << "Visible satellites: " << gps->satellites_visible << std::endl; std::cout << "Visible satellites: " << gps->satellites_visible << std::endl;
@ -230,7 +254,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
std::cout << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl; 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 << "Latitude: " << gps->fix.latitude << std::endl;
std::cout << "Longitude: " << gps->fix.longitude << 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; std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
#endif
std::cout << "Speed(m/s): " << gps->fix.speed << std::endl; std::cout << "Speed(m/s): " << gps->fix.speed << std::endl;
std::time_t t = std::time(nullptr); std::time_t t = std::time(nullptr);
std::tm tm = *std::gmtime(&t); std::tm tm = *std::gmtime(&t);

View File

@ -52,7 +52,8 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000); Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
bool modeCommanded = true; bool modeCommanded = true;
bool timeInit = true; bool timeInit = true;
gpsmm myGpsmm; bool gpsNotOpenSwitch = true;
bool gpsReadFailedSwitch = true;
bool debugHyperionGps = false; bool debugHyperionGps = false;
uint32_t timeIsConstantCounter = 0; uint32_t timeIsConstantCounter = 0;
Countdown timeUpdateCd = Countdown(60); Countdown timeUpdateCd = Countdown(60);

View File

@ -127,6 +127,8 @@ debugging. */
#define OBSW_DEBUG_PL_PCDU 0 #define OBSW_DEBUG_PL_PCDU 0
#define OBSW_TEST_BPX_BATT 0 #define OBSW_TEST_BPX_BATT 0
#define OBSW_DEBUG_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_LIBGPIOD 0
#define OBSW_TEST_PLOC_HANDLER 0 #define OBSW_TEST_PLOC_HANDLER 0
@ -143,7 +145,6 @@ debugging. */
#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_GPS 0
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMTQ 0
#define OBSW_DEBUG_RW 0 #define OBSW_DEBUG_RW 0
#define OBSW_DEBUG_PDEC_HANDLER 0 #define OBSW_DEBUG_PDEC_HANDLER 0
@ -191,6 +192,9 @@ debugging. */
/*******************************************************************/ /*******************************************************************/
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
#include "rpiConfig.h" #include "rpiConfig.h"
#elif defined(XIPHOS_Q7S) #elif defined(XIPHOS_Q7S)

View File

@ -589,7 +589,7 @@
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689"> <cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug">
<macros> <macros>
<stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_PATH_DIR" value="${HOME}/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"/> <stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_PATH_DIR" value="${HOME}/Xilinx/eive-compile-rootfs"/>
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/> <stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
@ -603,7 +603,7 @@
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" name="eive-q7s-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null" parent="org.eclipse.cdt.build.core.emptycfg"> <configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" name="eive-q7s-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689." name="/" resourcePath="">
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1439714522" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base"> <toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1439714522" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1064018737" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/> <option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1064018737" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
@ -687,6 +687,7 @@
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/> <listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
</option> </option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1331264991" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/> <inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1331264991" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool> </tool>
@ -698,6 +699,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/linux/fsfwconfig}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/linux/fsfwconfig}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1143219558" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1143219558" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
@ -714,6 +716,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1199844227" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1199844227" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/> <listOptionValue builtIn="false" value="LINUX=1"/>
@ -745,7 +748,7 @@
</toolChain> </toolChain>
</folderInfo> </folderInfo>
<sourceEntries> <sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> <entry excluding="build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@ -755,8 +758,8 @@
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1939781894"> <cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1939781894">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1939781894" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-release"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.1939781894" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-release">
<macros> <macros>
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
<stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_TEXT" value="${HOME}/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"/> <stringMacro name="Q7S_SYSROOT_UNIX" type="VALUE_TEXT" value="${HOME}/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi"/>
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -909,7 +912,7 @@
</toolChain> </toolChain>
</folderInfo> </folderInfo>
<sourceEntries> <sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> <entry excluding="build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>

View File

@ -7,7 +7,7 @@
<buildSpec> <buildSpec>
<buildCommand> <buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers> <triggers>full,incremental,</triggers>
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>

View File

@ -6,3 +6,5 @@ target_sources(${WATCHDOG_NAME} PRIVATE
target_include_directories(${WATCHDOG_NAME} PRIVATE target_include_directories(${WATCHDOG_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) )
install(TARGETS ${WATCHDOG_NAME} RUNTIME DESTINATION bin)