From 4d154b7cee4afead4e4212279c1c6df73aaf1390 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 9 Feb 2022 21:38:56 +0100 Subject: [PATCH] reworked cmake, unfortunately a big one due to interdependence - /mission is a library now, in preparation of unittests (which bring their own main) - eive-simple is now only available in bsp=arm/q7s (but is still not compiling) - watchdog and simple are their own executables, not configurations any more - moved some q7s specific code into /bsp-q7s to flatten if-hierarchy in main CMakeLists.txt - compiler and linker options are not globally applied to all targets - linux is the default fsfw osal now, as current code does not compile on hosted --- .gitignore | 3 + CMakeLists.txt | 212 ++++++++++----------- bsp_hosted/CMakeLists.txt | 2 +- bsp_hosted/boardconfig/CMakeLists.txt | 4 +- bsp_hosted/fsfwconfig/CMakeLists.txt | 8 +- bsp_q7s/CMakeLists.txt | 36 ++-- bsp_q7s/boardconfig/CMakeLists.txt | 9 +- bsp_q7s/boardconfig/q7sConfig.h.in | 2 - bsp_q7s/boardtest/CMakeLists.txt | 10 +- bsp_q7s/callbacks/CMakeLists.txt | 2 +- bsp_q7s/comIF/CMakeLists.txt | 2 +- bsp_q7s/core/CMakeLists.txt | 6 +- bsp_q7s/devices/CMakeLists.txt | 2 +- bsp_q7s/devices/startracker/CMakeLists.txt | 2 +- bsp_q7s/gpio/CMakeLists.txt | 2 +- bsp_q7s/memory/CMakeLists.txt | 2 +- bsp_q7s/simple/CMakeLists.txt | 2 +- bsp_q7s/simple/simple.cpp | 4 +- cmake/HardwareOsPostConfig.cmake | 16 +- cmake/PreProjectConfig.cmake | 2 + common/config/CMakeLists.txt | 4 +- linux/boardtest/CMakeLists.txt | 2 +- linux/csp/CMakeLists.txt | 2 +- linux/devices/CMakeLists.txt | 2 +- linux/fsfwconfig/CMakeLists.txt | 8 +- linux/obc/CMakeLists.txt | 2 +- linux/utility/CMakeLists.txt | 2 +- mission/CMakeLists.txt | 2 + mission/core/CMakeLists.txt | 2 +- mission/devices/CMakeLists.txt | 2 +- mission/memory/CMakeLists.txt | 2 +- mission/tmtc/CMakeLists.txt | 2 +- mission/utility/CMakeLists.txt | 2 +- test/testtasks/CMakeLists.txt | 4 +- watchdog/CMakeLists.txt | 2 +- watchdog/Watchdog.h | 3 +- 36 files changed, 200 insertions(+), 171 deletions(-) diff --git a/.gitignore b/.gitignore index c51106ea..2f7acd11 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ !misc/eclipse/**/.cproject !misc/eclipse/**/.project +#vscode +.vscode + # Python __pycache__ .idea diff --git a/CMakeLists.txt b/CMakeLists.txt index 17796924..a3dd1d7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,18 +13,13 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -if(TGT_BSP MATCHES "arm/q7s") - option(EIVE_BUILD_WATCHDOG "Compile the OBSW watchdog insted" OFF) - option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function") -endif() - option(EIVE_BUILD_UNITTESTS "Build Catch2 unittests" OFF) option(EIVE_ADD_ETL_LIB "Add ETL library" ON) option(EIVE_ADD_JSON_LIB "Add JSON library" ON) option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF) if(NOT FSFW_OSAL) - set(FSFW_OSAL host CACHE STRING "OS for the FSFW.") + set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.") endif() if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack") @@ -35,18 +30,8 @@ endif() include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake) pre_project_config() -if(EIVE_BUILD_WATCHDOG) - set(PROJECT_NAME_TO_SET eive-watchdog) -elseif(EIVE_BUILD_UNITTESTS) - set(PROJECT_NAME_TO_SET eive-unittest) -elseif(TGT_BSP MATCHES "arm/q7s") - set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME}) -else() - set(PROJECT_NAME_TO_SET eive-obsw) -endif() - # Project Name -project(${PROJECT_NAME_TO_SET} ASM C CXX) +project(eive-obsw ASM C CXX) ################################################################################ # Pre-Sources preparation @@ -57,8 +42,11 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) # Set names and variables -set(TARGET_NAME ${CMAKE_PROJECT_NAME}) +set(OBSW_NAME ${CMAKE_PROJECT_NAME}) +set(WATCHDOG_NAME eive-watchdog) +set(SIMPLE_OBSW_NAME eive-simple) set(LIB_FSFW_NAME fsfw) +set(LIB_EIVE_MISSION eive-mission) set(LIB_ETL_NAME etl) set(LIB_CSP_NAME libcsp) set(LIB_LWGPS_NAME lwgps) @@ -71,7 +59,6 @@ set(LIB_JSON_NAME nlohmann_json::nlohmann_json) # Set path names set(FSFW_PATH fsfw) -set(MISSION_PATH mission) set(TEST_PATH test/testtasks) set(UNITTEST_PATH unittest) set(LINUX_PATH linux) @@ -80,6 +67,7 @@ set(WATCHDOG_PATH watchdog) set(COMMON_CONFIG_PATH ${COMMON_PATH}/config) set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg) +set(LIB_EIVE_MISSION_PATH mission) set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp) set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl) set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2) @@ -140,18 +128,17 @@ if(EIVE_BUILD_UNITTESTS) endif() # Configuration files -if(NOT EIVE_BUILD_WATCHDOG) - configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) - configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) - configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) - if(TGT_BSP MATCHES "arm/q7s") - configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) - elseif(TGT_BSP MATCHES "arm/raspberrypi") - configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) - endif() +configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) +configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) +configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) +if(TGT_BSP MATCHES "arm/q7s") + configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) +elseif(TGT_BSP MATCHES "arm/raspberrypi") + configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) endif() + configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h) # Set common config path for FSFW @@ -164,8 +151,48 @@ set(FSFW_ADDITIONAL_INC_PATHS # Executable and Sources ################################################################################ +#global compiler options need to be set before adding executables +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options( + "-Wall" + "-Wextra" + "-Wimplicit-fallthrough=1" + "-Wno-unused-parameter" + "-Wno-psabi" + ) + message(STATUS "goes here") + # Remove unused sections. + add_compile_options( + "-ffunction-sections" + "-fdata-sections" + ) + + # Removed unused sections. + add_link_options( + "-Wl,--gc-sections" + ) + +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(COMPILER_FLAGS "/permissive-") +endif() + + +add_library(${LIB_EIVE_MISSION}) + + # Add executable -add_executable(${TARGET_NAME}) +add_executable(${OBSW_NAME}) + +#watchdog +add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL) +add_subdirectory(${WATCHDOG_PATH}) +target_link_libraries(${WATCHDOG_NAME} PUBLIC + ${LIB_CXX_FS} +) + +target_include_directories(${WATCHDOG_NAME} PUBLIC + ${CMAKE_BINARY_DIR} +) if(EIVE_ADD_ETL_LIB) add_subdirectory(${LIB_ETL_PATH}) @@ -175,75 +202,74 @@ if(EIVE_ADD_JSON_LIB) add_subdirectory(${LIB_JSON_PATH}) endif() -if(NOT EIVE_BUILD_WATCHDOG) - if(NOT EIVE_BUILD_UNITTESTS) - if(EIVE_ADD_LINUX_FILES) - add_subdirectory(${LIB_ARCSEC_PATH}) - add_subdirectory(${LINUX_PATH}) - endif() - add_subdirectory(${BSP_PATH}) - if(ADD_CSP_LIB) - add_subdirectory(${LIB_CSP_PATH}) - endif() + +if(NOT EIVE_BUILD_UNITTESTS) + if(EIVE_ADD_LINUX_FILES) + add_subdirectory(${LIB_ARCSEC_PATH}) + add_subdirectory(${LINUX_PATH}) + endif() + add_subdirectory(${BSP_PATH}) + if(ADD_CSP_LIB) + add_subdirectory(${LIB_CSP_PATH}) endif() - add_subdirectory(${COMMON_PATH}) endif() -if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG)) - add_subdirectory(${LIB_LWGPS_PATH}) - add_subdirectory(${FSFW_PATH}) - add_subdirectory(${MISSION_PATH}) - add_subdirectory(${TEST_PATH}) -endif() +add_subdirectory(${COMMON_PATH}) + + + +add_subdirectory(${LIB_LWGPS_PATH}) +add_subdirectory(${FSFW_PATH}) +add_subdirectory(${LIB_EIVE_MISSION_PATH}) +add_subdirectory(${TEST_PATH}) + if(EIVE_BUILD_UNITTESTS) # add_subdirectory(${LIB_CATCH2_PATH}) add_subdirectory(${UNITTEST_PATH}) endif() -if(EIVE_BUILD_WATCHDOG) - add_subdirectory(${WATCHDOG_PATH}) -endif() - ################################################################################ # Post-Sources preparation ################################################################################ -set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux) -if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG)) - # Add libraries for all sources. - target_link_libraries(${TARGET_NAME} PRIVATE - ${LIB_FSFW_NAME} - ${LIB_OS_NAME} - ${LIB_LWGPS_NAME} + +# Add libraries +target_link_libraries(${LIB_EIVE_MISSION} PUBLIC + ${LIB_FSFW_NAME} + ${LIB_LWGPS_NAME} + ${LIB_OS_NAME} +) + +target_link_libraries(${OBSW_NAME} PRIVATE + ${LIB_EIVE_MISSION} +) + +if(TGT_BSP MATCHES "arm/q7s") + target_link_libraries(${LIB_EIVE_MISSION} PUBLIC + ${LIB_ARCSEC} + ${LIB_GPS} ) - - if(TGT_BSP MATCHES "arm/q7s") - target_link_libraries(${TARGET_NAME} PRIVATE - ${LIB_ARCSEC} - ${LIB_GPS} - ) - endif() endif() -if(NOT EIVE_BUILD_WATCHDOG) - if(ADD_CSP_LIB) - target_link_libraries(${TARGET_NAME} PRIVATE - ${LIB_CSP_NAME} - ) - endif() + +if(ADD_CSP_LIB) + target_link_libraries(${OBSW_NAME} PRIVATE + ${LIB_CSP_NAME} + ) endif() + if(EIVE_ADD_ETL_LIB) - target_link_libraries(${TARGET_NAME} PRIVATE + target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_NAME} ) endif() if(EIVE_ADD_JSON_LIB) - target_link_libraries(${TARGET_NAME} PRIVATE + target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_JSON_NAME} ) endif() @@ -254,57 +280,29 @@ if(EIVE_BUILD_UNITTESTS) ) endif() -target_link_libraries(${TARGET_NAME} PRIVATE +target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS} ) # Add include paths for all sources. -target_include_directories(${TARGET_NAME} PRIVATE +target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} ${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH} -) +) if(TGT_BSP MATCHES "arm/q7s") - target_include_directories(${TARGET_NAME} PRIVATE + target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH} ) endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(WARNING_FLAGS - -Wall - -Wextra - -Wimplicit-fallthrough=1 - -Wno-unused-parameter - -Wno-psabi - ) - - # Remove unused sections. - target_compile_options(${TARGET_NAME} PRIVATE - "-ffunction-sections" - "-fdata-sections" - ) - - # Removed unused sections. - target_link_options(${TARGET_NAME} PRIVATE - "-Wl,--gc-sections" - ) - -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(COMPILER_FLAGS "/permissive-") -endif() - if(CMAKE_VERBOSE) message(STATUS "Warning flags: ${WARNING_FLAGS}") endif() - -# Compile options for all sources. -target_compile_options(${TARGET_NAME} PRIVATE - ${WARNING_FLAGS} -) + if(${CMAKE_CROSSCOMPILING}) include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake) @@ -336,9 +334,9 @@ string(CONCAT POST_BUILD_COMMENT ) add_custom_command( - TARGET ${TARGET_NAME} + TARGET ${OBSW_NAME} POST_BUILD - COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} + COMMAND ${CMAKE_SIZE} ${OBSW_NAME}${FILE_SUFFIX} COMMENT ${POST_BUILD_COMMENT} ) diff --git a/bsp_hosted/CMakeLists.txt b/bsp_hosted/CMakeLists.txt index b8a09a88..7787cf7e 100644 --- a/bsp_hosted/CMakeLists.txt +++ b/bsp_hosted/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp diff --git a/bsp_hosted/boardconfig/CMakeLists.txt b/bsp_hosted/boardconfig/CMakeLists.txt index c32b326d..81c8c93d 100644 --- a/bsp_hosted/boardconfig/CMakeLists.txt +++ b/bsp_hosted/boardconfig/CMakeLists.txt @@ -1,8 +1,8 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE print.c ) -target_include_directories(${TARGET_NAME} PUBLIC +target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/bsp_hosted/fsfwconfig/CMakeLists.txt b/bsp_hosted/fsfwconfig/CMakeLists.txt index fc961da8..04a8907e 100644 --- a/bsp_hosted/fsfwconfig/CMakeLists.txt +++ b/bsp_hosted/fsfwconfig/CMakeLists.txt @@ -1,21 +1,21 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE ipc/MissionMessageTypes.cpp ) -target_include_directories(${TARGET_NAME} PUBLIC +target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) # If a special translation file for object IDs exists, compile it. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") - target_sources(${TARGET_NAME} PRIVATE + target_sources(${OBSW_NAME} PRIVATE objects/translateObjects.cpp ) endif() # If a special translation file for events exists, compile it. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") - target_sources(${TARGET_NAME} PRIVATE + target_sources(${OBSW_NAME} PRIVATE events/translateEvents.cpp ) endif() diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index b2c24d5f..c4f85bd2 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -1,17 +1,29 @@ -target_sources(${TARGET_NAME} PUBLIC +#simple mode +add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL) +target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") +target_sources(${SIMPLE_OBSW_NAME} PUBLIC + main.cpp +) +#I think this is unintentional? (produces linker errors for stuff in /linux) +target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC + ${LIB_FSFW_NAME} +) +target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") +add_subdirectory(simple) + + +target_sources(${OBSW_NAME} PUBLIC main.cpp ) add_subdirectory(boardtest) -if(Q7S_SIMPLE_MODE) - add_subdirectory(simple) -else() - add_subdirectory(boardconfig) - add_subdirectory(comIF) - add_subdirectory(gpio) - add_subdirectory(core) - add_subdirectory(memory) - add_subdirectory(callbacks) - add_subdirectory(devices) -endif() + +add_subdirectory(boardconfig) +add_subdirectory(comIF) +add_subdirectory(gpio) +add_subdirectory(core) +add_subdirectory(memory) +add_subdirectory(callbacks) +add_subdirectory(devices) + diff --git a/bsp_q7s/boardconfig/CMakeLists.txt b/bsp_q7s/boardconfig/CMakeLists.txt index 67fbaf88..feefbe5a 100644 --- a/bsp_q7s/boardconfig/CMakeLists.txt +++ b/bsp_q7s/boardconfig/CMakeLists.txt @@ -1,7 +1,12 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE print.c ) -target_include_directories(${TARGET_NAME} PUBLIC +target_sources(${SIMPLE_OBSW_NAME} PRIVATE + print.c +) + + +target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 43283ea1..33649000 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -3,8 +3,6 @@ #include -#cmakedefine01 Q7S_SIMPLE_MODE - /*******************************************************************/ /** All of the following flags should be enabled for mission code */ /*******************************************************************/ diff --git a/bsp_q7s/boardtest/CMakeLists.txt b/bsp_q7s/boardtest/CMakeLists.txt index 1cda38ca..29c9f1e1 100644 --- a/bsp_q7s/boardtest/CMakeLists.txt +++ b/bsp_q7s/boardtest/CMakeLists.txt @@ -1,8 +1,10 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE FileSystemTest.cpp Q7STestTask.cpp ) - - - +if(EIVE_BUILD_Q7S_SIMPLE_MODE) + target_sources(${SIMPLE_OBSW_NAME} PRIVATE + FileSystemTest.cpp + ) +endif() \ No newline at end of file diff --git a/bsp_q7s/callbacks/CMakeLists.txt b/bsp_q7s/callbacks/CMakeLists.txt index a85bf6fb..30268007 100644 --- a/bsp_q7s/callbacks/CMakeLists.txt +++ b/bsp_q7s/callbacks/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE rwSpiCallback.cpp gnssCallback.cpp pcduSwitchCb.cpp diff --git a/bsp_q7s/comIF/CMakeLists.txt b/bsp_q7s/comIF/CMakeLists.txt index 0599b73f..fe4910f2 100644 --- a/bsp_q7s/comIF/CMakeLists.txt +++ b/bsp_q7s/comIF/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE ) diff --git a/bsp_q7s/core/CMakeLists.txt b/bsp_q7s/core/CMakeLists.txt index fc397f2f..8731b7a3 100644 --- a/bsp_q7s/core/CMakeLists.txt +++ b/bsp_q7s/core/CMakeLists.txt @@ -1,6 +1,10 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE CoreController.cpp obsw.cpp InitMission.cpp ObjectFactory.cpp ) + +target_sources(${SIMPLE_OBSW_NAME} PRIVATE + InitMission.cpp +) diff --git a/bsp_q7s/devices/CMakeLists.txt b/bsp_q7s/devices/CMakeLists.txt index 70705e83..eed234f5 100644 --- a/bsp_q7s/devices/CMakeLists.txt +++ b/bsp_q7s/devices/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE PlocSupervisorHandler.cpp PlocUpdater.cpp PlocMemoryDumper.cpp diff --git a/bsp_q7s/devices/startracker/CMakeLists.txt b/bsp_q7s/devices/startracker/CMakeLists.txt index 28704219..be2bf861 100644 --- a/bsp_q7s/devices/startracker/CMakeLists.txt +++ b/bsp_q7s/devices/startracker/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE StarTrackerHandler.cpp StarTrackerJsonCommands.cpp ArcsecDatalinkLayer.cpp diff --git a/bsp_q7s/gpio/CMakeLists.txt b/bsp_q7s/gpio/CMakeLists.txt index dd657546..89bb24bb 100644 --- a/bsp_q7s/gpio/CMakeLists.txt +++ b/bsp_q7s/gpio/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE gpioCallbacks.cpp ) diff --git a/bsp_q7s/memory/CMakeLists.txt b/bsp_q7s/memory/CMakeLists.txt index 6c7d0a94..0658242a 100644 --- a/bsp_q7s/memory/CMakeLists.txt +++ b/bsp_q7s/memory/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE FileSystemHandler.cpp SdCardManager.cpp scratchApi.cpp diff --git a/bsp_q7s/simple/CMakeLists.txt b/bsp_q7s/simple/CMakeLists.txt index 399a1dd3..77cbd076 100644 --- a/bsp_q7s/simple/CMakeLists.txt +++ b/bsp_q7s/simple/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${SIMPLE_OBSW_NAME} PRIVATE simple.cpp ) diff --git a/bsp_q7s/simple/simple.cpp b/bsp_q7s/simple/simple.cpp index b300e456..a86fd459 100644 --- a/bsp_q7s/simple/simple.cpp +++ b/bsp_q7s/simple/simple.cpp @@ -1,5 +1,7 @@ #include "simple.h" +#include "iostream" + #include "q7sConfig.h" #if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1 @@ -7,7 +9,7 @@ #endif int simple::simple() { - cout << "-- Q7S Simple Application --" << endl; + std::cout << "-- Q7S Simple Application --" << std::endl; #if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1 { FileSystemTest fileSystemTest; } #endif diff --git a/cmake/HardwareOsPostConfig.cmake b/cmake/HardwareOsPostConfig.cmake index 2492b9bb..3000366b 100644 --- a/cmake/HardwareOsPostConfig.cmake +++ b/cmake/HardwareOsPostConfig.cmake @@ -3,7 +3,7 @@ function(post_source_hw_os_config) if(LINK_LWIP) message(STATUS "Linking against ${LIB_LWIP_NAME} lwIP library") if(LIB_LWIP_NAME) - target_link_libraries(${TARGET_NAME} PUBLIC + target_link_libraries(${OBSW_NAME} PUBLIC ${LIB_LWIP_NAME} ) else() @@ -12,7 +12,7 @@ if(LINK_LWIP) endif() if(LINKER_SCRIPT) - target_link_options(${TARGET_NAME} PRIVATE + add_link_options( -T${LINKER_SCRIPT} ) endif() @@ -35,20 +35,20 @@ if(CMAKE_VERBOSE) endif() # Generator expression. Can be used to set different C, CXX and ASM flags. -target_compile_options(${TARGET_NAME} PRIVATE +add_compile_options( $<$:${C_DEFS} ${C_FLAGS}> $<$:${CXX_DEFS} ${CXX_FLAGS}> $<$:${ASM_FLAGS}> ) -set(STRIPPED_TARGET_NAME ${TARGET_NAME}-stripped) +set(STRIPPED_OBSW_NAME ${OBSW_NAME}-stripped) add_custom_command( - TARGET ${TARGET_NAME} + TARGET ${OBSW_NAME} POST_BUILD - COMMAND ${CMAKE_STRIP} --strip-all ${TARGET_NAME} -o ${STRIPPED_TARGET_NAME} - BYPRODUCTS ${STRIPPED_TARGET_NAME} - COMMENT "Generating stripped executable ${STRIPPED_TARGET_NAME}.." + COMMAND ${CMAKE_STRIP} --strip-all ${OBSW_NAME} -o ${STRIPPED_OBSW_NAME} + BYPRODUCTS ${STRIPPED_OBSW_NAME} + COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.." ) endfunction() \ No newline at end of file diff --git a/cmake/PreProjectConfig.cmake b/cmake/PreProjectConfig.cmake index 9f1790bb..fa64c7d8 100644 --- a/cmake/PreProjectConfig.cmake +++ b/cmake/PreProjectConfig.cmake @@ -9,6 +9,7 @@ if(DEFINED TGT_BSP) endif() endif() + # Disable compiler checks for cross-compiling. if(FSFW_OSAL MATCHES linux AND TGT_BSP) if(TGT_BSP MATCHES "arm/q7s") @@ -16,6 +17,7 @@ if(FSFW_OSAL MATCHES linux AND TGT_BSP) "${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake" PARENT_SCOPE ) + elseif(TGT_BSP MATCHES "arm/raspberrypi") if(NOT DEFINED ENV{LINUX_ROOTFS}) if(NOT DEFINED LINUX_ROOTFS) diff --git a/common/config/CMakeLists.txt b/common/config/CMakeLists.txt index 5c4b4942..00848561 100644 --- a/common/config/CMakeLists.txt +++ b/common/config/CMakeLists.txt @@ -1,7 +1,7 @@ -target_include_directories(${TARGET_NAME} PRIVATE +target_include_directories(${OBSW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE commonConfig.cpp ) \ No newline at end of file diff --git a/linux/boardtest/CMakeLists.txt b/linux/boardtest/CMakeLists.txt index 0fa4e322..1fa4b290 100644 --- a/linux/boardtest/CMakeLists.txt +++ b/linux/boardtest/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE LibgpiodTest.cpp I2cTestClass.cpp SpiTestClass.cpp diff --git a/linux/csp/CMakeLists.txt b/linux/csp/CMakeLists.txt index b5b2768e..f1ebb028 100644 --- a/linux/csp/CMakeLists.txt +++ b/linux/csp/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp ) diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index b02c8e57..8d3272a1 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE SolarArrayDeploymentHandler.cpp SusHandler.cpp ) diff --git a/linux/fsfwconfig/CMakeLists.txt b/linux/fsfwconfig/CMakeLists.txt index 277b89db..ea8375fa 100644 --- a/linux/fsfwconfig/CMakeLists.txt +++ b/linux/fsfwconfig/CMakeLists.txt @@ -1,22 +1,22 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${OBSW_NAME} PRIVATE ipc/MissionMessageTypes.cpp pollingsequence/pollingSequenceFactory.cpp ) -target_include_directories(${TARGET_NAME} PUBLIC +target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) # If a special translation file for object IDs exists, compile it. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") - target_sources(${TARGET_NAME} PRIVATE + target_sources(${OBSW_NAME} PRIVATE objects/translateObjects.cpp ) endif() # If a special translation file for events exists, compile it. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") - target_sources(${TARGET_NAME} PRIVATE + target_sources(${OBSW_NAME} PRIVATE events/translateEvents.cpp ) endif() diff --git a/linux/obc/CMakeLists.txt b/linux/obc/CMakeLists.txt index d59a1a5f..e295603e 100644 --- a/linux/obc/CMakeLists.txt +++ b/linux/obc/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${OBSW_NAME} PUBLIC PapbVcInterface.cpp Ptme.cpp PdecHandler.cpp diff --git a/linux/utility/CMakeLists.txt b/linux/utility/CMakeLists.txt index a3387531..56937cea 100644 --- a/linux/utility/CMakeLists.txt +++ b/linux/utility/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${OBSW_NAME} PUBLIC utility.cpp ) diff --git a/mission/CMakeLists.txt b/mission/CMakeLists.txt index 876201a8..b0fc4d00 100644 --- a/mission/CMakeLists.txt +++ b/mission/CMakeLists.txt @@ -3,3 +3,5 @@ add_subdirectory(devices) add_subdirectory(utility) add_subdirectory(memory) add_subdirectory(tmtc) + + diff --git a/mission/core/CMakeLists.txt b/mission/core/CMakeLists.txt index 5d088e48..1fdc146e 100644 --- a/mission/core/CMakeLists.txt +++ b/mission/core/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_EIVE_MISSION} PRIVATE GenericFactory.cpp ) diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 9491a3aa..111d2188 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_EIVE_MISSION} PRIVATE GPSHyperionLinuxController.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp diff --git a/mission/memory/CMakeLists.txt b/mission/memory/CMakeLists.txt index ccaef754..cd0938f2 100644 --- a/mission/memory/CMakeLists.txt +++ b/mission/memory/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_EIVE_MISSION} PRIVATE NVMParameterBase.cpp ) diff --git a/mission/tmtc/CMakeLists.txt b/mission/tmtc/CMakeLists.txt index 7da87b6c..1d3baae7 100644 --- a/mission/tmtc/CMakeLists.txt +++ b/mission/tmtc/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_EIVE_MISSION} PRIVATE CCSDSHandler.cpp VirtualChannel.cpp ) diff --git a/mission/utility/CMakeLists.txt b/mission/utility/CMakeLists.txt index 50532596..a6d4e57d 100644 --- a/mission/utility/CMakeLists.txt +++ b/mission/utility/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_EIVE_MISSION} PRIVATE TmFunnel.cpp Timestamp.cpp ) diff --git a/test/testtasks/CMakeLists.txt b/test/testtasks/CMakeLists.txt index 8d8a17c1..628e3c52 100644 --- a/test/testtasks/CMakeLists.txt +++ b/test/testtasks/CMakeLists.txt @@ -1,7 +1,7 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${OBSW_NAME} PUBLIC TestTask.cpp ) -target_include_directories(${TARGET_NAME} PUBLIC +target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) \ No newline at end of file diff --git a/watchdog/CMakeLists.txt b/watchdog/CMakeLists.txt index 0179053c..a01bf853 100644 --- a/watchdog/CMakeLists.txt +++ b/watchdog/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${WATCHDOG_NAME} PRIVATE main.cpp Watchdog.cpp ) diff --git a/watchdog/Watchdog.h b/watchdog/Watchdog.h index fb7ac65b..5745c033 100644 --- a/watchdog/Watchdog.h +++ b/watchdog/Watchdog.h @@ -2,7 +2,8 @@ #define WATCHDOG_WATCHDOG_H_ #include - +#include +#include class WatchdogTask { public: