From 508f31a359bd7cb5652f5e260bcd7ead6cb78e9a Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 2 Nov 2020 14:19:56 +0100 Subject: [PATCH 1/8] adaptions so it compiles --- devicehandlers/DeviceHandlerIF.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index 52a3be4d..10907a89 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -18,6 +18,8 @@ public: static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20; static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10; + static constexpr Command_t NO_COMMAND = 0xffffffff; + /** * @brief This is the mode the device handler is in. * -- 2.43.0 From 7d83767c2b408a05c95424f818457d0e57060eeb Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 2 Nov 2020 16:45:19 +0100 Subject: [PATCH 2/8] include added --- fsfw.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsfw.mk b/fsfw.mk index 3639717b..f2cdd7ab 100644 --- a/fsfw.mk +++ b/fsfw.mk @@ -70,3 +70,5 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/packetmatcher/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/pus/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcservices/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/pus/*.cpp) + +INCLUDES += $(CURRENTPATH) -- 2.43.0 From 3067259a9b266fed39e8333fd9a29439718b68e0 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 2 Nov 2020 17:19:24 +0100 Subject: [PATCH 3/8] include added --- fsfw.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsfw.mk b/fsfw.mk index 3639717b..f2cdd7ab 100644 --- a/fsfw.mk +++ b/fsfw.mk @@ -70,3 +70,5 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/packetmatcher/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/pus/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcservices/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/pus/*.cpp) + +INCLUDES += $(CURRENTPATH) -- 2.43.0 From cc51d9ace922fa0a0d141345a6de33ae84cd97f6 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 2 Nov 2020 17:21:25 +0100 Subject: [PATCH 4/8] small fix so that it compiles --- devicehandlers/DeviceHandlerIF.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index 52a3be4d..10c9b89a 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -18,6 +18,8 @@ public: static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20; static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10; + static constexpr DeviceCommandId_t NO_COMMAND = 0xffffffff; + /** * @brief This is the mode the device handler is in. * -- 2.43.0 From 113397c6c6ae4c46341f4880710e4e4d9b6e7630 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 7 Nov 2020 20:30:42 +0100 Subject: [PATCH 5/8] udp bridge for embedded linux --- osal/linux/TcUnixUdpPollingTask.cpp | 6 +++--- osal/linux/TmTcUnixUdpBridge.cpp | 22 +++++++++++++++------- osal/linux/TmTcUnixUdpBridge.h | 5 ++++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/osal/linux/TcUnixUdpPollingTask.cpp b/osal/linux/TcUnixUdpPollingTask.cpp index 670ba804..7df56a95 100644 --- a/osal/linux/TcUnixUdpPollingTask.cpp +++ b/osal/linux/TcUnixUdpPollingTask.cpp @@ -33,7 +33,7 @@ ReturnValue_t TcUnixUdpPollingTask::performOperation(uint8_t opCode) { while(1) { //! Sender Address is cached here. struct sockaddr_in senderAddress; - socklen_t senderSockLen = 0; + socklen_t senderSockLen = sizeof(senderAddress); ssize_t bytesReceived = recvfrom(serverUdpSocket, receptionBuffer.data(), frameSize, receptionFlags, reinterpret_cast(&senderAddress), &senderSockLen); @@ -45,8 +45,8 @@ ReturnValue_t TcUnixUdpPollingTask::performOperation(uint8_t opCode) { continue; } -// sif::debug << "TcSocketPollingTask::performOperation: " << bytesReceived -// << " bytes received" << std::endl; + sif::debug << "TcSocketPollingTask::performOperation: " << bytesReceived + << " bytes received" << std::endl; ReturnValue_t result = handleSuccessfullTcRead(bytesReceived); if(result != HasReturnvaluesIF::RETURN_FAILED) { diff --git a/osal/linux/TmTcUnixUdpBridge.cpp b/osal/linux/TmTcUnixUdpBridge.cpp index b55291b3..71a39384 100644 --- a/osal/linux/TmTcUnixUdpBridge.cpp +++ b/osal/linux/TmTcUnixUdpBridge.cpp @@ -65,13 +65,17 @@ TmTcUnixUdpBridge::~TmTcUnixUdpBridge() { ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) { int flags = 0; - clientAddress.sin_addr.s_addr = htons(INADDR_ANY); - //clientAddress.sin_addr.s_addr = inet_addr("127.73.73.1"); - clientAddressLen = sizeof(serverAddress); + MutexHelper lock(mutex, MutexIF::TimeoutType::WAITING, 10); -// char ipAddress [15]; -// sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, -// &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; + if(ipAddrAnySet){ + clientAddress.sin_addr.s_addr = htons(INADDR_ANY); + //clientAddress.sin_addr.s_addr = inet_addr("127.73.73.1"); + clientAddressLen = sizeof(serverAddress); + } + + char ipAddress [15]; + sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, + &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; ssize_t bytesSent = sendto(serverSocket, data, dataLen, flags, reinterpret_cast(&clientAddress), clientAddressLen); @@ -85,7 +89,7 @@ ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) { return HasReturnvaluesIF::RETURN_OK; } -void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) { +void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in& newAddress) { MutexHelper lock(mutex, MutexIF::TimeoutType::WAITING, 10); // char ipAddress [15]; @@ -168,3 +172,7 @@ void TmTcUnixUdpBridge::handleSendError() { } } +void TmTcUnixUdpBridge::setClientAddressToAny(bool ipAddrAnySet){ + this->ipAddrAnySet = ipAddrAnySet; +} + diff --git a/osal/linux/TmTcUnixUdpBridge.h b/osal/linux/TmTcUnixUdpBridge.h index 5245c44c..ae6f6adc 100644 --- a/osal/linux/TmTcUnixUdpBridge.h +++ b/osal/linux/TmTcUnixUdpBridge.h @@ -20,8 +20,9 @@ public: uint16_t serverPort = 0xFFFF,uint16_t clientPort = 0xFFFF); virtual~ TmTcUnixUdpBridge(); - void checkAndSetClientAddress(sockaddr_in clientAddress); + void checkAndSetClientAddress(sockaddr_in& clientAddress); + void setClientAddressToAny(bool ipAddrAnySet); protected: virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; @@ -36,6 +37,8 @@ private: struct sockaddr_in serverAddress; socklen_t serverAddressLen = 0; + bool ipAddrAnySet = false; + //! Access to the client address is mutex protected as it is set //! by another task. MutexIF* mutex; -- 2.43.0 From 83568e11d11e66f023ede3b7701df884c2129317 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 7 Nov 2020 20:37:48 +0100 Subject: [PATCH 6/8] removed unwanted changes --- devicehandlers/DeviceHandlerIF.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index 10c9b89a..52a3be4d 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -18,8 +18,6 @@ public: static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20; static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10; - static constexpr DeviceCommandId_t NO_COMMAND = 0xffffffff; - /** * @brief This is the mode the device handler is in. * -- 2.43.0 From 210d2de11e25bc2d521687aef35cf5f764df08ce Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 7 Nov 2020 20:40:01 +0100 Subject: [PATCH 7/8] fetched fsfw.mk from upstream master --- fsfw.mk | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fsfw.mk b/fsfw.mk index f2cdd7ab..c2c6e747 100644 --- a/fsfw.mk +++ b/fsfw.mk @@ -28,25 +28,12 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/*.cpp) # select the OS ifeq ($(OS_FSFW),rtems) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/rtems/*.cpp) - else ifeq ($(OS_FSFW),linux) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/linux/*.cpp) - else ifeq ($(OS_FSFW),freeRTOS) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/FreeRTOS/*.cpp) - else ifeq ($(OS_FSFW),host) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/host/*.cpp) -ifeq ($(OS),Windows_NT) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/windows/*.cpp) -else -# For now, the linux UDP bridge sources needs to be included manually by upper makefile -# for host OS because we can't be sure the OS is linux. -# Following lines can be used to do this: -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp -endif - else $(error invalid OS_FSFW specified, valid OS_FSFW are rtems, linux, freeRTOS, host) endif @@ -70,5 +57,3 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/packetmatcher/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/pus/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcservices/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/pus/*.cpp) - -INCLUDES += $(CURRENTPATH) -- 2.43.0 From 3eefcd3a2d52b7420c33dd34bc334093a37c3b03 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 7 Nov 2020 20:45:00 +0100 Subject: [PATCH 8/8] fsfw.mk adjusted to upstream master --- fsfw.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fsfw.mk b/fsfw.mk index c2c6e747..3639717b 100644 --- a/fsfw.mk +++ b/fsfw.mk @@ -28,12 +28,25 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/*.cpp) # select the OS ifeq ($(OS_FSFW),rtems) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/rtems/*.cpp) + else ifeq ($(OS_FSFW),linux) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/linux/*.cpp) + else ifeq ($(OS_FSFW),freeRTOS) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/FreeRTOS/*.cpp) + else ifeq ($(OS_FSFW),host) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/host/*.cpp) +ifeq ($(OS),Windows_NT) +CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/windows/*.cpp) +else +# For now, the linux UDP bridge sources needs to be included manually by upper makefile +# for host OS because we can't be sure the OS is linux. +# Following lines can be used to do this: +# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp +# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp +endif + else $(error invalid OS_FSFW specified, valid OS_FSFW are rtems, linux, freeRTOS, host) endif -- 2.43.0