From 572e3d5bba80674c1b82c1ce38e585ed108d024a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:19:43 +0100 Subject: [PATCH 01/16] fsfw and tmtc update --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 7d0916a4..c2839825 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1 +Subproject commit c28398257b68facbabb19d7228b045f1388305df diff --git a/tmtc b/tmtc index 110ec964..2b85ece0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 110ec9644a520af9c6f4cb7f2b5d47f3d34ba256 +Subproject commit 2b85ece07195ee905c35b35494bc7a86b94335f5 From 83530f9c4e60791abb522b45afdb12a428f62a56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:23:29 +0100 Subject: [PATCH 02/16] moved gpiod test to bsp folder --- bsp_q7s/CMakeLists.txt | 1 + bsp_q7s/boardtest/CMakeLists.txt | 7 ++++ .../boardtest}/LibgpiodTest.cpp | 5 ++- .../boardtest}/LibgpiodTest.h | 0 test/testtasks/CMakeLists.txt | 1 - test/testtasks/MutextestTask.cpp | 41 ------------------- test/testtasks/MutextestTask.h | 32 --------------- 7 files changed, 11 insertions(+), 76 deletions(-) create mode 100644 bsp_q7s/boardtest/CMakeLists.txt rename {test/testtasks => bsp_q7s/boardtest}/LibgpiodTest.cpp (92%) rename {test/testtasks => bsp_q7s/boardtest}/LibgpiodTest.h (100%) delete mode 100644 test/testtasks/MutextestTask.cpp delete mode 100644 test/testtasks/MutextestTask.h diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 806feca9..1da8067f 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -7,6 +7,7 @@ target_sources(${TARGET_NAME} PUBLIC add_subdirectory(boardconfig) add_subdirectory(comIF) add_subdirectory(gpio) +add_subdirectory(boardtest) diff --git a/bsp_q7s/boardtest/CMakeLists.txt b/bsp_q7s/boardtest/CMakeLists.txt new file mode 100644 index 00000000..7e59ddb9 --- /dev/null +++ b/bsp_q7s/boardtest/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${TARGET_NAME} PRIVATE + LibgpiodTest.cpp +) + + + + diff --git a/test/testtasks/LibgpiodTest.cpp b/bsp_q7s/boardtest/LibgpiodTest.cpp similarity index 92% rename from test/testtasks/LibgpiodTest.cpp rename to bsp_q7s/boardtest/LibgpiodTest.cpp index 3315f0f6..51f89abe 100644 --- a/test/testtasks/LibgpiodTest.cpp +++ b/bsp_q7s/boardtest/LibgpiodTest.cpp @@ -1,10 +1,11 @@ #include "LibgpiodTest.h" -#include "devices/gpioIds.h" +#include #include #include -LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) : +LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, + GpioCookie* gpioCookie): TestTask(objectId) { gpioInterface = objectManager->get(gpioIfobjectId); diff --git a/test/testtasks/LibgpiodTest.h b/bsp_q7s/boardtest/LibgpiodTest.h similarity index 100% rename from test/testtasks/LibgpiodTest.h rename to bsp_q7s/boardtest/LibgpiodTest.h diff --git a/test/testtasks/CMakeLists.txt b/test/testtasks/CMakeLists.txt index 7c2df391..8d8a17c1 100644 --- a/test/testtasks/CMakeLists.txt +++ b/test/testtasks/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - LibgpiodTest.cpp TestTask.cpp ) diff --git a/test/testtasks/MutextestTask.cpp b/test/testtasks/MutextestTask.cpp deleted file mode 100644 index 325d0029..00000000 --- a/test/testtasks/MutextestTask.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MutextestTask.cpp - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#include - -#include - -MutexIF * MutextestTask::mutex = nullptr; - -MutextestTask::MutextestTask(const char *name, object_id_t setObjectId) : - SystemObject(setObjectId), name(name), locked(false) { - if (mutex == NULL) { - mutex = MutexFactory::instance()->createMutex(); - } -} - -ReturnValue_t MutextestTask::performOperation(uint8_t operationCode) { - if (!locked){ - sif::info << name << ": locking..." << std::endl; - ReturnValue_t result = mutex->lockMutex(MutexIF::BLOCKING); - sif::info << name << ": locked with " << (int) result << std::endl; - if (result == HasReturnvaluesIF::RETURN_OK){ - locked = true; - } - } else { - sif::info << name << ": releasing" << std::endl; - mutex->unlockMutex(); - locked = false; - } - - return HasReturnvaluesIF::RETURN_OK; -} - -MutextestTask::~MutextestTask() { -// TODO Auto-generated destructor stub -} - diff --git a/test/testtasks/MutextestTask.h b/test/testtasks/MutextestTask.h deleted file mode 100644 index 14b81028..00000000 --- a/test/testtasks/MutextestTask.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * MutextestTask.h - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#ifndef MISSION_MUTEXTESTTASK_H_ -#define MISSION_MUTEXTESTTASK_H_ - -#include -#include -#include - -/** - * Start two of them with a little time difference and different periods to see mutex in action - */ - -class MutextestTask: public SystemObject, public ExecutableObjectIF { -public: - - virtual ReturnValue_t performOperation(uint8_t operationCode = 0); - - MutextestTask(const char *name, object_id_t setObjectId); - virtual ~MutextestTask(); -private: - static MutexIF *mutex; - const char * name; - bool locked; -}; - -#endif /* MISSION_MUTEXTESTTASK_H_ */ From cb9e9d3ec02487164d96c8d58eda2ae8058322c1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:35:08 +0100 Subject: [PATCH 03/16] added new linux folder --- CMakeLists.txt | 7 +++ bsp_q7s/ObjectFactory.cpp | 20 +++---- bsp_q7s/boardtest/LibgpiodTest.h | 4 +- bsp_q7s/gpio/CMakeLists.txt | 7 --- bsp_q7s/gpio/LinuxLibgpioIF.cpp | 10 ++-- bsp_q7s/gpio/LinuxLibgpioIF.h | 4 +- linux/CMakeLists.txt | 2 + linux/gpio/CMakeLists.txt | 7 +++ .../cookies => linux/gpio}/GpioCookie.cpp | 2 +- .../gpio/cookies => linux/gpio}/GpioCookie.h | 52 +++++++++---------- {bsp_q7s => linux}/gpio/GpioIF.h | 0 11 files changed, 62 insertions(+), 53 deletions(-) create mode 100644 linux/CMakeLists.txt create mode 100644 linux/gpio/CMakeLists.txt rename {bsp_q7s/gpio/cookies => linux/gpio}/GpioCookie.cpp (93%) rename {bsp_q7s/gpio/cookies => linux/gpio}/GpioCookie.h (68%) rename {bsp_q7s => linux}/gpio/GpioIF.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec6dc555..0c726931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,10 @@ set(FSFW_PATH fsfw) set(MISSION_PATH mission) set(CSPLIB_PATH libcsp) set(TEST_PATH test/testtasks) +set(LINUX_PATH linux) set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) +set(ADD_LINUX_FILES FALSE) # Analyse different OS and architecture/target options, determine BSP_PATH, # display information about compiler etc. @@ -61,6 +63,7 @@ if(TGT_BSP) if(${TGT_BSP} MATCHES "arm/q7s") set(ADD_CSP_LIB TRUE) endif() + set(ADD_LINUX_FILES TRUE) else() # Required by FSFW library set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") @@ -82,6 +85,10 @@ if(ADD_CSP_LIB) add_subdirectory(${CSPLIB_PATH}) endif() +if(ADD_LINUX_FILES) + add_subdirectory(${LINUX_PATH}) +endif() + add_subdirectory(${BSP_PATH}) add_subdirectory(${FSFW_PATH}) add_subdirectory(${MISSION_PATH}) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 5dde01d3..8b14fb24 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -115,37 +115,37 @@ void ObjectFactory::produce(){ #if TE0720 == 0 /* Pin H2-11 on stack connector */ GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, - std::string("Heater0"), Gpio::OUT, 0); + std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ GpioConfig_t gpioConfigHeater1(std::string("gpiochip7"), 14, - std::string("Heater1"), Gpio::OUT, 0); + std::string("Heater1"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); /* Pin H2-13 on stack connector */ GpioConfig_t gpioConfigHeater2(std::string("gpiochip7"), 20, - std::string("Heater2"), Gpio::OUT, 0); + std::string("Heater2"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); GpioConfig_t gpioConfigHeater3(std::string("gpiochip7"), 16, - std::string("Heater3"), Gpio::OUT, 0); + std::string("Heater3"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); GpioConfig_t gpioConfigHeater4(std::string("gpiochip7"), 24, - std::string("Heater4"), Gpio::OUT, 0); + std::string("Heater4"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); GpioConfig_t gpioConfigHeater5(std::string("gpiochip7"), 26, - std::string("Heater5"), Gpio::OUT, 0); + std::string("Heater5"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); GpioConfig_t gpioConfigHeater6(std::string("gpiochip7"), 22, - std::string("Heater6"), Gpio::OUT, 0); + std::string("Heater6"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); GpioConfig_t gpioConfigHeater7(std::string("gpiochip7"), 28, - std::string("Heater7"), Gpio::OUT, 0); + std::string("Heater7"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, @@ -160,13 +160,13 @@ void ObjectFactory::produce(){ #if TE0720 == 1 && TEST_LIBGPIOD == 1 /* Configure MIO0 as input */ GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0, - std::string("MIO0"), Gpio::IN, 0); + std::string("MIO0"), gpio::IN, 0); gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); #elif TE0720 == 1 // Configuration for MIO0 on TE0720-03-1CFA GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0, - std::string("Heater0"), Gpio::OUT, 0); + std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN); diff --git a/bsp_q7s/boardtest/LibgpiodTest.h b/bsp_q7s/boardtest/LibgpiodTest.h index c64f25a3..bc87a5c4 100644 --- a/bsp_q7s/boardtest/LibgpiodTest.h +++ b/bsp_q7s/boardtest/LibgpiodTest.h @@ -2,8 +2,8 @@ #define TEST_TESTTASKS_LIBGPIODTEST_H_ #include "TestTask.h" -#include "GpioIF.h" -#include "GpioCookie.h" +#include +#include #include /** diff --git a/bsp_q7s/gpio/CMakeLists.txt b/bsp_q7s/gpio/CMakeLists.txt index 3b789394..1041cea7 100644 --- a/bsp_q7s/gpio/CMakeLists.txt +++ b/bsp_q7s/gpio/CMakeLists.txt @@ -1,11 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - cookies/GpioCookie.cpp LinuxLibgpioIF.cpp ) -target_include_directories(${TARGET_NAME} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/cookies -) - - diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.cpp b/bsp_q7s/gpio/LinuxLibgpioIF.cpp index 97159315..97d0cc12 100644 --- a/bsp_q7s/gpio/LinuxLibgpioIF.cpp +++ b/bsp_q7s/gpio/LinuxLibgpioIF.cpp @@ -1,5 +1,5 @@ -#include -#include +#include "LinuxLibgpioIF.h" +#include #include #include @@ -49,7 +49,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { std::string chipname; unsigned int lineNum; struct gpiod_chip *chip; - Gpio::Direction direction; + gpio::Direction direction; std::string consumer; struct gpiod_line *lineHandle; int result; @@ -77,7 +77,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { consumer = mapToAddIter->second.consumer; /* Configure direction and add a description to the GPIO */ switch (direction) { - case Gpio::OUT: + case gpio::OUT: result = gpiod_line_request_output(lineHandle, consumer.c_str(), mapToAddIter->second.initValue); if (result < 0) { @@ -88,7 +88,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { return RETURN_FAILED; } break; - case Gpio::IN: + case gpio::IN: result = gpiod_line_request_input(lineHandle, consumer.c_str()); if (result < 0) { sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.h b/bsp_q7s/gpio/LinuxLibgpioIF.h index f8cc1a09..f91a35ca 100644 --- a/bsp_q7s/gpio/LinuxLibgpioIF.h +++ b/bsp_q7s/gpio/LinuxLibgpioIF.h @@ -1,9 +1,9 @@ #ifndef BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_ #define BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_ -#include +#include +#include #include -#include #include /** diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 00000000..c102da2f --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(gpio) + diff --git a/linux/gpio/CMakeLists.txt b/linux/gpio/CMakeLists.txt new file mode 100644 index 00000000..642555fe --- /dev/null +++ b/linux/gpio/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${TARGET_NAME} PUBLIC + GpioCookie.cpp +) + + + + diff --git a/bsp_q7s/gpio/cookies/GpioCookie.cpp b/linux/gpio/GpioCookie.cpp similarity index 93% rename from bsp_q7s/gpio/cookies/GpioCookie.cpp rename to linux/gpio/GpioCookie.cpp index 36760c4d..f4e585d1 100644 --- a/bsp_q7s/gpio/cookies/GpioCookie.cpp +++ b/linux/gpio/GpioCookie.cpp @@ -1,4 +1,4 @@ -#include +#include "GpioCookie.h" #include GpioCookie::GpioCookie() { diff --git a/bsp_q7s/gpio/cookies/GpioCookie.h b/linux/gpio/GpioCookie.h similarity index 68% rename from bsp_q7s/gpio/cookies/GpioCookie.h rename to linux/gpio/GpioCookie.h index acc360e0..72011750 100644 --- a/bsp_q7s/gpio/cookies/GpioCookie.h +++ b/linux/gpio/GpioCookie.h @@ -1,17 +1,17 @@ #ifndef SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_ #define SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_ +#include "GpioIF.h" #include -#include #include #include #include -namespace Gpio { - enum Direction { - IN = 0, - OUT = 1 - }; +namespace gpio { +enum Direction { + IN = 0, + OUT = 1 +}; } /** @@ -29,17 +29,17 @@ namespace Gpio { * pointer. */ typedef struct GpioConfig { - GpioConfig(std::string chipname_, int lineNum_, std::string consumer_, - Gpio::Direction direction_, int initValue_) : - chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction( - direction_), initValue(initValue_) { - } - std::string chipname; - int lineNum; - std::string consumer; - Gpio::Direction direction; - int initValue; - struct gpiod_line* lineHandle; + GpioConfig(std::string chipname_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction(direction_), + initValue(initValue_) { + } + std::string chipname; + int lineNum; + std::string consumer; + gpio::Direction direction; + int initValue; + struct gpiod_line* lineHandle = nullptr; } GpioConfig_t; using GpioMap = std::unordered_map; using GpioMapIter = GpioMap::iterator; @@ -57,20 +57,20 @@ using GpioMapIter = GpioMap::iterator; class GpioCookie: public CookieIF { public: - GpioCookie(); + GpioCookie(); - virtual ~GpioCookie(); + virtual ~GpioCookie(); - void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig); - /** - * @brief Get map with registered GPIOs. - */ - GpioMap getGpioMap() const; + void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig); + /** + * @brief Get map with registered GPIOs. + */ + GpioMap getGpioMap() const; private: - GpioMap gpioMap; - GpioMapIter gpioMapIter; + GpioMap gpioMap; + GpioMapIter gpioMapIter; }; #endif diff --git a/bsp_q7s/gpio/GpioIF.h b/linux/gpio/GpioIF.h similarity index 100% rename from bsp_q7s/gpio/GpioIF.h rename to linux/gpio/GpioIF.h From 377c4d1ad2c8f4e9843db9968db905940a14fa19 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:57:09 +0100 Subject: [PATCH 04/16] moved some files --- bsp_q7s/boardtest/LibgpiodTest.h | 4 +- bsp_q7s/gpio/CMakeLists.txt | 4 - linux/gpio/CMakeLists.txt | 1 + {bsp_q7s => linux}/gpio/LinuxLibgpioIF.cpp | 112 ++++++++++----------- {bsp_q7s => linux}/gpio/LinuxLibgpioIF.h | 0 5 files changed, 59 insertions(+), 62 deletions(-) delete mode 100644 bsp_q7s/gpio/CMakeLists.txt rename {bsp_q7s => linux}/gpio/LinuxLibgpioIF.cpp (64%) rename {bsp_q7s => linux}/gpio/LinuxLibgpioIF.h (100%) diff --git a/bsp_q7s/boardtest/LibgpiodTest.h b/bsp_q7s/boardtest/LibgpiodTest.h index bc87a5c4..678c06a3 100644 --- a/bsp_q7s/boardtest/LibgpiodTest.h +++ b/bsp_q7s/boardtest/LibgpiodTest.h @@ -2,8 +2,8 @@ #define TEST_TESTTASKS_LIBGPIODTEST_H_ #include "TestTask.h" -#include -#include +#include +#include #include /** diff --git a/bsp_q7s/gpio/CMakeLists.txt b/bsp_q7s/gpio/CMakeLists.txt deleted file mode 100644 index 1041cea7..00000000 --- a/bsp_q7s/gpio/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -target_sources(${TARGET_NAME} PUBLIC - LinuxLibgpioIF.cpp -) - diff --git a/linux/gpio/CMakeLists.txt b/linux/gpio/CMakeLists.txt index 642555fe..052173b3 100644 --- a/linux/gpio/CMakeLists.txt +++ b/linux/gpio/CMakeLists.txt @@ -1,5 +1,6 @@ target_sources(${TARGET_NAME} PUBLIC GpioCookie.cpp + LinuxLibgpioIF.cpp ) diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.cpp b/linux/gpio/LinuxLibgpioIF.cpp similarity index 64% rename from bsp_q7s/gpio/LinuxLibgpioIF.cpp rename to linux/gpio/LinuxLibgpioIF.cpp index 97d0cc12..e5db2934 100644 --- a/bsp_q7s/gpio/LinuxLibgpioIF.cpp +++ b/linux/gpio/LinuxLibgpioIF.cpp @@ -12,36 +12,36 @@ LinuxLibgpioIF::~LinuxLibgpioIF() { } ReturnValue_t LinuxLibgpioIF::initialize(CookieIF * cookie){ - ReturnValue_t result; - GpioMap mapToAdd; + ReturnValue_t result; + GpioMap mapToAdd; - if(cookie == nullptr) { - sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; - return RETURN_FAILED; - } - GpioCookie* gpioCookie = dynamic_cast(cookie); - if(gpioCookie == nullptr) { - sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!" - << std::endl; - return RETURN_FAILED; - } + if(cookie == nullptr) { + sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; + return RETURN_FAILED; + } + GpioCookie* gpioCookie = dynamic_cast(cookie); + if(gpioCookie == nullptr) { + sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!" + << std::endl; + return RETURN_FAILED; + } - mapToAdd = gpioCookie->getGpioMap(); + mapToAdd = gpioCookie->getGpioMap(); - result = checkForConflicts(mapToAdd); - if (result != RETURN_OK){ - return result; - } + result = checkForConflicts(mapToAdd); + if (result != RETURN_OK){ + return result; + } - result = configureGpios(&mapToAdd); - if (result != RETURN_OK) { - return RETURN_FAILED; - } + result = configureGpios(&mapToAdd); + if (result != RETURN_OK) { + return RETURN_FAILED; + } - /* Register new GPIOs in gpioMap*/ - gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); + /* Register new GPIOs in gpioMap*/ + gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); - return RETURN_OK; + return RETURN_OK; } ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { @@ -100,7 +100,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { break; default: sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" - << std::endl; + << std::endl; return RETURN_FAILED; } /** @@ -113,33 +113,33 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { } ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId){ - return driveGpio(gpioId, 1); + return driveGpio(gpioId, 1); } ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId){ - return driveGpio(gpioId, 0); + return driveGpio(gpioId, 0); } ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, - unsigned int logiclevel) { + unsigned int logiclevel) { int result; - struct gpiod_line *lineHandle; + struct gpiod_line *lineHandle; - gpioMapIter = gpioMap.find(gpioId); + gpioMapIter = gpioMap.find(gpioId); if (gpioMapIter == gpioMap.end()){ sif::debug << "LinuxLibgpioIF::driveGpio: Unknown gpio id " << gpioId << std::endl; return RETURN_FAILED; } lineHandle = gpioMapIter->second.lineHandle; - result = gpiod_line_set_value(lineHandle, logiclevel); - if (result < 0) { - sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " - << gpioId << " to logic level " << logiclevel << std::endl; - return DRIVE_GPIO_FAILURE; - } + result = gpiod_line_set_value(lineHandle, logiclevel); + if (result < 0) { + sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " + << gpioId << " to logic level " << logiclevel << std::endl; + return DRIVE_GPIO_FAILURE; + } - return RETURN_OK; + return RETURN_OK; } ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { @@ -158,23 +158,23 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { } ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap mapToAdd){ - gpioId_t gpioId; - GpioMapIter mapToAddIter = mapToAdd.begin(); - for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){ - gpioId = mapToAddIter->first; - gpioMapIter = gpioMap.find(gpioId); - if(gpioMapIter != mapToAdd.end()){ - /* An entry for this GPIO already exists. Check if configuration - * of direction is equivalent */ - if (mapToAddIter->second.direction != gpioMapIter->second.direction){ - sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict " - << "for GPIO " << mapToAddIter->first << std::endl; - return RETURN_OK; - } - /* Remove element from map to add because a entry for this GPIO - * already exists */ - mapToAdd.erase(mapToAddIter); - } - } - return RETURN_OK; + gpioId_t gpioId; + GpioMapIter mapToAddIter = mapToAdd.begin(); + for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){ + gpioId = mapToAddIter->first; + gpioMapIter = gpioMap.find(gpioId); + if(gpioMapIter != mapToAdd.end()){ + /* An entry for this GPIO already exists. Check if configuration + * of direction is equivalent */ + if (mapToAddIter->second.direction != gpioMapIter->second.direction){ + sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict " + << "for GPIO " << mapToAddIter->first << std::endl; + return RETURN_OK; + } + /* Remove element from map to add because a entry for this GPIO + * already exists */ + mapToAdd.erase(mapToAddIter); + } + } + return RETURN_OK; } diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.h b/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from bsp_q7s/gpio/LinuxLibgpioIF.h rename to linux/gpio/LinuxLibgpioIF.h From 79701eabb1efac7916e0f2b41bca3735143178ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:57:35 +0100 Subject: [PATCH 05/16] updated project files --- misc/eclipse/.cproject | 43 +++++++++++++++++++++++++----------------- misc/eclipse/.project | 2 +- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 7d08be5e..a6bc0a6b 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -355,7 +355,7 @@ - + @@ -499,7 +499,7 @@ - + @@ -507,6 +507,9 @@ + + + @@ -612,6 +615,7 @@ @@ -787,7 +791,7 @@ - + @@ -795,19 +799,26 @@ - + - + + + + + + + + @@ -816,17 +827,9 @@ - - make - -j16 - clean - true - true - true - make - -j16 + -f Makefile-Hosted -j16 hardclean true true @@ -836,10 +839,16 @@ - + - + + + + + + + diff --git a/misc/eclipse/.project b/misc/eclipse/.project index 906c567f..059a5c19 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 e13c99a18846a9663b9b8b69f040955d99d24483 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 13:07:05 +0100 Subject: [PATCH 06/16] compile check succesfull --- bsp_hosted/fsfwconfig/OBSWConfig.h | 6 +++--- bsp_q7s/CMakeLists.txt | 1 - bsp_q7s/ObjectFactory.cpp | 6 +++--- fsfwconfig/OBSWConfig.h | 17 ++++++++--------- fsfwconfig/devices/gpioIds.h | 2 +- mission/devices/HeaterHandler.h | 2 +- mission/devices/MGMHandlerLIS3MDL.cpp | 6 +++--- mission/devices/MGMHandlerLIS3MDL.h | 2 +- mission/devices/MGMHandlerRM3100.cpp | 4 ++-- mission/devices/MGMHandlerRM3100.h | 4 ++-- mission/devices/P60DockHandler.cpp | 2 +- mission/devices/PDU1Handler.cpp | 2 +- mission/devices/PDU2Handler.cpp | 2 +- mission/devices/Tmp1075Handler.cpp | 2 +- 14 files changed, 28 insertions(+), 30 deletions(-) diff --git a/bsp_hosted/fsfwconfig/OBSWConfig.h b/bsp_hosted/fsfwconfig/OBSWConfig.h index fa3769b1..b784cd03 100644 --- a/bsp_hosted/fsfwconfig/OBSWConfig.h +++ b/bsp_hosted/fsfwconfig/OBSWConfig.h @@ -8,9 +8,9 @@ #define OBSW_ADD_TEST_CODE 0 -// These defines should be disabled for mission code but are useful for -// debugging. -#define OBSW_ENHANCED_PRINTOUT 1 +/* These defines should be disabled for mission code but are useful for +debugging. */ +#define OBSW_VEBOSE_LEVEL 1 #ifdef __cplusplus diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 1da8067f..3d3a1c91 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -6,7 +6,6 @@ target_sources(${TARGET_NAME} PUBLIC add_subdirectory(boardconfig) add_subdirectory(comIF) -add_subdirectory(gpio) add_subdirectory(boardtest) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 8b14fb24..a7a0c601 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -30,10 +30,10 @@ #include #include #include -#include -#include +#include +#include -# if TEST_LIBGPIOD == 1 +#if TEST_LIBGPIOD == 1 #include "LibgpiodTest.h" #endif diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index 6cdf0024..66eddf12 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -6,18 +6,17 @@ #ifndef FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_ -#define TEST_LIBGPIOD 0 -#define ADD_TEST_TAST 0 +#define TEST_LIBGPIOD 0 -// These defines should be disabled for mission code but are useful for -// debugging. -#define OBSW_ENHANCED_PRINTOUT 1 +/* These defines should be disabled for mission code but are useful for +debugging. */ +#define OBSW_VERBOSE_LEVEL 1 -#define TE0720 0 +#define TE0720 0 -#define P60DOCK_DEBUG 0 -#define PDU1_DEBUG 0 -#define PDU2_DEBUG 0 +#define P60DOCK_DEBUG 0 +#define PDU1_DEBUG 0 +#define PDU2_DEBUG 0 #include "OBSWVersion.h" diff --git a/fsfwconfig/devices/gpioIds.h b/fsfwconfig/devices/gpioIds.h index 332de906..cfef7e75 100644 --- a/fsfwconfig/devices/gpioIds.h +++ b/fsfwconfig/devices/gpioIds.h @@ -1,7 +1,7 @@ #ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_ #define FSFWCONFIG_DEVICES_GPIOIDS_H_ -#include +#include namespace gpioIds { enum gpioId_t { diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 22b33165..4c37c30f 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -11,8 +11,8 @@ #include #include #include +#include #include -#include /** * @brief This class intends the control of heaters. diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 2445620d..fad96f66 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -5,7 +5,7 @@ MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), dataset(this) { -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 debugDivider = new PeriodicOperationDivider(10); #endif // Set to default values right away. @@ -247,7 +247,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, float mgmZ = static_cast(mgmMeasurementRawZ) * sensitivityFactor * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->checkAndIncrement()) { sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; @@ -271,7 +271,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, case MGMLIS3MDL::READ_TEMPERATURE: { int16_t tempValueRaw = packet[2] << 8 | packet[1]; float tempValue = 25.0 + ((static_cast(tempValueRaw)) / 8.0); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->check()) { // Set terminal to utf-8 if there is an issue with micro printout. sif::info << "MGMHandlerLIS3: Temperature: " << tempValue<< " °C" diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MGMHandlerLIS3MDL.h index 4a62ba31..77874e33 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MGMHandlerLIS3MDL.h @@ -157,7 +157,7 @@ private: CommunicationStep communicationStep = CommunicationStep::DATA; bool commandExecuted = false; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index 62db06a7..76d3dd70 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -9,7 +9,7 @@ MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this) { -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 debugDivider = new PeriodicOperationDivider(10); #endif } @@ -328,7 +328,7 @@ ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) { int32_t fieldStrengthZ = (packet[7] << 16 | packet[8] << 8 | packet[9]) * scaleFactorZ; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->checkAndIncrement()) { sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; diff --git a/mission/devices/MGMHandlerRM3100.h b/mission/devices/MGMHandlerRM3100.h index 4af6b627..968953bf 100644 --- a/mission/devices/MGMHandlerRM3100.h +++ b/mission/devices/MGMHandlerRM3100.h @@ -6,7 +6,7 @@ #include -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 #include #endif @@ -97,7 +97,7 @@ private: const uint8_t *commandData,size_t commandDataLen); ReturnValue_t handleDataReadout(const uint8_t* packet); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif }; diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 4c504f9a..e34f96c2 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -25,7 +25,7 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t * */ handleDeviceTM(&p60dockHkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && P60DOCK_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && P60DOCK_DEBUG == 1 p60dockHkTableDataset.read(); float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index d9aa0d8c..540f0637 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -23,7 +23,7 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac parseHkTableReply(packet); // handleDeviceTM(&pdu1HkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && PDU1_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && PDU1_DEBUG == 1 pdu1HkTableDataset.read(); sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl; float vbat = pdu1HkTableDataset.vbat.value * 0.1; diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 117ae646..b442c12c 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -26,7 +26,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac */ handleDeviceTM(&pdu2HkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && PDU2_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && PDU2_DEBUG == 1 pdu2HkTableDataset.read(); sif::info << "PDU2 Q7S current voltage: " << pdu2HkTableDataset.voltageOutQ7S << " mV" << std::endl; sif::info << "PDU2 VCC: " << pdu2HkTableDataset.vcc << " mV" << std::endl; diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index e4eb1692..f0d95a18 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -98,7 +98,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, int16_t tempValueRaw = 0; tempValueRaw = packet[0] << 4 | packet[1] >> 4; float tempValue = ((static_cast(tempValueRaw)) * 0.0625); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Tmp1075 with object id: 0x" << std::hex << getObjectId() << ": Temperature: " << tempValue<< " °C" << std::endl; From adff5519c9eeec0dc92df96959617d23ac198010 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 13:24:13 +0100 Subject: [PATCH 07/16] readme update --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 673ccbe4..0e2ba34e 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ The CMake build system can be used to generate build systems as well (see helper - Linux (Raspberry Pi): Using the `bsp_rpi` BSP folder, and a very similar cross-compiler. For running the software on a Raspberry Pi, it is recommended to follow the steps specified in - [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and - using the TCF agent to have a similar set-up process also required for the Q7S. + [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and using the TCF agent to have a similar set-up process also required for the Q7S. + If you want to use the `gpiod` library, run `sudo apt-get install gpiod` on your Raspberry Pi + first to install the library. - Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator. - Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2. @@ -501,6 +502,7 @@ GET out_en[0] = 1 * Remote File Path: /tmp/eive_obsw.elf ## Libgpiod + Detect all gpio device files: ```` gpiodetect From 830c40a0c0d9acfbf6bc6691f7154d544e7ec494 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 13:26:35 +0100 Subject: [PATCH 08/16] small detail added --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e2ba34e..34de4cc3 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The CMake build system can be used to generate build systems as well (see helper For running the software on a Raspberry Pi, it is recommended to follow the steps specified in [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and using the TCF agent to have a similar set-up process also required for the Q7S. If you want to use the `gpiod` library, run `sudo apt-get install gpiod` on your Raspberry Pi - first to install the library. + first to install the library before cloning the system root folder. - Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator. - Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2. From 9a9eb6ab374485073f0490b5d004cb52b7aaa8e7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:32:45 +0100 Subject: [PATCH 09/16] readme update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34de4cc3..efe863c9 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ The CMake build system can be used to generate build systems as well (see helper - Linux (Raspberry Pi): Using the `bsp_rpi` BSP folder, and a very similar cross-compiler. For running the software on a Raspberry Pi, it is recommended to follow the steps specified in [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and using the TCF agent to have a similar set-up process also required for the Q7S. - If you want to use the `gpiod` library, run `sudo apt-get install gpiod` on your Raspberry Pi - first to install the library before cloning the system root folder. + If you want to use the `gpiod` library, run `sudo apt-get install gpiod libgpiod-dev` on your + Raspberry Pi first to install the library before cloning the system root folder. - Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator. - Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2. From 64842209080980227a99063b25e42413a1e2b9f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:33:53 +0100 Subject: [PATCH 10/16] updated project files --- misc/eclipse/.cproject | 22 ++++++++++++++++++++++ misc/eclipse/.project | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index a6bc0a6b..c8b1c059 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -219,6 +219,9 @@ + + + @@ -315,6 +318,7 @@ + + + @@ -459,6 +467,7 @@ + + + @@ -848,8 +861,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/misc/eclipse/.project b/misc/eclipse/.project index 059a5c19..906c567f 100644 --- a/misc/eclipse/.project +++ b/misc/eclipse/.project @@ -7,7 +7,7 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - full,incremental, + clean,full,incremental, From 73b396e9f7ce11bea261d95dfd4b4ecf5de625b8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:41:44 +0100 Subject: [PATCH 11/16] readme update --- README.md | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index efe863c9..449bcd06 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,7 @@ Target systems: The steps in the primary README are related to the main OBC target Q7S. The CMake build system can be used to generate build systems as well (see helper scripts in `cmake/scripts`: -- Linux (Raspberry Pi): Using the `bsp_rpi` BSP folder, and a very similar cross-compiler. - For running the software on a Raspberry Pi, it is recommended to follow the steps specified in - [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and using the TCF agent to have a similar set-up process also required for the Q7S. - If you want to use the `gpiod` library, run `sudo apt-get install gpiod libgpiod-dev` on your - Raspberry Pi first to install the library before cloning the system root folder. +- Linux (Raspberry Pi): See special section below. - Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator. - Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2. @@ -150,9 +146,9 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu After that, comfortable remote debugging should be possible with the Debug button. -A build configuration and a shell helper script has been provided to set up the path variables and build the Q7S binary -on Windows, but a launch configuration needs to be newly created because the IP address and path settings differ -from machine to machine. +A build configuration and a shell helper script has been provided to set up the path variables and +build the Q7S binary on Windows, but a launch configuration needs to be newly created because the +IP address and path settings differ from machine to machine. ## Building in Xilinx SDK 2018.2 @@ -529,3 +525,26 @@ gpioget ```` Example to get state: gpioget gpiochip7 14 + +## Running the EIVE OBSW on a Raspberry Pi + +Special section for running the EIVE OBSW on the Raspberry Pi +It uses the `bsp_rpi` BSP folder, and a very similar cross-compiler. + +For running the software on a Raspberry Pi, it is recommended to follow the steps specified in +[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) +and using the TCF agent to have a similar set-up process also required for the Q7S. +If you want to use the `gpiod` library, run + +```sh +sudo apt-get install gpiod libgpiod-dev +``` + +on your Raspberry Pi first to install the library before cloning the system root folder. + +## Special notes on Eclipse + +When using Eclipse, there are two special build variables in the project properties +→ C/C++ Build → Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set +the sysroot path in those variables to get any additional includes like `gpiod.h` in the +Eclipse indexer. \ No newline at end of file From 4c4f5de7717241d493f4c455e956549939c70159 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:43:25 +0100 Subject: [PATCH 12/16] readme update --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 449bcd06..54fd2b30 100644 --- a/README.md +++ b/README.md @@ -528,19 +528,19 @@ gpioget gpiochip7 14 ## Running the EIVE OBSW on a Raspberry Pi -Special section for running the EIVE OBSW on the Raspberry Pi -It uses the `bsp_rpi` BSP folder, and a very similar cross-compiler. +Special section for running the EIVE OBSW on the Raspberry Pi. +The Raspberry Pi build uses the `bsp_rpi` BSP folder, and a very similar cross-compiler. For running the software on a Raspberry Pi, it is recommended to follow the steps specified in [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and using the TCF agent to have a similar set-up process also required for the Q7S. -If you want to use the `gpiod` library, run +You should run the following command first on your Raspberry Pi ```sh sudo apt-get install gpiod libgpiod-dev ``` -on your Raspberry Pi first to install the library before cloning the system root folder. +to install the required GPIO libraries before cloning the system root folder. ## Special notes on Eclipse From b5fa151415b5edbf2c4a396b495c5f87110d5e97 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:48:24 +0100 Subject: [PATCH 13/16] new section for sysroot --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 54fd2b30..4d8c0ecf 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,13 @@ C++ applications. Alternatively you can download the toolchain sudo apt-get install cmake ```` +## Getting the Q7S system root + +It is necessary to copy the Q7S system root to your local development machine for libraries +like `libgpio`. You can find the system root [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). Download it and unzip it somewhere in the Xilinx installation folder. + +Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path. + ## Building the software with CMake When using Windows, run theses steps in MSYS2. From bb7eb5edec57264cadb8bf1bdbdc363fb8f21342 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:55:33 +0100 Subject: [PATCH 14/16] moved stuff to linux folder --- CMakeLists.txt | 7 ++----- bsp_q7s/comIF/CMakeLists.txt | 4 ---- linux/CMakeLists.txt | 2 ++ linux/csp/CMakeLists.txt | 8 ++++++++ {bsp_q7s/comIF => linux/csp}/CspComIF.cpp | 3 +-- {bsp_q7s/comIF => linux/csp}/CspComIF.h | 0 {bsp_q7s/comIF/cookies => linux/csp}/CspCookie.cpp | 0 {bsp_q7s/comIF/cookies => linux/csp}/CspCookie.h | 0 linux/i2c/CMakeLists.txt | 8 ++++++++ {bsp_q7s/comIF => linux/i2c}/I2cComIF.cpp | 5 +++-- {bsp_q7s/comIF => linux/i2c}/I2cComIF.h | 2 +- {bsp_q7s/comIF/cookies => linux/i2c}/I2cCookie.cpp | 2 +- {bsp_q7s/comIF/cookies => linux/i2c}/I2cCookie.h | 0 13 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 linux/csp/CMakeLists.txt rename {bsp_q7s/comIF => linux/csp}/CspComIF.cpp (99%) rename {bsp_q7s/comIF => linux/csp}/CspComIF.h (100%) rename {bsp_q7s/comIF/cookies => linux/csp}/CspCookie.cpp (100%) rename {bsp_q7s/comIF/cookies => linux/csp}/CspCookie.h (100%) create mode 100644 linux/i2c/CMakeLists.txt rename {bsp_q7s/comIF => linux/i2c}/I2cComIF.cpp (98%) rename {bsp_q7s/comIF => linux/i2c}/I2cComIF.h (97%) rename {bsp_q7s/comIF/cookies => linux/i2c}/I2cCookie.cpp (90%) rename {bsp_q7s/comIF/cookies => linux/i2c}/I2cCookie.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c726931..36a531d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,12 +58,9 @@ if(TGT_BSP) if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") set(ROOT_CONFIG_FOLDER TRUE) set(FSFW_CONFIG_PATH "fsfwconfig") + set(ADD_LINUX_FILES TRUE) + set(ADD_CSP_LIB TRUE) endif() - - if(${TGT_BSP} MATCHES "arm/q7s") - set(ADD_CSP_LIB TRUE) - endif() - set(ADD_LINUX_FILES TRUE) else() # Required by FSFW library set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") diff --git a/bsp_q7s/comIF/CMakeLists.txt b/bsp_q7s/comIF/CMakeLists.txt index a2236937..0599b73f 100644 --- a/bsp_q7s/comIF/CMakeLists.txt +++ b/bsp_q7s/comIF/CMakeLists.txt @@ -1,8 +1,4 @@ target_sources(${TARGET_NAME} PRIVATE - cookies/CspCookie.cpp - cookies/I2cCookie.cpp - CspComIF.cpp - I2cComIF.cpp ) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index c102da2f..b8aa76cf 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,2 +1,4 @@ add_subdirectory(gpio) +add_subdirectory(i2c) +add_subdirectory(csp) diff --git a/linux/csp/CMakeLists.txt b/linux/csp/CMakeLists.txt new file mode 100644 index 00000000..b5b2768e --- /dev/null +++ b/linux/csp/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + CspComIF.cpp + CspCookie.cpp +) + + + + diff --git a/bsp_q7s/comIF/CspComIF.cpp b/linux/csp/CspComIF.cpp similarity index 99% rename from bsp_q7s/comIF/CspComIF.cpp rename to linux/csp/CspComIF.cpp index 9d7543c3..64808eff 100644 --- a/bsp_q7s/comIF/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -1,5 +1,5 @@ #include "CspComIF.h" -#include "cookies/CspCookie.h" +#include "CspCookie.h" #include #include @@ -7,7 +7,6 @@ CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) { - } CspComIF::~CspComIF() { diff --git a/bsp_q7s/comIF/CspComIF.h b/linux/csp/CspComIF.h similarity index 100% rename from bsp_q7s/comIF/CspComIF.h rename to linux/csp/CspComIF.h diff --git a/bsp_q7s/comIF/cookies/CspCookie.cpp b/linux/csp/CspCookie.cpp similarity index 100% rename from bsp_q7s/comIF/cookies/CspCookie.cpp rename to linux/csp/CspCookie.cpp diff --git a/bsp_q7s/comIF/cookies/CspCookie.h b/linux/csp/CspCookie.h similarity index 100% rename from bsp_q7s/comIF/cookies/CspCookie.h rename to linux/csp/CspCookie.h diff --git a/linux/i2c/CMakeLists.txt b/linux/i2c/CMakeLists.txt new file mode 100644 index 00000000..179abd06 --- /dev/null +++ b/linux/i2c/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + I2cComIF.cpp + I2cCookie.cpp +) + + + + diff --git a/bsp_q7s/comIF/I2cComIF.cpp b/linux/i2c/I2cComIF.cpp similarity index 98% rename from bsp_q7s/comIF/I2cComIF.cpp rename to linux/i2c/I2cComIF.cpp index 8cbd45b3..2f1d710a 100644 --- a/bsp_q7s/comIF/I2cComIF.cpp +++ b/linux/i2c/I2cComIF.cpp @@ -1,5 +1,6 @@ -#include -#include +#include "I2cComIF.h" +#include + #include #include #include diff --git a/bsp_q7s/comIF/I2cComIF.h b/linux/i2c/I2cComIF.h similarity index 97% rename from bsp_q7s/comIF/I2cComIF.h rename to linux/i2c/I2cComIF.h index 7bf339ad..5e75a280 100644 --- a/bsp_q7s/comIF/I2cComIF.h +++ b/linux/i2c/I2cComIF.h @@ -1,9 +1,9 @@ #ifndef BSP_Q7S_COMIF_I2COMIF_H_ #define BSP_Q7S_COMIF_I2COMIF_H_ +#include "I2cCookie.h" #include #include -#include #include #include diff --git a/bsp_q7s/comIF/cookies/I2cCookie.cpp b/linux/i2c/I2cCookie.cpp similarity index 90% rename from bsp_q7s/comIF/cookies/I2cCookie.cpp rename to linux/i2c/I2cCookie.cpp index 1b2ee675..7f86bdc3 100644 --- a/bsp_q7s/comIF/cookies/I2cCookie.cpp +++ b/linux/i2c/I2cCookie.cpp @@ -1,4 +1,4 @@ -#include +#include "I2cCookie.h" I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, std::string deviceFile_) : diff --git a/bsp_q7s/comIF/cookies/I2cCookie.h b/linux/i2c/I2cCookie.h similarity index 100% rename from bsp_q7s/comIF/cookies/I2cCookie.h rename to linux/i2c/I2cCookie.h From 0e8a4d47038f40cb4160b378906d82b43d78d5df Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 14:59:43 +0100 Subject: [PATCH 15/16] repaired q7s build/includes --- bsp_q7s/ObjectFactory.cpp | 156 +++++++++++++++++++------------------- bsp_q7s/ObjectFactory.h | 5 +- linux/CMakeLists.txt | 1 + linux/spi/CMakeLists.txt | 6 ++ 4 files changed, 89 insertions(+), 79 deletions(-) create mode 100644 linux/spi/CMakeLists.txt diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index a7a0c601..a4503981 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -26,10 +26,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -38,133 +38,137 @@ #endif void Factory::setStaticFrameworkObjectIds() { - PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; - PusServiceBase::packetDestination = objects::TM_FUNNEL; + PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; + PusServiceBase::packetDestination = objects::TM_FUNNEL; - CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; - CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; + CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; + CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; - TmFunnel::downlinkDestination = objects::UDP_BRIDGE; - // No storage object for now. - TmFunnel::storageDestination = objects::NO_OBJECT; + TmFunnel::downlinkDestination = objects::UDP_BRIDGE; + // No storage object for now. + TmFunnel::storageDestination = objects::NO_OBJECT; - LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; + LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; - VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; - TmPacketStored::timeStamperId = objects::TIME_STAMPER; + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + TmPacketStored::timeStamperId = objects::TIME_STAMPER; } void ObjectFactory::produce(){ - Factory::setStaticFrameworkObjectIds(); - ObjectFactory::produceGenericObjects(); + Factory::setStaticFrameworkObjectIds(); + ObjectFactory::produceGenericObjects(); #if TE0720 == 1 - I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, - TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); - I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, - TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); + I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, + TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); + I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, + TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); #else - I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, + I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1")); I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1")); #endif /* Communication interfaces */ - new CspComIF(objects::CSP_COM_IF); - new I2cComIF(objects::I2C_COM_IF); + new CspComIF(objects::CSP_COM_IF); + new I2cComIF(objects::I2C_COM_IF); #if TE0720 == 0 - CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, - addresses::P60DOCK); + CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, + addresses::P60DOCK); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, - addresses::ACU); + addresses::ACU); /* Device Handler */ - P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); - PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); - PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); - ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); - new PCDUHandler(objects::PCDU_HANDLER, 50); + P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, + objects::CSP_COM_IF, p60DockCspCookie); + PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, + objects::CSP_COM_IF, pdu1CspCookie); + PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, + objects::CSP_COM_IF, pdu2CspCookie); + ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, + objects::CSP_COM_IF, acuCspCookie); + new PCDUHandler(objects::PCDU_HANDLER, 50); - /** - * Setting PCDU devices to mode normal immediately after start up because PCDU is always - * running. - */ - p60dockhandler->setModeNormal(); - pdu1handler->setModeNormal(); - pdu2handler->setModeNormal(); - acuhandler->setModeNormal(); + /** + * Setting PCDU devices to mode normal immediately after start up because PCDU is always + * running. + */ + p60dockhandler->setModeNormal(); + pdu1handler->setModeNormal(); + pdu2handler->setModeNormal(); + acuhandler->setModeNormal(); #endif - /* Temperature sensors */ - Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( - objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, - i2cCookieTmp1075tcs1); - tmp1075Handler_1->setStartUpImmediately(); - Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( - objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, - i2cCookieTmp1075tcs2); - tmp1075Handler_2->setStartUpImmediately(); + /* Temperature sensors */ + Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( + objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, + i2cCookieTmp1075tcs1); + tmp1075Handler_1->setStartUpImmediately(); + Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( + objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, + i2cCookieTmp1075tcs2); + tmp1075Handler_2->setStartUpImmediately(); - GpioCookie* gpioCookie = new GpioCookie; - new LinuxLibgpioIF(objects::GPIO_IF); + GpioCookie* gpioCookie = new GpioCookie; + new LinuxLibgpioIF(objects::GPIO_IF); #if TE0720 == 0 - /* Pin H2-11 on stack connector */ - GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, + /* Pin H2-11 on stack connector */ + GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ GpioConfig_t gpioConfigHeater1(std::string("gpiochip7"), 14, - std::string("Heater1"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); + std::string("Heater1"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); - /* Pin H2-13 on stack connector */ + /* Pin H2-13 on stack connector */ GpioConfig_t gpioConfigHeater2(std::string("gpiochip7"), 20, - std::string("Heater2"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); + std::string("Heater2"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); GpioConfig_t gpioConfigHeater3(std::string("gpiochip7"), 16, - std::string("Heater3"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); + std::string("Heater3"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); GpioConfig_t gpioConfigHeater4(std::string("gpiochip7"), 24, - std::string("Heater4"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); + std::string("Heater4"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); GpioConfig_t gpioConfigHeater5(std::string("gpiochip7"), 26, - std::string("Heater5"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); + std::string("Heater5"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); GpioConfig_t gpioConfigHeater6(std::string("gpiochip7"), 22, - std::string("Heater6"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); + std::string("Heater6"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); GpioConfig_t gpioConfigHeater7(std::string("gpiochip7"), 28, - std::string("Heater7"), gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); + std::string("Heater7"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); - new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, - pcduSwitches::TCS_BOARD_8V_HEATER_IN); + new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, + pcduSwitches::TCS_BOARD_8V_HEATER_IN); #endif - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, - objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, + objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #if TE0720 == 1 && TEST_LIBGPIOD == 1 - /* Configure MIO0 as input */ + /* Configure MIO0 as input */ GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0); gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0); - new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); + new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); #elif TE0720 == 1 - // Configuration for MIO0 on TE0720-03-1CFA + /* Configuration for MIO0 on TE0720-03-1CFA */ GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0, std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater); diff --git a/bsp_q7s/ObjectFactory.h b/bsp_q7s/ObjectFactory.h index 5e3358ae..38ec0e9e 100644 --- a/bsp_q7s/ObjectFactory.h +++ b/bsp_q7s/ObjectFactory.h @@ -1,10 +1,9 @@ #ifndef BSP_Q7S_OBJECTFACTORY_H_ #define BSP_Q7S_OBJECTFACTORY_H_ - namespace ObjectFactory { - void setStatics(); - void produce(); +void setStatics(); +void produce(); }; #endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index b8aa76cf..9a25fdff 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(gpio) add_subdirectory(i2c) add_subdirectory(csp) +add_subdirectory(spi) diff --git a/linux/spi/CMakeLists.txt b/linux/spi/CMakeLists.txt new file mode 100644 index 00000000..45a7edcc --- /dev/null +++ b/linux/spi/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${TARGET_NAME} PUBLIC +) + + + + From 5fb848d7314e1a939701f70e761bc30eebf07194 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 15:01:04 +0100 Subject: [PATCH 16/16] tabs/spaces --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36a531d8..22e45134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,15 +55,15 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) - if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") - set(ROOT_CONFIG_FOLDER TRUE) - set(FSFW_CONFIG_PATH "fsfwconfig") + if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") + set(ROOT_CONFIG_FOLDER TRUE) + set(FSFW_CONFIG_PATH "fsfwconfig") set(ADD_LINUX_FILES TRUE) set(ADD_CSP_LIB TRUE) - endif() + endif() else() - # Required by FSFW library - set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") + # Required by FSFW library + set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") endif() ################################################################################ @@ -75,11 +75,11 @@ add_executable(${TARGET_NAME}) # Add subdirectories if(ROOT_CONFIG_FOLDER) - add_subdirectory(${FSFW_CONFIG_PATH}) + add_subdirectory(${FSFW_CONFIG_PATH}) endif() if(ADD_CSP_LIB) - add_subdirectory(${CSPLIB_PATH}) + add_subdirectory(${CSPLIB_PATH}) endif() if(ADD_LINUX_FILES)