From cca4d891141996cde01284b4e754c8191f789e79 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 13 Jan 2021 22:42:01 +0100 Subject: [PATCH 01/13] updated tmtc --- bsp_rpi/InitMission.cpp | 8 -------- tmtc | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/bsp_rpi/InitMission.cpp b/bsp_rpi/InitMission.cpp index 76918716..8dcb42d7 100644 --- a/bsp_rpi/InitMission.cpp +++ b/bsp_rpi/InitMission.cpp @@ -14,18 +14,10 @@ #include -// This is configured for linux without \cr -#ifdef LINUX ServiceInterfaceStream sif::debug("DEBUG"); ServiceInterfaceStream sif::info("INFO"); ServiceInterfaceStream sif::warning("WARNING"); ServiceInterfaceStream sif::error("ERROR", false, false, true); -#else -ServiceInterfaceStream sif::debug("DEBUG", true); -ServiceInterfaceStream sif::info("INFO", true); -ServiceInterfaceStream sif::warning("WARNING", true); -ServiceInterfaceStream sif::error("ERROR", true, false, true); -#endif ObjectManagerIF *objectManager = nullptr; diff --git a/tmtc b/tmtc index 4b0d4579..7e64595d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4b0d45793720df05c6a79990b84038b140c093b0 +Subproject commit 7e64595d1a34732ed5d178cbbae634104634763f From 162c0ded0236bfb9ee83ed26f1c846b7bab6b17a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 00:40:30 +0100 Subject: [PATCH 02/13] added gpio sysfs if --- bsp_rpi/CMakeLists.txt | 5 ++ bsp_rpi/InitMission.cpp | 26 ++++-- bsp_rpi/ObjectFactory.cpp | 5 +- bsp_rpi/boardtest/CMakeLists.txt | 1 + bsp_rpi/boardtest/RPiGPIO.cpp | 123 ++++++++++++++++++++++++++ bsp_rpi/boardtest/RPiGPIO.h | 41 +++++++++ bsp_rpi/boardtest/SpiTest.cpp | 26 +++++- bsp_rpi/boardtest/SpiTest.h | 16 +++- fsfwconfig/objects/systemObjectList.h | 21 +++-- 9 files changed, 242 insertions(+), 22 deletions(-) create mode 100644 bsp_rpi/boardtest/RPiGPIO.cpp create mode 100644 bsp_rpi/boardtest/RPiGPIO.h diff --git a/bsp_rpi/CMakeLists.txt b/bsp_rpi/CMakeLists.txt index 7885ca28..281994bf 100644 --- a/bsp_rpi/CMakeLists.txt +++ b/bsp_rpi/CMakeLists.txt @@ -7,6 +7,11 @@ target_sources(${TARGET_NAME} PUBLIC add_subdirectory(boardconfig) add_subdirectory(boardtest) +# wiringPi is deprecated unfortunately.. +#target_link_libraries(${TARGET_NAME} PRIVATE +# wiringPi +#) + diff --git a/bsp_rpi/InitMission.cpp b/bsp_rpi/InitMission.cpp index 8dcb42d7..197abcc6 100644 --- a/bsp_rpi/InitMission.cpp +++ b/bsp_rpi/InitMission.cpp @@ -17,7 +17,7 @@ ServiceInterfaceStream sif::debug("DEBUG"); ServiceInterfaceStream sif::info("INFO"); ServiceInterfaceStream sif::warning("WARNING"); -ServiceInterfaceStream sif::error("ERROR", false, false, true); +ServiceInterfaceStream sif::error("ERROR"); ObjectManagerIF *objectManager = nullptr; @@ -39,11 +39,11 @@ void InitMission::initTasks(){ 0.100, nullptr); ReturnValue_t result = TmTcDistributor->addComponent( objects::CCSDS_PACKET_DISTRIBUTOR); - if(result!=HasReturnvaluesIF::RETURN_OK){ + 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){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } result = TmTcDistributor->addComponent(objects::TM_FUNNEL); @@ -89,11 +89,11 @@ void InitMission::initTasks(){ PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); result = PusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); - if(result!=HasReturnvaluesIF::RETURN_OK){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } result = PusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); - if(result!=HasReturnvaluesIF::RETURN_OK){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -102,11 +102,11 @@ void InitMission::initTasks(){ PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, nullptr); result = PusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); - if(result!=HasReturnvaluesIF::RETURN_OK){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } result = PusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); - if(result!=HasReturnvaluesIF::RETURN_OK){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -114,7 +114,7 @@ void InitMission::initTasks(){ createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, nullptr); result = PusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); - if(result!=HasReturnvaluesIF::RETURN_OK){ + if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -131,6 +131,14 @@ void InitMission::initTasks(){ #endif + PeriodicTaskIF* SpiTestTask = TaskFactory::instance()-> + createPeriodicTask("SPI_TEST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 2.0, nullptr); + result = SpiTestTask->addComponent(objects::SPI_TEST); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add SPI test failed" << std::endl; + } + //Main thread sleep sif::info << "Starting tasks.." << std::endl; TmTcDistributor->startTask(); @@ -143,6 +151,8 @@ void InitMission::initTasks(){ PusMedPrio->startTask(); PusLowPrio->startTask(); + SpiTestTask->startTask(); + #if OBSW_ADD_TEST_CODE == 1 TestTimeslotTask->startTask(); #endif diff --git a/bsp_rpi/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp index 4300fbeb..c90db492 100644 --- a/bsp_rpi/ObjectFactory.cpp +++ b/bsp_rpi/ObjectFactory.cpp @@ -1,5 +1,6 @@ -#include #include "ObjectFactory.h" +#include +#include #include #include @@ -42,4 +43,6 @@ void ObjectFactory::produce(){ objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + + new SpiTest(objects::SPI_TEST); } diff --git a/bsp_rpi/boardtest/CMakeLists.txt b/bsp_rpi/boardtest/CMakeLists.txt index 768fc52f..1e373efb 100644 --- a/bsp_rpi/boardtest/CMakeLists.txt +++ b/bsp_rpi/boardtest/CMakeLists.txt @@ -1,5 +1,6 @@ target_sources(${TARGET_NAME} PRIVATE SpiTest.cpp + RPiGPIO.cpp ) diff --git a/bsp_rpi/boardtest/RPiGPIO.cpp b/bsp_rpi/boardtest/RPiGPIO.cpp new file mode 100644 index 00000000..7ffb024c --- /dev/null +++ b/bsp_rpi/boardtest/RPiGPIO.cpp @@ -0,0 +1,123 @@ +#include "RPiGPIO.h" + +#include +#include +#include +#include +#include + + +int RPiGPIO::enablePin(int pin) { + char buffer[BUFFER_MAX]; + ssize_t bytes_written; + int fd; + + fd = open("/sys/class/gpio/export", O_WRONLY); + if (fd == -1) { + sif::error << "Failed to open export of pin " << pin << " for writing!" << std::endl; + return -1; + } + + bytes_written = snprintf(buffer, BUFFER_MAX, "%d", pin); + write(fd, buffer, bytes_written); + close(fd); + return 0; +} + +int RPiGPIO::disablePin(int pin) { + char buffer[BUFFER_MAX]; + ssize_t bytes_written; + int fd; + + fd = open("/sys/class/gpio/unexport", O_WRONLY); + if (fd == -1) { + sif::error << "Failed to open unexport of pin " << pin << " for writing!" << std::endl; + return -1; + } + + bytes_written = snprintf(buffer, BUFFER_MAX, "%d", pin); + write(fd, buffer, bytes_written); + close(fd); + return(0); +} + +int RPiGPIO::pinDirection(int pin, Directions dir) { + + char path[DIRECTION_MAX]; + + snprintf(path, DIRECTION_MAX, "/sys/class/gpio/gpio%d/direction", pin); + int fd = open(path, O_WRONLY); + if (fd == -1) { + sif::error << "Failed to open gpio " << pin << " direction for writing!" << std::endl; + return -1; + } + + int result = 0; + if(dir == Directions::IN) { + result = write(fd, "in", IN_WRITE_SIZE); + } + else { + result = write(fd, "out", OUT_WRITE_SIZE); + } + + if (result != 0) { + sif::error << "Failed to set direction!" << std::endl; + return -2; + } + + close(fd); + return 0; +} + +int RPiGPIO::readPin(int pin) { + char path[VALUE_MAX]; + char value_str[3]; + + snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin); + int fd = open(path, O_RDONLY); + if (fd == -1) { + sif::error << "RPiGPIO::readPin: Failed to open GPIO pin " << pin << "!" << std::endl; + return -1; + } + + if (read(fd, value_str, 3) == -1) { + sif::error << "Failed to read value!" << std::endl; + return -1; + } + + close(fd); + char* endPtr = nullptr; + + return strtol(value_str, &endPtr, 10); +} + +int RPiGPIO::writePin(int pin, States state) { + + char path[VALUE_MAX]; + int fd; + + snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin); + fd = open(path, O_WRONLY); + if (fd == -1) { + sif::error << "RPiGPIO::writePin: Failed to open GPIO pin " << pin << "!" << std::endl; + return -1; + } + + int result = 0; + if(state == States::LOW) { + result = write(fd, "0", 1); + } + else { + result = write(fd, "1", 1); + } + + + if (result != 0) { + sif::error << "Failed to write pin " << pin << " value to " << static_cast(state) + << "!" << std::endl; + return -1; + } + + close(fd); + return 0; +} diff --git a/bsp_rpi/boardtest/RPiGPIO.h b/bsp_rpi/boardtest/RPiGPIO.h new file mode 100644 index 00000000..400a37d8 --- /dev/null +++ b/bsp_rpi/boardtest/RPiGPIO.h @@ -0,0 +1,41 @@ +#ifndef BSP_RPI_BOARDTEST_RPIGPIO_H_ +#define BSP_RPI_BOARDTEST_RPIGPIO_H_ + +#include + +/** + * @brief Really simple C++ GPIO wrapper for the Raspberry Pi, using the sysfs interface. + * Use BCM pins notation (https://pinout.xyz/#) + * + */ +class RPiGPIO { +public: + enum Directions { + IN = 0, + OUT = 1 + }; + + enum States { + LOW = 0, + HIGH = 1 + }; + + static int enablePin(int pin); + static int disablePin(int pin); + static int pinDirection(int pin, Directions dir); + static int readPin(int pin); + static int writePin(int pin, States state); + +private: + + + static constexpr uint8_t BUFFER_MAX = 3; + static constexpr uint8_t DIRECTION_MAX = 35; + static constexpr uint8_t VALUE_MAX = 30; + + static constexpr uint8_t IN_WRITE_SIZE = 3; + static constexpr uint8_t OUT_WRITE_SIZE = 4; +}; + + +#endif /* BSP_RPI_BOARDTEST_RPIGPIO_H_ */ diff --git a/bsp_rpi/boardtest/SpiTest.cpp b/bsp_rpi/boardtest/SpiTest.cpp index 91939714..a78d0171 100644 --- a/bsp_rpi/boardtest/SpiTest.cpp +++ b/bsp_rpi/boardtest/SpiTest.cpp @@ -1,13 +1,31 @@ #include "SpiTest.h" -#include +#include #include #include -#include + + SpiTest::SpiTest(object_id_t objectId): SystemObject(objectId) { - wiringPiSetupGpio(); + sif::info << "Setting up Raspberry Pi WiringPi library." << std::endl; +// wiringPiSetupGpio(); + +// pinMode(SS_MGM_0_LIS3, OUTPUT); +// pinMode(SS_MGM_1_RM, OUTPUT); +// pinMode(SS_GYRO_0_ADIS, OUTPUT); +// pinMode(SS_GYRO_1_L3G, OUTPUT); +// pinMode(SS_GYRO_2_L3G, OUTPUT); +// pinMode(SS_MGM_2_LIS3, OUTPUT); +// pinMode(SS_MGM_3_RM, OUTPUT); +// +// digitalWrite(SS_MGM_0_LIS3, HIGH); +// digitalWrite(SS_MGM_1_RM, HIGH); +// digitalWrite(SS_GYRO_0_ADIS, HIGH); +// digitalWrite(SS_GYRO_1_L3G, HIGH); +// digitalWrite(SS_GYRO_2_L3G, HIGH); +// digitalWrite(SS_MGM_2_LIS3, HIGH); +// digitalWrite(SS_MGM_3_RM, HIGH); int spiFd = open(spiDeviceName.c_str(), O_RDWR); if (spiFd < 0){ @@ -40,4 +58,4 @@ ReturnValue_t SpiTest::initialize() { //transferHandle.speed_hz = 976000; //transferHandle.len = 2; return HasReturnvaluesIF::RETURN_OK; -} \ No newline at end of file +} diff --git a/bsp_rpi/boardtest/SpiTest.h b/bsp_rpi/boardtest/SpiTest.h index 9bdb8f25..b4f37fe2 100644 --- a/bsp_rpi/boardtest/SpiTest.h +++ b/bsp_rpi/boardtest/SpiTest.h @@ -6,13 +6,27 @@ #include #include -class SpiTest: public ExecutableObjectIF, SystemObject { +class SpiTest: + public SystemObject, + public ExecutableObjectIF { public: SpiTest(object_id_t objectId); ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t initialize() override; private: + // These chip selects (BCM number) will be pulled high if not used + // ACS board specific. + enum SpiChipSelects { + SS_MGM_0_LIS3 = 0, //!< MGM 0, LIS3MDLTR, U6, A side + SS_MGM_1_RM = 1, //!< MGM 1, RM3100, U7, A side + SS_GYRO_0_ADIS = 2, //!< Gyro 0, ADIS16485, U3, A side + SS_GYRO_1_L3G = 3, //!< Gyro 1, L3GD20H, U4, A side + SS_GYRO_2_L3G = 4, //!< Gyro 2, L3GD20h, U5, B side + SS_MGM_2_LIS3 = 17, //!< MGM 2, LIS3MDLTR, U8, B side + SS_MGM_3_RM = 27, //!< MGM 3, RM3100, U9, B side + }; + const std::string spiDeviceName = "/dev/spidev0.0"; int spiFd = 0; diff --git a/fsfwconfig/objects/systemObjectList.h b/fsfwconfig/objects/systemObjectList.h index a5863380..d2fb5490 100644 --- a/fsfwconfig/objects/systemObjectList.h +++ b/fsfwconfig/objects/systemObjectList.h @@ -2,10 +2,15 @@ #define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #include +#include // The objects will be instantiated in the ID order namespace objects { enum sourceObjects: uint32_t { + /* 0x53 reserved for FSFW */ + FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION, + FW_ADDRESS_END = TIME_STAMPER, + /* First Byte 0x50-0x52 reserved for PUS Services **/ CCSDS_PACKET_DISTRIBUTOR = 0x50000100, PUS_PACKET_DISTRIBUTOR = 0x50000200, @@ -21,13 +26,6 @@ namespace objects { TM_FUNNEL = 0x52000002, - /* Test Task */ - - TEST_TASK = 0x42694269, - DUMMY_INTERFACE = 0xCAFECAFE, - DUMMY_HANDLER = 0x4400AFFE, - P60DOCK_TEST_TASK = 0x00005060, - /* 0x49 ('I') for Communication Interfaces **/ ARDUINO_COM_IF = 0x49000001, CSP_COM_IF = 0x49000002, @@ -36,7 +34,14 @@ namespace objects { P60DOCK_HANDLER = 0x44000001, PDU1_HANDLER = 0x44000002, PDU2_HANDLER = 0x44000003, - ACU_HANDLER = 0x44000004 + ACU_HANDLER = 0x44000004, + + /* 0x54 ('T') for test handlers */ + TEST_TASK = 0x54694269, + SPI_TEST = 0x54000010, + DUMMY_INTERFACE = 0x5400CAFE, + DUMMY_HANDLER = 0x5400AFFE, + P60DOCK_TEST_TASK = 0x00005060, }; } From b0d9046bd9468be9b8ca631fda16e9ffb817032e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 10:52:41 +0100 Subject: [PATCH 03/13] deprecated wiringPi --- cmake/PreProjectConfig.cmake | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmake/PreProjectConfig.cmake b/cmake/PreProjectConfig.cmake index ce18d89d..f54da048 100644 --- a/cmake/PreProjectConfig.cmake +++ b/cmake/PreProjectConfig.cmake @@ -19,15 +19,15 @@ if(${OS_FSFW} STREQUAL linux AND TGT_BSP) ) elseif (${TGT_BSP} MATCHES "arm/raspberrypi") if(NOT DEFINED ENV{RASPBIAN_ROOTFS}) - if(NOT RASPBIAN_ROOTFS) + if(NOT DEFINED RASPBIAN_ROOTFS) + message(WARNING "No RASPBIAN_ROOTFS environmental or CMake variable set!") set(ENV{RASPBIAN_ROOTFS} "$ENV{HOME}/raspberrypi/rootfs") else() set(ENV{RASPBIAN_ROOTFS} "${RASPBIAN_ROOTFS}") endif() else() message(STATUS - "RASPBIAN_ROOTFS from environmental variables used: " - "$ENV{RASPBIAN_ROOTFS}" + "RASPBIAN_ROOTFS from environmental variables used: $ENV{RASPBIAN_ROOTFS}" ) endif() @@ -36,12 +36,8 @@ if(${OS_FSFW} STREQUAL linux AND TGT_BSP) message(STATUS "No RASPBERRY_VERSION specified, setting to 4") set(RASPBERRY_VERSION "4" CACHE STRING "Raspberry Pi version") else() - message(STATUS - "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}" - ) - set(RASPBERRY_VERSION - ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version" - ) + message(STATUS "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}") + set(RASPBERRY_VERSION ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version") set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION}) endif() else() From cd86fc5f7c85a0b205f450979f416ba9f46cbba5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 11:33:48 +0100 Subject: [PATCH 04/13] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index bd5cc7ae..58c5b021 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bd5cc7ae3ea53040cc832b5d756846d21613d91a +Subproject commit 58c5b02113ade67ae3c9140398d87f1aae03b4d0 From 0676dd43cefbd3ea14acd0bee58fb94ab29eca85 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 11:37:32 +0100 Subject: [PATCH 05/13] implemented api change --- mission/devices/GPSHandler.cpp | 2 +- mission/devices/GPSHandler.h | 2 +- mission/devices/GyroL3GD20Handler.cpp | 2 +- mission/devices/GyroL3GD20Handler.h | 2 +- mission/devices/MGMHandlerLIS3MDL.cpp | 2 +- mission/devices/MGMHandlerLIS3MDL.h | 2 +- mission/devices/MGMHandlerRM3100.cpp | 2 +- mission/devices/MGMHandlerRM3100.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mission/devices/GPSHandler.cpp b/mission/devices/GPSHandler.cpp index fb549eb7..e53ce347 100644 --- a/mission/devices/GPSHandler.cpp +++ b/mission/devices/GPSHandler.cpp @@ -44,7 +44,7 @@ uint32_t GPSHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { } ReturnValue_t GPSHandler::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/GPSHandler.h b/mission/devices/GPSHandler.h index 52ac25be..01a13591 100644 --- a/mission/devices/GPSHandler.h +++ b/mission/devices/GPSHandler.h @@ -29,7 +29,7 @@ protected: void fillCommandAndReplyMap() override; void modeChanged() override; uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t initializeLocalDataPool(LocalDataPool &localDataPoolMap, + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; private: diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index 38016531..a984d4a5 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -194,7 +194,7 @@ uint32_t GyroHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { } ReturnValue_t GyroHandler::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, new PoolEntry({0.0})); localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, diff --git a/mission/devices/GyroL3GD20Handler.h b/mission/devices/GyroL3GD20Handler.h index 5905b26a..20396315 100644 --- a/mission/devices/GyroL3GD20Handler.h +++ b/mission/devices/GyroL3GD20Handler.h @@ -37,7 +37,7 @@ protected: void fillCommandAndReplyMap() override; void modeChanged() override; uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t initializeLocalDataPool(LocalDataPool &localDataPoolMap, + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; private: diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 58740d7d..2445620d 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -423,7 +423,7 @@ void MGMHandlerLIS3MDL::modeChanged(void) { } ReturnValue_t MGMHandlerLIS3MDL::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, new PoolEntry({0.0})); localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MGMHandlerLIS3MDL.h index 414731db..4a62ba31 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MGMHandlerLIS3MDL.h @@ -52,7 +52,7 @@ protected: const uint8_t *packet) override; void fillCommandAndReplyMap() override; void modeChanged(void) override; - ReturnValue_t initializeLocalDataPool(LocalDataPool &localDataPoolMap, + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; private: diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index 0fda5fba..62db06a7 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -304,7 +304,7 @@ void MGMHandlerRM3100::modeChanged(void) { } ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool( - LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry({0.0})); localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, diff --git a/mission/devices/MGMHandlerRM3100.h b/mission/devices/MGMHandlerRM3100.h index d735ca45..4af6b627 100644 --- a/mission/devices/MGMHandlerRM3100.h +++ b/mission/devices/MGMHandlerRM3100.h @@ -55,7 +55,7 @@ protected: void fillCommandAndReplyMap() override; void modeChanged(void) override; uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t initializeLocalDataPool(LocalDataPool &localDataPoolMap, + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; private: From b848795a8efdcb0d8736e307cdb131dd3caeb135 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:03:01 +0100 Subject: [PATCH 06/13] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 58c5b021..d8423be9 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 58c5b02113ade67ae3c9140398d87f1aae03b4d0 +Subproject commit d8423be98cd9b17fced53627d99d2c7252fd6b3c From bf1a6eaa2d1862b3713121cba6a9314654b7961f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:05:49 +0100 Subject: [PATCH 07/13] updated cproject f ile --- misc/eclipse/.cproject | 66 +++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index e0ac2c75..7d08be5e 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -795,69 +795,51 @@ - + - - + - - - - - - - + + + + make + -j16 + clean + true + true + true + + + make + -j16 + hardclean + true + true + true + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + From a0549bdb33c0028a3085c397f0d6e8ee41683004 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:07:11 +0100 Subject: [PATCH 08/13] updated fsfwconfig files --- bsp_hosted/fsfwconfig/FSFWConfig.h | 15 +++++++-------- fsfwconfig/FSFWConfig.h | 15 +++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bsp_hosted/fsfwconfig/FSFWConfig.h b/bsp_hosted/fsfwconfig/FSFWConfig.h index 261e3d6d..e3def8fe 100644 --- a/bsp_hosted/fsfwconfig/FSFWConfig.h +++ b/bsp_hosted/fsfwconfig/FSFWConfig.h @@ -7,19 +7,18 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 1 +#define FSFW_CPP_OSTREAM_ENABLED 1 -//! More FSFW related printouts. -//! Be careful, this also turns off most diagnostic prinouts! -#define FSFW_ENHANCED_PRINTOUT 0 +//! More FSFW related printouts depending on level. Useful for development. +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. -#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 - #define FSFW_DISABLE_PRINTOUT 0 +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 + #define FSFW_DISABLE_PRINTOUT 0 #endif -//! Can be used to enable additional debugging printouts for developing the FSFW -#define FSFW_PRINT_VERBOSITY_LEVEL 0 +//! Can be used to disable the ANSI color sequences for C stdio. +#define FSFW_COLORED_OUTPUT 1 //! Can be used to disable the ANSI color sequences for C stdio. #define FSFW_COLORED_OUTPUT 1 diff --git a/fsfwconfig/FSFWConfig.h b/fsfwconfig/FSFWConfig.h index 261e3d6d..e3def8fe 100644 --- a/fsfwconfig/FSFWConfig.h +++ b/fsfwconfig/FSFWConfig.h @@ -7,19 +7,18 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 1 +#define FSFW_CPP_OSTREAM_ENABLED 1 -//! More FSFW related printouts. -//! Be careful, this also turns off most diagnostic prinouts! -#define FSFW_ENHANCED_PRINTOUT 0 +//! More FSFW related printouts depending on level. Useful for development. +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. -#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 - #define FSFW_DISABLE_PRINTOUT 0 +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 + #define FSFW_DISABLE_PRINTOUT 0 #endif -//! Can be used to enable additional debugging printouts for developing the FSFW -#define FSFW_PRINT_VERBOSITY_LEVEL 0 +//! Can be used to disable the ANSI color sequences for C stdio. +#define FSFW_COLORED_OUTPUT 1 //! Can be used to disable the ANSI color sequences for C stdio. #define FSFW_COLORED_OUTPUT 1 From 06bc5cf671c95bd2b221055d29a64a349baa864b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:17:05 +0100 Subject: [PATCH 09/13] important fsfw bugfix --- fsfw | 2 +- mission/devices/GyroL3GD20Handler.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fsfw b/fsfw index d8423be9..f6c88886 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d8423be98cd9b17fced53627d99d2c7252fd6b3c +Subproject commit f6c88886b830f114fd519cd4aa003a67e0bf964a diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index a984d4a5..9c7bfc4a 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -1,4 +1,5 @@ #include +#include GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie): @@ -171,14 +172,13 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id, int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; float temperature = 25.0 + temperaturOffset; - result = dataset.read(); + PoolReadHelper readSet(&dataset); if(result == HasReturnvaluesIF::RETURN_OK) { dataset.angVelocX = angVelocX; dataset.angVelocY = angVelocY; dataset.angVelocZ = angVelocZ; dataset.temperature = temperature; dataset.setValidity(true, true); - result = dataset.commit(); } break; } From fbc63667c174a022b224133af5a91644ed9bc70a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:23:31 +0100 Subject: [PATCH 10/13] updated fsfw, moved file --- fsfw | 2 +- mission/devices/GyroL3GD20Handler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index f6c88886..4cf15e9e 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit f6c88886b830f114fd519cd4aa003a67e0bf964a +Subproject commit 4cf15e9ec6e98304749afaac8b8ded5b83fe2348 diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index 9c7bfc4a..f1aa6d53 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -1,5 +1,5 @@ #include -#include +#include GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie): From 4a4592d4e5c3de6d0c09e4999177df0b85a94f38 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 14 Jan 2021 12:26:12 +0100 Subject: [PATCH 11/13] bugfix --- mission/devices/GyroL3GD20Handler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index f1aa6d53..28cbdbed 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -173,7 +173,7 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id, float temperature = 25.0 + temperaturOffset; PoolReadHelper readSet(&dataset); - if(result == HasReturnvaluesIF::RETURN_OK) { + if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { dataset.angVelocX = angVelocX; dataset.angVelocY = angVelocY; dataset.angVelocZ = angVelocZ; From 8276f503e97fa50455f8a709eec71ea80f9f1eda Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Jan 2021 16:35:44 +0100 Subject: [PATCH 12/13] updated cmakelists --- CMakeLists.txt | 2 +- fsfw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1410bdb..db7bb059 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ set(FSFW_PATH fsfw) set(MISSION_PATH mission) set(CSPLIB_PATH libcsp) -set(WARNING_SHADOW_LOCAL FALSE) +set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) # Analyse different OS and architecture/target options, determine BSP_PATH, # display information about compiler etc. diff --git a/fsfw b/fsfw index bd5cc7ae..8f83f7be 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bd5cc7ae3ea53040cc832b5d756846d21613d91a +Subproject commit 8f83f7becd7ae9ee45a6bfccffdf1338993e426c From bcac9c65e4021f06e346a036eda54790a912d3f1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 19 Jan 2021 16:45:33 +0100 Subject: [PATCH 13/13] improved cmake lists --- CMakeLists.txt | 10 ++++++---- cmake/HardwareOsPostConfig.cmake | 2 +- fsfw | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db7bb059..05ca6671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,11 +165,13 @@ endif() add_custom_command( TARGET ${TARGET_NAME} POST_BUILD - COMMAND echo "Build directory: ${CMAKE_BINARY_DIR}" - COMMAND echo "Target OSAL: ${OS_FSFW}" - COMMAND echo "Target Build Type: ${CMAKE_BUILD_TYPE}" - COMMAND echo "${TARGET_STRING}" + #COMMAND echo "Build directory: ${CMAKE_BINARY_DIR}" + #COMMAND echo "Target OSAL: ${OS_FSFW}" + #COMMAND echo "Target Build Type: ${CMAKE_BUILD_TYPE}" + #COMMAND echo "${TARGET_STRING}" COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} + COMMENT "Build directory: ${CMAKE_BINARY_DIR}\nTarget OSAL: ${OS_FSFW}\n" + "Target Build Type: ${CMAKE_BUILD_TYPE}\n${TARGET_STRING}" ) include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) diff --git a/cmake/HardwareOsPostConfig.cmake b/cmake/HardwareOsPostConfig.cmake index c3dc3f93..73a8d8b1 100644 --- a/cmake/HardwareOsPostConfig.cmake +++ b/cmake/HardwareOsPostConfig.cmake @@ -55,8 +55,8 @@ target_compile_options(${TARGET_NAME} PRIVATE add_custom_command( TARGET ${TARGET_NAME} POST_BUILD - COMMAND echo Generating binary file ${CMAKE_PROJECT_NAME}.bin.. COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET_NAME} ${TARGET_NAME}.bin + COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin.." ) endfunction() \ No newline at end of file diff --git a/fsfw b/fsfw index 8f83f7be..50733e22 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8f83f7becd7ae9ee45a6bfccffdf1338993e426c +Subproject commit 50733e223adaf9fc95d9728c62a026ea6efac1d2