From a6067268242604b904f2c19b8df5cd59da0309e3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Dec 2020 18:14:03 +0100 Subject: [PATCH] reparied arduino stuff --- Makefile-Hosted | 14 ++++----- bsp_hosted/comIF/ArduinoComIF.cpp | 15 ++++++---- misc/eclipse/eive-linux-host-debug.launch | 33 +++++++++++++++++++++ misc/eclipse/eive-linux-host-release.launch | 33 +++++++++++++++++++++ 4 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 misc/eclipse/eive-linux-host-debug.launch create mode 100644 misc/eclipse/eive-linux-host-release.launch diff --git a/Makefile-Hosted b/Makefile-Hosted index 49460898..3a93f625 100644 --- a/Makefile-Hosted +++ b/Makefile-Hosted @@ -187,10 +187,10 @@ $(foreach S,$(SUBDIRS),$(eval $(INCLUDE_FILE))) # VPATH += mission/pus/ -ifeq ($(DETECTED_OS), LINUX) -CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp -CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp -endif +#ifeq ($(DETECTED_OS), LINUX) +#CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp +#CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp +#endif # All C Sources included by .mk files are assigned here # Add the objects to sources so dependency handling works @@ -268,12 +268,12 @@ ASFLAGS = -Wall -g $(OPTIMIZATION) $(I_INCLUDES) -D__ASSEMBLY__ # LINK_INCLUDES specify the path to used libraries and the linker script # LINK_LIBRARIES link HCC and HAL library and enable float support LDFLAGS := -g3 -pthread $(DEAD_CODE_REMOVAL) $(OPTIMIZATION) - -LINK_INCLUDES := - LINK_LIBRARIES := + ifeq ($(OS),Windows_NT) LINK_LIBRARIES += -lwsock32 -lws2_32 +else +LINK_LIBRARIES += -lrt endif # Gnu Coverage Tools Flags diff --git a/bsp_hosted/comIF/ArduinoComIF.cpp b/bsp_hosted/comIF/ArduinoComIF.cpp index 047a60ae..2db293e6 100644 --- a/bsp_hosted/comIF/ArduinoComIF.cpp +++ b/bsp_hosted/comIF/ArduinoComIF.cpp @@ -1,5 +1,6 @@ -#include -#include +#include "ArduinoComIF.h" +#include "ArduinoCookie.h" + #include #include #include @@ -7,6 +8,8 @@ // This only works on Linux #ifdef LINUX #include +#include +#include #elif WIN32 #include #include @@ -254,7 +257,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, encodedLen = sizeof(sendBuffer) - remainingLen; #ifdef LINUX - ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen); + ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen); if (writtenlen < 0) { //we could try to find out what happened... return RETURN_FAILED; @@ -285,7 +288,7 @@ void ArduinoComIF::handleSerialPortRx() { rxBuffer.writeData(dataFromSerial, bytesRead); - uint8_t dataReceivedSoFar[rxBuffer.maxSize()]; + uint8_t dataReceivedSoFar[rxBuffer.getMaxSize()]; uint32_t dataLenReceivedSoFar = 0; @@ -295,11 +298,11 @@ void ArduinoComIF::handleSerialPortRx() { //look for STX size_t firstSTXinRawData = 0; while ((firstSTXinRawData < dataLenReceivedSoFar) - && (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) { + && (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) { firstSTXinRawData++; } - if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) { + if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR) { //there is no STX in our data, throw it away... rxBuffer.deleteData(dataLenReceivedSoFar); return; diff --git a/misc/eclipse/eive-linux-host-debug.launch b/misc/eclipse/eive-linux-host-debug.launch new file mode 100644 index 00000000..f5ab1ac7 --- /dev/null +++ b/misc/eclipse/eive-linux-host-debug.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/eclipse/eive-linux-host-release.launch b/misc/eclipse/eive-linux-host-release.launch new file mode 100644 index 00000000..7548f831 --- /dev/null +++ b/misc/eclipse/eive-linux-host-release.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +