diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ab58fae6..c9feb0da7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,11 +153,7 @@ if(FSFW_BUILD_TESTS) "${MSG_PREFIX} Building the FSFW unittests in addition to the static library" ) # Check whether the user has already installed Catch2 first - # Suppress this check for rtems, because rtems is cross compiled - # on CI with preinstalled Catch which needs to be cross compiled - if(NOT FSFW_OSAL MATCHES "rtems") - find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION}) - endif() + find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} QUIET) # Not installed, so use FetchContent to download and provide Catch2 if(NOT Catch2_FOUND) message( @@ -221,11 +217,7 @@ message( ) # Check whether the user has already installed ETL first -# Suppress this check for rtems, because rtems is cross compiled -# on CI with preinstalled etl which is not found when cross compiling -if(NOT FSFW_OSAL MATCHES "rtems") find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET) -endif() # Not installed, so use FetchContent to download and provide etl if(NOT ${FSFW_ETL_LIB_NAME}_FOUND) message( diff --git a/src/fsfw/osal/rtems/BinarySemaphore.cpp b/src/fsfw/osal/rtems/BinarySemaphore.cpp index 3677dd22e..200c3095c 100644 --- a/src/fsfw/osal/rtems/BinarySemaphore.cpp +++ b/src/fsfw/osal/rtems/BinarySemaphore.cpp @@ -2,6 +2,8 @@ #include +//TODO + BinarySemaphore::BinarySemaphore() {} BinarySemaphore::~BinarySemaphore() {} diff --git a/src/fsfw/osal/rtems/SemaphoreFactory.cpp b/src/fsfw/osal/rtems/SemaphoreFactory.cpp index 35099ddce..8bc2a9117 100644 --- a/src/fsfw/osal/rtems/SemaphoreFactory.cpp +++ b/src/fsfw/osal/rtems/SemaphoreFactory.cpp @@ -18,7 +18,9 @@ SemaphoreFactory* SemaphoreFactory::instance() { } SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) { - return new BinarySemaphore(); + return nullptr; + //TODO + //return new BinarySemaphore(); } SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, uint8_t initCount, diff --git a/unittests/CatchRunner.cpp b/unittests/CatchRunner.cpp index 37767b5fe..a909bd9db 100644 --- a/unittests/CatchRunner.cpp +++ b/unittests/CatchRunner.cpp @@ -72,7 +72,7 @@ void exit_qemu_failing(int error) { ); } -#include "testcfg/rtems/rtemsConfig.h" +#include void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code){ if ( source == RTEMS_FATAL_SOURCE_EXIT ) { diff --git a/unittests/osal/CMakeLists.txt b/unittests/osal/CMakeLists.txt index 90eea2c7e..b021bacb6 100644 --- a/unittests/osal/CMakeLists.txt +++ b/unittests/osal/CMakeLists.txt @@ -1,2 +1,5 @@ -target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestSemaphore.cpp - TestClock.cpp) +target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestClock.cpp) + +if(FSFW_OSAL MATCHES "linux" OR FSFW_OSAL MATCHES "freertos") +target_sources(${FSFW_TEST_TGT} PRIVATE TestSemaphore.cpp) +endif() diff --git a/unittests/osal/TestSemaphore.cpp b/unittests/osal/TestSemaphore.cpp index 6bf63f6a8..ab47cdab4 100644 --- a/unittests/osal/TestSemaphore.cpp +++ b/unittests/osal/TestSemaphore.cpp @@ -4,8 +4,6 @@ #include -// binary semaphores currently only supported on linux -#if defined(FSFW_OSAL_LINUX) || defined(FSFW_OSAL_FREERTOS) TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") { // perform set-up here @@ -33,6 +31,4 @@ TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") { TEST_CASE("Counting Semaphore Test", "[CountingSemaph]") { SECTION("Simple Test") {} -} - -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/unittests/testcfg/rtems/cmake/Platform/a72_lp64_qemu.cmake b/unittests/testcfg/rtems/cmake/Platform/a72_lp64_qemu.cmake index 3d5b74959..04675df0d 100644 --- a/unittests/testcfg/rtems/cmake/Platform/a72_lp64_qemu.cmake +++ b/unittests/testcfg/rtems/cmake/Platform/a72_lp64_qemu.cmake @@ -1,3 +1,3 @@ -add_compile_options("-mcpu=cortex-a72" "-I/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib/include" "-I${CMAKE_SOURCE_DIR}/unittests/testcfg/rtems/include") +add_compile_options("-mcpu=cortex-a72" "-I/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib/include") add_link_options("-B/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib" "-qrtems") diff --git a/unittests/testcfg/rtems/cmake/aarch64-rtems6-toolchain.cmake b/unittests/testcfg/rtems/cmake/aarch64-rtems6-toolchain.cmake index 34f2a1409..00ad2b696 100644 --- a/unittests/testcfg/rtems/cmake/aarch64-rtems6-toolchain.cmake +++ b/unittests/testcfg/rtems/cmake/aarch64-rtems6-toolchain.cmake @@ -1,4 +1,4 @@ -# the name of the target operating system +## the name of the target operating system set(CMAKE_SYSTEM_NAME a72_lp64_qemu) set(CMAKE_SYSTEM_PROCESSOR a72) @@ -7,19 +7,30 @@ set(CMAKE_SYSTEM_PROCESSOR a72) set(CMAKE_C_COMPILER aarch64-rtems6-gcc) set(CMAKE_CXX_COMPILER aarch64-rtems6-g++) +# built in tests fail set(CMAKE_C_COMPILER_WORKS 1) set(CMAKE_CXX_COMPILER_WORKS 1) # adjust the default behavior of the FIND_XXX() commands: # search programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) # search headers and libraries in the target environment set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# ignore host installed libraries +# makes find_package() ignore the Config.cmake files +set(CMAKE_IGNORE_PATH /usr/local) + # supress errors add_compile_definitions("__STDC_VERSION__") +# make newlib behave like glib with an intercepted cmath +add_compile_options("-I${CMAKE_SOURCE_DIR}/unittests/testcfg/rtems/include") + +# we supply an a72_lp64_qemu.cmake there list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/unittests/testcfg/rtems/cmake") diff --git a/unittests/testcfg/rtems/rtemsConfig.h b/unittests/testcfg/rtems/include/rtemsConfig.h similarity index 100% rename from unittests/testcfg/rtems/rtemsConfig.h rename to unittests/testcfg/rtems/include/rtemsConfig.h