From 6d2f44a432aaf36ab27bd47a54bb0c96479c1c81 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 21:46:11 +0200 Subject: [PATCH 1/3] tweaks to make windows build again --- src/fsfw/osal/host/Clock.cpp | 1 + src/fsfw/osal/windows/winTaskHelpers.cpp | 1 + src/fsfw/osal/windows/winTaskHelpers.h | 4 +++- src/fsfw/timemanager/ClockCommon.cpp | 8 +++++++- src/fsfw/timemanager/TimeReaderIF.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/fsfw/osal/host/Clock.cpp b/src/fsfw/osal/host/Clock.cpp index 29c6c1a6..dbf6529c 100644 --- a/src/fsfw/osal/host/Clock.cpp +++ b/src/fsfw/osal/host/Clock.cpp @@ -8,6 +8,7 @@ #if defined(PLATFORM_WIN) #include +#define timegm _mkgmtime #elif defined(PLATFORM_UNIX) #include #endif diff --git a/src/fsfw/osal/windows/winTaskHelpers.cpp b/src/fsfw/osal/windows/winTaskHelpers.cpp index 206ee7a7..5b4feb86 100644 --- a/src/fsfw/osal/windows/winTaskHelpers.cpp +++ b/src/fsfw/osal/windows/winTaskHelpers.cpp @@ -1,6 +1,7 @@ #include "fsfw/osal/windows/winTaskHelpers.h" #include +#include TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) { return (static_cast(prioClass) << 16) | static_cast(prioNumber); diff --git a/src/fsfw/osal/windows/winTaskHelpers.h b/src/fsfw/osal/windows/winTaskHelpers.h index 87cd92ce..2d6ef9b4 100644 --- a/src/fsfw/osal/windows/winTaskHelpers.h +++ b/src/fsfw/osal/windows/winTaskHelpers.h @@ -1,10 +1,12 @@ #include #include -#include "../../tasks/TaskFactory.h" +#include "fsfw/tasks/TaskFactory.h" #ifdef _WIN32 +#include + namespace tasks { enum PriorityClass : uint16_t { diff --git a/src/fsfw/timemanager/ClockCommon.cpp b/src/fsfw/timemanager/ClockCommon.cpp index 45755f35..d0ac9004 100644 --- a/src/fsfw/timemanager/ClockCommon.cpp +++ b/src/fsfw/timemanager/ClockCommon.cpp @@ -61,10 +61,16 @@ ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t* if (result != returnvalue::OK) { return result; } - MutexGuard helper(timeMutex); // gmtime writes its output in a global buffer which is not Thread Safe // Therefore we have to use a Mutex here + MutexGuard helper(timeMutex); +#ifdef PLATFORM_WIN + time_t time; + time = from->tv_sec; + timeInfo = gmtime(&time); +#else timeInfo = gmtime(&from->tv_sec); +#endif to->year = timeInfo->tm_year + 1900; to->month = timeInfo->tm_mon + 1; to->day = timeInfo->tm_mday; diff --git a/src/fsfw/timemanager/TimeReaderIF.h b/src/fsfw/timemanager/TimeReaderIF.h index a3343e1c..ceb0a872 100644 --- a/src/fsfw/timemanager/TimeReaderIF.h +++ b/src/fsfw/timemanager/TimeReaderIF.h @@ -2,6 +2,12 @@ #define FSFW_TIMEMANAGER_TIMEREADERIF_H #include +#include "fsfw/platform.h" + +#ifdef PLATFORM_WIN +// wtf? Required for timeval! +#include +#endif #include "TimeStampIF.h" #include "fsfw/returnvalues/returnvalue.h" From 03e1a9325034bd9805bfc3a1aa65e9c188762d12 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 27 Sep 2022 23:57:58 +0200 Subject: [PATCH 2/3] last windows tweak --- src/fsfw_hal/common/gpio/gpioDefinitions.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fsfw_hal/common/gpio/gpioDefinitions.h b/src/fsfw_hal/common/gpio/gpioDefinitions.h index a15ffbc0..b8e628ea 100644 --- a/src/fsfw_hal/common/gpio/gpioDefinitions.h +++ b/src/fsfw_hal/common/gpio/gpioDefinitions.h @@ -5,6 +5,13 @@ #include #include +#ifdef PLATFORM_WIN +// What is this crap? +#undef IN +#undef OUT +#undef CALLBACK +#endif + using gpioId_t = uint16_t; namespace gpio { From 2ca8d72e83d79c1ddf810509738c2107b92221cd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Sep 2022 00:03:12 +0200 Subject: [PATCH 3/3] another small windows tweak --- src/fsfw/osal/common/TcpIpBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/osal/common/TcpIpBase.cpp b/src/fsfw/osal/common/TcpIpBase.cpp index 7e989c36..de0a573d 100644 --- a/src/fsfw/osal/common/TcpIpBase.cpp +++ b/src/fsfw/osal/common/TcpIpBase.cpp @@ -1,5 +1,6 @@ #include "fsfw/osal/common/TcpIpBase.h" +#include "fsfw/serviceinterface.h" #include "fsfw/platform.h" #ifdef PLATFORM_UNIX