Some fixes

1. InternalUnitTester: Mutex test now uses new defines
2. CMakeLists.txt: The OSAL defines are now defined in the FSFW.h file
This commit is contained in:
Robin Müller 2021-08-10 11:21:57 +02:00
parent 09d76c2e26
commit a747be6c65
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 15 additions and 15 deletions

View File

@ -63,18 +63,19 @@ set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST)
if(FSFW_OSAL MATCHES host)
set(OS_FSFW_NAME "Host")
set(FSFW_OSAL_HOST ON)
elseif(FSFW_OSAL MATCHES linux)
set(OS_FSFW_NAME "Linux")
set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX)
set(FSFW_OSAL_HOST ON)
elseif(FSFW_OSAL MATCHES freertos)
set(OS_FSFW_NAME "FreeRTOS")
set(FSFW_OSAL_DEFINITION FSFW_OSAL_FREERTOS)
set(FSFW_OSAL_FREERTOS ON)
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${LIB_OS_NAME}
)
elseif(FSFW_OSAL STREQUAL rtems)
set(OS_FSFW_NAME "RTEMS")
set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS)
set(FSFW_OSAL_RTEMS ON)
else()
message(WARNING
"Invalid operating system for FSFW specified! Setting to host.."
@ -83,14 +84,6 @@ else()
set(OS_FSFW "host")
endif()
target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
${FSFW_OSAL_DEFINITION}
)
target_compile_definitions(${LIB_FSFW_NAME} INTERFACE
${FSFW_OSAL_DEFINITION}
)
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
add_subdirectory(src)

View File

@ -3,6 +3,11 @@
#include "FSFWConfig.h"
#cmakedefine FSFW_OSAL_RTEMS
#cmakedefine FSFW_OSAL_FREERTOS
#cmakedefine FSFW_OSAL_LINUX
#cmakedefine FSFW_OSAL_HOST
#cmakedefine FSFW_ADD_RMAP
#cmakedefine FSFW_ADD_DATALINKLAYER
#cmakedefine FSFW_ADD_TMSTORAGE

View File

@ -1,10 +1,12 @@
#include "fsfw_tests/internal/osal/IntTestMutex.h"
#include "fsfw_tests/internal/UnittDefinitions.h"
#include "fsfw/platform.h"
#include <fsfw/ipc/MutexFactory.h>
#if defined(WIN32) || defined(UNIX)
#include <fsfw/osal/host/Mutex.h>
#if defined PLATFORM_WIN || defined PLATFORM_UNIX
#include "fsfw/osal/host/Mutex.h"
#include <thread>
#include <future>
#endif
@ -20,7 +22,7 @@ void testmutex::testMutex() {
// timed_mutex from the C++ library specifies undefined behaviour if
// the timed mutex is locked twice from the same thread.
// TODO: we should pass a define like FSFW_OSAL_HOST to the build.
#if defined(WIN32) || defined(UNIX)
#if defined PLATFORM_WIN || defined PLATFORM_UNIX
// This calls the function from
// another thread and stores the returnvalue in a future.
auto future = std::async(&MutexIF::lockMutex, mutex, MutexIF::TimeoutType::WAITING, 1);
@ -38,7 +40,7 @@ void testmutex::testMutex() {
}
// TODO: we should pass a define like FSFW_OSAL_HOST to the build.
#if !defined(WIN32) && !defined(UNIX)
#if !defined PLATFORM_WIN && !defined PLATFORM_UNIX
result = mutex->unlockMutex();
if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) {
unitt::put_error(id);