From 6ccf16f56d11579aadedc1df93733c5f2faac83f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Mar 2022 09:37:23 +0100 Subject: [PATCH 1/3] enabled more GCC warnings --- CMakeLists.txt | 52 +++++++++++++------ bsp_q7s/boardconfig/q7sConfig.h.in | 4 ++ bsp_q7s/devices/PlocSupervisorHandler.h | 1 + bsp_q7s/memory/SdCardManager.cpp | 9 ++-- common/config/commonConfig.h.in | 2 +- common/config/lwgps_opts.h | 4 ++ fsfw | 2 +- generators/fsfwgen | 2 +- linux/boardtest/UartTestClass.cpp | 4 ++ linux/devices/GPSHyperionLinuxController.cpp | 1 + .../startracker/StarTrackerHandler.cpp | 2 +- .../pollingSequenceFactory.cpp | 8 +++ mission/controller/ThermalController.cpp | 4 +- mission/core/GenericFactory.cpp | 4 +- mission/devices/ACUHandler.cpp | 2 +- thirdparty/arcsec_star_tracker | 2 +- tmtc | 2 +- 17 files changed, 72 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20a5c67e..03d51ac2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,24 +159,42 @@ find_package(Catch2 3) #global compiler options need to be set before adding executables if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options( - "-Wall" - "-Wextra" - "-Wimplicit-fallthrough=1" - "-Wno-unused-parameter" - "-Wno-psabi" - ) - # Remove unused sections. - add_compile_options( - "-ffunction-sections" - "-fdata-sections" - ) + add_compile_options( + "-Wall" + "-Wextra" + "-Wimplicit-fallthrough=1" + "-Wno-unused-parameter" + "-Wno-psabi" + "-Wduplicated-cond" # check for duplicate conditions + "-Wduplicated-branches" # check for duplicate branches + "-Wlogical-op" # Search for bitwise operations instead of logical + "-Wnull-dereference" # Search for NULL dereference + "-Wundef" # Warn if undefind marcos are used + "-Wformat=2" # Format string problem detection + "-Wformat-overflow=2" # Formatting issues in printf + "-Wformat-truncation=2" # Formatting issues in printf + "-Wformat-security" # Search for dangerous printf operations + "-Wstrict-overflow=3" # Warn if integer overflows might happen + "-Warray-bounds=2" # Some array bounds violations will be found + "-Wshift-overflow=2" # Search for bit left shift overflows ( #include #include diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index 769a7dd7..b76cee12 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -1,6 +1,8 @@ #include "SdCardManager.h" +#include "OBSWConfig.h" #include +#include #include #include @@ -404,16 +406,13 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) { bool bytesRead = false; #if OBSW_ENABLE_TIMERS == 1 - Timer timer; - timer.setTimer(100); - uint32_t remainingTimeMs = 0; + Countdown timer(100); #endif while (true) { ReturnValue_t result = cmdExecutor.check(bytesRead); // This timer can prevent deadlocks due to missconfigurations #if OBSW_ENABLE_TIMERS == 1 - timer.getTimer(&remainingTimeMs); - if (remainingTimeMs == 0) { + if (timer.hasTimedOut()) { sif::error << "SdCardManager::checkCurrentOp: Timeout!" << std::endl; return OpStatus::FAIL; } diff --git a/common/config/commonConfig.h.in b/common/config/commonConfig.h.in index c18d4bff..6d74884f 100644 --- a/common/config/commonConfig.h.in +++ b/common/config/commonConfig.h.in @@ -12,7 +12,7 @@ // because UDP packets are not allowed in the VPN // This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the // CCSDS IP Cores. -#define OBSW_USE_TCP_BRIDGE 1 +#define OBSW_USE_TMTC_TCP_BRIDGE 1 namespace common { extern const uint16_t PUS_PACKET_ID; diff --git a/common/config/lwgps_opts.h b/common/config/lwgps_opts.h index 20632d6f..2be39f1d 100644 --- a/common/config/lwgps_opts.h +++ b/common/config/lwgps_opts.h @@ -41,4 +41,8 @@ * copy & replace here settings you want to change values */ +#ifndef __DOXYGEN__ +#define __DOXYGEN__ 0 +#endif + #endif /* LWGPS_HDR_OPTS_H */ diff --git a/fsfw b/fsfw index d6c10411..8b1c277c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d6c1041133822903c123e4efd890b1320e1157c9 +Subproject commit 8b1c277c58b608db34bf221a1a79469a809ecbda diff --git a/generators/fsfwgen b/generators/fsfwgen index 52f29169..c5ef1783 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 52f291692c4074a23743c799148b0432a4e405fa +Subproject commit c5ef1783a3b082c0e88561bd91bc3ee0f459fafc diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 1f8c2563..9c51ed8a 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -14,6 +14,10 @@ #define GPS_REPLY_WIRETAPPING 0 +#ifndef RPI_TEST_GPS_HANDLER +#define RPI_TEST_GPS_HANDLER 0 +#endif + UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; } ReturnValue_t UartTestClass::initialize() { diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index fa1f8f02..722eb8e0 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -1,5 +1,6 @@ #include "GPSHyperionLinuxController.h" +#include "OBSWConfig.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/timemanager/Clock.h" diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index d06b73f1..c13faf5f 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -672,7 +672,7 @@ ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t return INVALID_SUBMODE; } default: - return HasModesIF::INVALID_MODE; + return HasModesIF::MOVE_IS_INVALID; } } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 81d47a4b..7bf5a607 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -5,6 +5,14 @@ #include #include +#ifndef RPI_TEST_ADIS16507 +#define RPI_TEST_ADIS16507 0 +#endif + +#ifndef RPI_TEST_GPS_HANDLER +#define RPI_TEST_GPS_HANDLER 0 +#endif + ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 2b6f704f..b47f4fab 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -42,7 +42,7 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode return INVALID_SUBMODE; } if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { - return INVALID_MODE; + return MOVE_IS_INVALID; } return RETURN_OK; -} \ No newline at end of file +} diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 651ba993..9eb27f22 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -24,7 +24,7 @@ #include "objects/systemObjectList.h" #if OBSW_ADD_TCPIP_BRIDGE == 1 -#if OBSW_USE_TCP_BRIDGE == 0 +#if OBSW_USE_TMTC_TCP_BRIDGE == 0 // UDP server includes #include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTmTcBridge.h" @@ -90,7 +90,7 @@ void ObjectFactory::produceGenericObjects() { pus::PUS_SERVICE_200); #if OBSW_ADD_TCPIP_BRIDGE == 1 -#if OBSW_USE_TCP_BRIDGE == 0 +#if OBSW_USE_TMTC_TCP_BRIDGE == 0 auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); sif::info << "Created UDP server for TMTC commanding with listener port " diff --git a/mission/devices/ACUHandler.cpp b/mission/devices/ACUHandler.cpp index 60e26302..b7a54088 100644 --- a/mission/devices/ACUHandler.cpp +++ b/mission/devices/ACUHandler.cpp @@ -23,7 +23,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack parseHkTableReply(packet); handleDeviceTM(&acuHkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && OBSW_DEBUG_ACU == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_ACU == 1 acuHkTableDataset.read(); float temperatureC_1 = acuHkTableDataset.temperature1.value * 0.1; float temperatureC_2 = acuHkTableDataset.temperature2.value * 0.1; diff --git a/thirdparty/arcsec_star_tracker b/thirdparty/arcsec_star_tracker index b1594df9..93e93965 160000 --- a/thirdparty/arcsec_star_tracker +++ b/thirdparty/arcsec_star_tracker @@ -1 +1 @@ -Subproject commit b1594df9303056456604726592635d8a1c987e75 +Subproject commit 93e93965e2c6405170b62c523dea1990db02d2ad diff --git a/tmtc b/tmtc index 37c1a68d..d64d443a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 37c1a68da1b465514e84403b06ce40d035e4ad88 +Subproject commit d64d443a99a911f946402e59b276566954b5b52b -- 2.43.0 From 10a2973dc7dfe21b7e9407a3684c13f31026adbd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Mar 2022 09:48:18 +0100 Subject: [PATCH 2/3] minor update in fsfw --- fsfw | 2 +- linux/devices/startracker/StarTrackerHandler.cpp | 2 +- mission/controller/ThermalController.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fsfw b/fsfw index 8b1c277c..84f95e8d 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8b1c277c58b608db34bf221a1a79469a809ecbda +Subproject commit 84f95e8d7641be7a83faf1cbee718c6cc5de152d diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index c13faf5f..d06b73f1 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -672,7 +672,7 @@ ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t return INVALID_SUBMODE; } default: - return HasModesIF::MOVE_IS_INVALID; + return HasModesIF::INVALID_MODE; } } diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index b47f4fab..d79bb26a 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -42,7 +42,7 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode return INVALID_SUBMODE; } if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { - return MOVE_IS_INVALID; + return INVALID_MODE; } return RETURN_OK; } -- 2.43.0 From d799e3768df46759d4f555a0c1e2db3b0d89e5b9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Mar 2022 09:50:47 +0100 Subject: [PATCH 3/3] repoint tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index d64d443a..abe9c8bc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d64d443a99a911f946402e59b276566954b5b52b +Subproject commit abe9c8bc000e834b99a2c367ed10f927eeb666b0 -- 2.43.0