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:
parent
09d76c2e26
commit
a747be6c65
@ -63,18 +63,19 @@ set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST)
|
|||||||
|
|
||||||
if(FSFW_OSAL MATCHES host)
|
if(FSFW_OSAL MATCHES host)
|
||||||
set(OS_FSFW_NAME "Host")
|
set(OS_FSFW_NAME "Host")
|
||||||
|
set(FSFW_OSAL_HOST ON)
|
||||||
elseif(FSFW_OSAL MATCHES linux)
|
elseif(FSFW_OSAL MATCHES linux)
|
||||||
set(OS_FSFW_NAME "Linux")
|
set(OS_FSFW_NAME "Linux")
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX)
|
set(FSFW_OSAL_HOST ON)
|
||||||
elseif(FSFW_OSAL MATCHES freertos)
|
elseif(FSFW_OSAL MATCHES freertos)
|
||||||
set(OS_FSFW_NAME "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
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||||
${LIB_OS_NAME}
|
${LIB_OS_NAME}
|
||||||
)
|
)
|
||||||
elseif(FSFW_OSAL STREQUAL rtems)
|
elseif(FSFW_OSAL STREQUAL rtems)
|
||||||
set(OS_FSFW_NAME "RTEMS")
|
set(OS_FSFW_NAME "RTEMS")
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS)
|
set(FSFW_OSAL_RTEMS ON)
|
||||||
else()
|
else()
|
||||||
message(WARNING
|
message(WARNING
|
||||||
"Invalid operating system for FSFW specified! Setting to host.."
|
"Invalid operating system for FSFW specified! Setting to host.."
|
||||||
@ -83,14 +84,6 @@ else()
|
|||||||
set(OS_FSFW "host")
|
set(OS_FSFW "host")
|
||||||
endif()
|
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.")
|
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
#include "FSFWConfig.h"
|
#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_RMAP
|
||||||
#cmakedefine FSFW_ADD_DATALINKLAYER
|
#cmakedefine FSFW_ADD_DATALINKLAYER
|
||||||
#cmakedefine FSFW_ADD_TMSTORAGE
|
#cmakedefine FSFW_ADD_TMSTORAGE
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#include "fsfw_tests/internal/osal/IntTestMutex.h"
|
#include "fsfw_tests/internal/osal/IntTestMutex.h"
|
||||||
#include "fsfw_tests/internal/UnittDefinitions.h"
|
#include "fsfw_tests/internal/UnittDefinitions.h"
|
||||||
|
#include "fsfw/platform.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/MutexFactory.h>
|
#include <fsfw/ipc/MutexFactory.h>
|
||||||
|
|
||||||
#if defined(WIN32) || defined(UNIX)
|
#if defined PLATFORM_WIN || defined PLATFORM_UNIX
|
||||||
#include <fsfw/osal/host/Mutex.h>
|
#include "fsfw/osal/host/Mutex.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <future>
|
#include <future>
|
||||||
#endif
|
#endif
|
||||||
@ -20,7 +22,7 @@ void testmutex::testMutex() {
|
|||||||
// timed_mutex from the C++ library specifies undefined behaviour if
|
// timed_mutex from the C++ library specifies undefined behaviour if
|
||||||
// the timed mutex is locked twice from the same thread.
|
// the timed mutex is locked twice from the same thread.
|
||||||
// TODO: we should pass a define like FSFW_OSAL_HOST to the build.
|
// 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
|
// This calls the function from
|
||||||
// another thread and stores the returnvalue in a future.
|
// another thread and stores the returnvalue in a future.
|
||||||
auto future = std::async(&MutexIF::lockMutex, mutex, MutexIF::TimeoutType::WAITING, 1);
|
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.
|
// 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();
|
result = mutex->unlockMutex();
|
||||||
if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) {
|
if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) {
|
||||||
unitt::put_error(id);
|
unitt::put_error(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user