From 52a2973291a02939526eed7eb94073d1cf0aff78 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 27 Dec 2020 16:29:49 +0100 Subject: [PATCH 01/23] updated config --- fsfwconfig/FSFWConfig.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fsfwconfig/FSFWConfig.h b/fsfwconfig/FSFWConfig.h index fe97ee6e..5df83705 100644 --- a/fsfwconfig/FSFWConfig.h +++ b/fsfwconfig/FSFWConfig.h @@ -1,7 +1,6 @@ #ifndef FSFWCONFIG_FSFWCONFIG_H_ #define FSFWCONFIG_FSFWCONFIG_H_ -#include #include //! Used to determine whether C++ ostreams are used -- 2.43.0 From c1e96049777ad3fa4dd75d5d16a7ce833bef5ea1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 01:09:59 +0100 Subject: [PATCH 02/23] added cmake support --- .gitignore | 11 +- CMakeLists.txt | 153 ++++++++++++++++++ bsp_hosted/CMakeLists.txt | 10 ++ bsp_hosted/boardconfig/CMakeLists.txt | 10 ++ bsp_hosted/comIF/CMakeLists.txt | 8 + bsp_hosted/fsfwconfig/CMakeLists.txt | 10 ++ bsp_hosted/fsfwconfig/FSFWConfig.h | 12 +- bsp_hosted/fsfwconfig/OBSWConfig.h | 18 ++- .../fsfwconfig/ipc/MissionMessageTypes.h | 2 +- .../fsfwconfig/objects/systemObjectList.h | 1 - bsp_linux/CMakeLists.txt | 10 ++ bsp_linux/boardconfig/CMakeLists.txt | 6 + buildsystem/cmake/BuildType.cmake | 45 ++++++ buildsystem/cmake/HardwareOsPostConfig.cmake | 62 +++++++ buildsystem/cmake/HardwareOsPreConfig.cmake | 68 ++++++++ buildsystem/cmake/PreProjectConfig.cmake | 58 +++++++ buildsystem/cmake/RPiCrossCompileConfig.cmake | 146 +++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 + buildsystem/cmake/scripts/.idea/misc.xml | 4 + buildsystem/cmake/scripts/.idea/modules.xml | 8 + buildsystem/cmake/scripts/.idea/scripts.iml | 8 + buildsystem/cmake/scripts/.idea/vcs.xml | 6 + buildsystem/cmake/scripts/.idea/workspace.xml | 89 ++++++++++ .../scripts/Host/create_cmake_debug_cfg.sh | 26 +++ .../scripts/Host/create_cmake_release_cfg.sh | 26 +++ .../Host/create_cmake_relwithdeb_cfg.sh | 26 +++ .../scripts/Host/create_cmake_size_cfg.sh | 26 +++ .../scripts/Linux/create_cmake_debug_cfg.sh | 20 +++ .../scripts/Linux/create_cmake_release_cfg.sh | 20 +++ .../Linux/create_cmake_relwithdeb_cfg.sh | 20 +++ .../scripts/Linux/create_cmake_size_cfg.sh | 20 +++ .../scripts/RPi/create_cmake_debug_cfg.sh | 27 ++++ .../scripts/RPi/create_cmake_release_cfg.sh | 27 ++++ .../RPi/create_cmake_relwithdeb_cfg.sh | 27 ++++ .../scripts/RPi/create_cmake_size_cfg.sh | 27 ++++ .../cmake/scripts/RPi/rpi_path_helper.sh | 24 +++ .../cmake/scripts/RPi/rpi_path_helper_win.sh | 22 +++ .../cmake/scripts/cmake_build_config.py | 115 +++++++++++++ fsfw | 2 +- fsfwconfig/OBSWConfig.h | 20 ++- mission/CMakeLists.txt | 3 + mission/core/CMakeLists.txt | 5 + mission/devices/CMakeLists.txt | 8 + .../MGMHandlerRM3100Definitions.h | 6 +- mission/utility/CMakeLists.txt | 5 + tmtc | 2 +- 46 files changed, 1235 insertions(+), 20 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 bsp_hosted/CMakeLists.txt create mode 100644 bsp_hosted/boardconfig/CMakeLists.txt create mode 100644 bsp_hosted/comIF/CMakeLists.txt create mode 100644 bsp_hosted/fsfwconfig/CMakeLists.txt create mode 100644 bsp_linux/CMakeLists.txt create mode 100644 bsp_linux/boardconfig/CMakeLists.txt create mode 100644 buildsystem/cmake/BuildType.cmake create mode 100644 buildsystem/cmake/HardwareOsPostConfig.cmake create mode 100644 buildsystem/cmake/HardwareOsPreConfig.cmake create mode 100644 buildsystem/cmake/PreProjectConfig.cmake create mode 100644 buildsystem/cmake/RPiCrossCompileConfig.cmake create mode 100644 buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 buildsystem/cmake/scripts/.idea/misc.xml create mode 100644 buildsystem/cmake/scripts/.idea/modules.xml create mode 100644 buildsystem/cmake/scripts/.idea/scripts.iml create mode 100644 buildsystem/cmake/scripts/.idea/vcs.xml create mode 100644 buildsystem/cmake/scripts/.idea/workspace.xml create mode 100644 buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh create mode 100644 buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh create mode 100644 buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh create mode 100644 buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh create mode 100644 buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh create mode 100644 buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh create mode 100644 buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh create mode 100644 buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh create mode 100644 buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh create mode 100644 buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh create mode 100644 buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh create mode 100644 buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh create mode 100644 buildsystem/cmake/scripts/RPi/rpi_path_helper.sh create mode 100644 buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh create mode 100644 buildsystem/cmake/scripts/cmake_build_config.py create mode 100644 mission/CMakeLists.txt create mode 100644 mission/core/CMakeLists.txt create mode 100644 mission/devices/CMakeLists.txt create mode 100644 mission/utility/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 0d0e490d..ff23c0fd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,15 @@ _obj _bin _dep +Debug +Debug* +Release +Release* +MinSizeRel +MinSizeRel* +RelWithDebInfo +RelWithDebInfo* + .settings .metadata .project @@ -9,4 +18,4 @@ _dep __pycache__ !misc/eclipse/**/.cproject -!misc/eclipse/**/.project \ No newline at end of file +!misc/eclipse/**/.project diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..98f2b5e8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,153 @@ +################################################################################ +# CMake support for the EIVE OBSW +# +# Developed in an effort to replace Make with a modern build system. +# +# Author: R. Mueller +################################################################################ + +################################################################################ +# Pre-Project preparation +################################################################################ +cmake_minimum_required(VERSION 3.13) + +# set(CMAKE_VERBOSE TRUE) + +set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildsystem/cmake") + +if(NOT OS_FSFW) + set(OS_FSFW host CACHE STRING "OS for the FSFW.") +endif() + +# Perform steps like loading toolchain files where applicable. +include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake) +pre_project_config() + +# Project Name +project(fsfw_example ASM C CXX) + +################################################################################ +# Pre-Sources preparation +################################################################################ + +# Specify the C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +# Set names and variables +set(TARGET_NAME ${CMAKE_PROJECT_NAME}) +set(LIB_FSFW_NAME fsfw) + +# Set path names +set(FSFW_PATH fsfw) +set(MISSION_PATH mission) + +# Analyse different OS and architecture/target options, determine BSP_PATH, +# display information about compiler etc. +include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) +pre_source_hw_os_config() + +set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") + +################################################################################ +# Executable and Sources +################################################################################ + +# Add executable +add_executable(${TARGET_NAME}) + +# Add subdirectories +if(LIB_OS_NAME) + add_subdirectory(${LIB_OS_NAME}) +endif() +add_subdirectory(${BSP_PATH}) +add_subdirectory(${FSFW_PATH}) +add_subdirectory(${MISSION_PATH}) + +################################################################################ +# Post-Sources preparation +################################################################################ + +# Add libraries for all sources. +target_link_libraries(${TARGET_NAME} PRIVATE + ${LIB_FSFW_NAME} + ${LIB_OS_NAME} +) + +# Add include paths for all sources. +target_include_directories(${TARGET_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${FSFW_CONFIG_PATH} +) + + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(WARNING_FLAGS + -Wall + -Wextra + -Wshadow=local + -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) + post_source_hw_os_config() +endif() + +if(NOT CMAKE_SIZE) + set(CMAKE_SIZE size) + if(WIN32) + set(FILE_SUFFIX ".exe") + endif() +endif() + +if(TGT_BSP) + set(TARGET_STRING "Target BSP: ${TGT_BSP}") +else() + set(TARGET_STRING "Target BSP: Hosted") +endif() + +add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND echo "Build directory: ${CMAKE_BINARY_DIR}" + COMMAND echo "Target OSAL: ${OS_FSFW}" + COMMAND echo "Target Build Type: ${CMAKE_BUILD_TYPE}" + COMMAND echo "${TARGET_STRING}" + COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} +) + +include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) +set_build_type() + + + + + diff --git a/bsp_hosted/CMakeLists.txt b/bsp_hosted/CMakeLists.txt new file mode 100644 index 00000000..7171d9d7 --- /dev/null +++ b/bsp_hosted/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${TARGET_NAME} PUBLIC + InitMission.cpp + main.cpp + ObjectFactory.cpp +) + +add_subdirectory(fsfwconfig) +add_subdirectory(boardconfig) + + diff --git a/bsp_hosted/boardconfig/CMakeLists.txt b/bsp_hosted/boardconfig/CMakeLists.txt new file mode 100644 index 00000000..c32b326d --- /dev/null +++ b/bsp_hosted/boardconfig/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${TARGET_NAME} PRIVATE + print.c +) + +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + + + diff --git a/bsp_hosted/comIF/CMakeLists.txt b/bsp_hosted/comIF/CMakeLists.txt new file mode 100644 index 00000000..eb416f75 --- /dev/null +++ b/bsp_hosted/comIF/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + ArduinoComIF.cpp + ArduinoCookie.cpp +) + + + + diff --git a/bsp_hosted/fsfwconfig/CMakeLists.txt b/bsp_hosted/fsfwconfig/CMakeLists.txt new file mode 100644 index 00000000..a906098f --- /dev/null +++ b/bsp_hosted/fsfwconfig/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${TARGET_NAME} PRIVATE + ipc/MissionMessageTypes.cpp +) + +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + + + diff --git a/bsp_hosted/fsfwconfig/FSFWConfig.h b/bsp_hosted/fsfwconfig/FSFWConfig.h index 8c6c754a..66fd276e 100644 --- a/bsp_hosted/fsfwconfig/FSFWConfig.h +++ b/bsp_hosted/fsfwconfig/FSFWConfig.h @@ -15,12 +15,6 @@ //! Can be used to enable debugging printouts for developing the FSFW #define FSFW_DEBUGGING 0 -//! Defines the FIFO depth of each commanding service base which -//! also determines how many commands a CSB service can handle in one cycle -//! simulataneously. This will increase the required RAM for -//! each CSB service ! -#define FSFW_CSB_FIFO_DEPTH 6 - //! If FSFW_OBJ_EVENT_TRANSLATION is set to one, //! additional output which requires the translation files translateObjects //! and translateEvents (and their compiled source files) @@ -49,6 +43,12 @@ static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8; static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; + +//! Defines the FIFO depth of each commanding service base which +//! also determines how many commands a CSB service can handle in one cycle +//! simulataneously. This will increase the required RAM for +//! each CSB service ! +static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; } #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/bsp_hosted/fsfwconfig/OBSWConfig.h b/bsp_hosted/fsfwconfig/OBSWConfig.h index f9e76160..fa3769b1 100644 --- a/bsp_hosted/fsfwconfig/OBSWConfig.h +++ b/bsp_hosted/fsfwconfig/OBSWConfig.h @@ -6,13 +6,25 @@ #ifndef CONFIG_OBSWCONFIG_H_ #define CONFIG_OBSWCONFIG_H_ -#include "returnvalues/classIds.h" -#include "events/subsystemIdRanges.h" - #define OBSW_ADD_TEST_CODE 0 // These defines should be disabled for mission code but are useful for // debugging. #define OBSW_ENHANCED_PRINTOUT 1 +#ifdef __cplusplus + +#include "objects/systemObjectList.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + +namespace config { +#endif + +/* Add mission configuration flags here */ + +#ifdef __cplusplus +} +#endif + #endif /* CONFIG_OBSWCONFIG_H_ */ diff --git a/bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h b/bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h index 832d8e58..7e3c448f 100644 --- a/bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h +++ b/bsp_hosted/fsfwconfig/ipc/MissionMessageTypes.h @@ -11,7 +11,7 @@ class CommandMessage; * * @param message Generic Command Message */ -namespace messagetypes{ +namespace messagetypes { enum MESSAGE_TYPE { MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT, }; diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index 3b5717fb..05ed2c52 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -19,7 +19,6 @@ namespace objects { PUS_SERVICE_23 = 0x51002300, PUS_SERVICE_201 = 0x51020100, - TIME_STAMPER = 0x52000001, TM_FUNNEL = 0x52000002, /* Test Task */ diff --git a/bsp_linux/CMakeLists.txt b/bsp_linux/CMakeLists.txt new file mode 100644 index 00000000..8df43ca7 --- /dev/null +++ b/bsp_linux/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${TARGET_NAME} PUBLIC + InitMission.cpp + main.cpp + ObjectFactory.cpp +) + +add_subdirectory(boardconfig) + + + diff --git a/bsp_linux/boardconfig/CMakeLists.txt b/bsp_linux/boardconfig/CMakeLists.txt new file mode 100644 index 00000000..2a1cb58a --- /dev/null +++ b/bsp_linux/boardconfig/CMakeLists.txt @@ -0,0 +1,6 @@ +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + + + diff --git a/buildsystem/cmake/BuildType.cmake b/buildsystem/cmake/BuildType.cmake new file mode 100644 index 00000000..e078e5c7 --- /dev/null +++ b/buildsystem/cmake/BuildType.cmake @@ -0,0 +1,45 @@ +function(set_build_type) + +message(STATUS "Used build generator: ${CMAKE_GENERATOR}") + +# Set a default build type if none was specified +set(DEFAULT_BUILD_TYPE "RelWithDebInfo") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(DEFAULT_BUILD_TYPE "Debug") +endif() + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS + "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified." + ) + set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE + STRING "Choose the type of build." FORCE + ) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo" + ) +endif() + +if(${CMAKE_BUILD_TYPE} MATCHES "Debug") + message(STATUS + "Building Debug application with flags: ${CMAKE_C_FLAGS_DEBUG}" + ) +elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo") + message(STATUS + "Building Release (Debug) application with " + "flags: ${CMAKE_C_FLAGS_RELWITHDEBINFO}" + ) +elseif(${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel") + message(STATUS + "Building Release (Size) application with " + "flags: ${CMAKE_C_FLAGS_MINSIZEREL}" + ) +else() + message(STATUS + "Building Release (Speed) application with " + "flags: ${CMAKE_C_FLAGS_RELEASE}" + ) +endif() + +endfunction() diff --git a/buildsystem/cmake/HardwareOsPostConfig.cmake b/buildsystem/cmake/HardwareOsPostConfig.cmake new file mode 100644 index 00000000..c3dc3f93 --- /dev/null +++ b/buildsystem/cmake/HardwareOsPostConfig.cmake @@ -0,0 +1,62 @@ +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 + ${LIB_LWIP_NAME} + ) + else() + message(WARNING "lwIP library name not set!") + endif() +endif() + +if(LINK_HAL) + message(STATUS "Linking against ${LIB_HAL_NAME} HAL library") + if(LIB_HAL_NAME) + target_link_libraries(${TARGET_NAME} PUBLIC + ${LIB_HAL_NAME} + ) + else() + message(WARNING "HAL library name not set!") + endif() +endif() + +if(LINKER_SCRIPT) + target_link_options(${TARGET_NAME} PRIVATE + -T${LINKER_SCRIPT} + ) +endif() + +set(C_FLAGS "" CACHE INTERNAL "C flags") + +set(C_DEFS "" + CACHE INTERNAL + "C Defines" +) + +set(CXX_FLAGS ${C_FLAGS}) +set(CXX_DEFS ${C_DEFS}) + +if(CMAKE_VERBOSE) + message(STATUS "C Flags: ${C_FLAGS}") + message(STATUS "CXX Flags: ${CXX_FLAGS}") + message(STATUS "C Defs: ${C_DEFS}") + message(STATUS "CXX Defs: ${CXX_DEFS}") +endif() + +# Generator expression. Can be used to set different C, CXX and ASM flags. +target_compile_options(${TARGET_NAME} PRIVATE + $<$:${C_DEFS} ${C_FLAGS}> + $<$:${CXX_DEFS} ${CXX_FLAGS}> + $<$:${ASM_FLAGS}> +) + +add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND echo Generating binary file ${CMAKE_PROJECT_NAME}.bin.. + COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET_NAME} ${TARGET_NAME}.bin +) + +endfunction() \ No newline at end of file diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/buildsystem/cmake/HardwareOsPreConfig.cmake new file mode 100644 index 00000000..c2524bd7 --- /dev/null +++ b/buildsystem/cmake/HardwareOsPreConfig.cmake @@ -0,0 +1,68 @@ +function(pre_source_hw_os_config) + +# FreeRTOS +if(${OS_FSFW} MATCHES freertos) + message(FATAL_ERROR "No FreeRTOS support implemented yet.") +# RTEMS +elseif(${OS_FSFW} STREQUAL rtems) + add_definitions(-DRTEMS) + message(FATAL_ERROR "No RTEMS support implemented yet.") +elseif(${OS_FSFW} STREQUAL linux) + add_definitions(-DUNIX -DLINUX) + find_package(Threads REQUIRED) + set(BSP_PATH "bsp_linux") +# Hosted +else() + set(BSP_PATH "bsp_hosted") + if(WIN32) + add_definitions(-DWIN32) + elseif(UNIX) + find_package(Threads REQUIRED) + add_definitions(-DUNIX -DLINUX) + endif() +endif() + +# Cross-compile information +if(CMAKE_CROSSCOMPILING) + # set(CMAKE_VERBOSE TRUE) + + message(STATUS "Cross-compiling for ${TGT_BSP} target") + message(STATUS "Cross-compile gcc: ${CMAKE_C_COMPILER}") + message(STATUS "Cross-compile g++: ${CMAKE_CXX_COMPILER}") + + if(CMAKE_VERBOSE) + message(STATUS "Cross-compile linker: ${CMAKE_LINKER}") + message(STATUS "Cross-compile size utility: ${CMAKE_SIZE}") + message(STATUS "Cross-compile objcopy utility: ${CMAKE_OBJCOPY}") + message(STATUS "Cross-compile ranlib utility: ${CMAKE_RANLIB}") + message(STATUS "Cross-compile ar utility: ${CMAKE_AR}") + message(STATUS "Cross-compile nm utility: ${CMAKE_NM}") + message(STATUS "Cross-compile strip utility: ${CMAKE_STRIP}") + message(STATUS + "Cross-compile assembler: ${CMAKE_ASM_COMPILER} " + "-x assembler-with-cpp" + ) + message(STATUS "ABI flags: ${ABI_FLAGS}") + message(STATUS "Custom linker script: ${LINKER_SCRIPT}") + endif() + + set_property(CACHE TGT_BSP + PROPERTY STRINGS + "arm/raspberrypi" + ) +endif() + +if(${TGT_BSP} MATCHES "arm/raspberrypi") + +else() + + if(TGT_BSP) + message(WARNING "CMake not configured for this target!") + message(FATAL_ERROR "Target: ${TGT_BSP}!") + endif() + +endif() + +set(BSP_PATH ${BSP_PATH} PARENT_SCOPE) + +endfunction() \ No newline at end of file diff --git a/buildsystem/cmake/PreProjectConfig.cmake b/buildsystem/cmake/PreProjectConfig.cmake new file mode 100644 index 00000000..cc9fe00a --- /dev/null +++ b/buildsystem/cmake/PreProjectConfig.cmake @@ -0,0 +1,58 @@ +function(pre_project_config) + +# Basic input sanitization +if(DEFINED TGT_BSP) + if(${TGT_BSP} MATCHES "arm/raspberrypi" AND NOT ${OS_FSFW} MATCHES linux) + message(STATUS "FSFW OSAL invalid for specified target BSP ${TGT_BSP}!") + message(STATUS "Setting valid OS_FSFW: linux") + set(OS_FSFW "linux") + endif() +endif() + +# Disable compiler checks for cross-compiling. +if(${OS_FSFW} STREQUAL linux AND TGT_BSP) + + if(${TGT_BSP} MATCHES "arm/raspberrypi") + if(NOT DEFINED ENV{RASPBIAN_ROOTFS}) + if(NOT RASPBIAN_ROOTFS) + set(ENV{RASPBIAN_ROOTFS} "$ENV{HOME}/raspberrypi/rootfs") + else() + set(ENV{RASPBIAN_ROOTFS} "${RASPBIAN_ROOTFS}") + endif() + else() + message(STATUS + "RASPBIAN_ROOTFS from environmental variables used: " + "$ENV{RASPBIAN_ROOTFS}" + ) + endif() + + if(NOT DEFINED ENV{RASPBERRY_VERSION}) + if(NOT RASPBERRY_VERSION) + message(STATUS "No RASPBERRY_VERSION specified, setting to 4") + set(RASPBERRY_VERSION "4" CACHE STRING "Raspberry Pi version") + else() + message(STATUS + "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}" + ) + set(RASPBERRY_VERSION + ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version" + ) + set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION}) + endif() + else() + message(STATUS + "RASPBERRY_VERSION from environmental variables used: " + "$ENV{RASPBERRY_VERSION}" + ) + endif() + + set(CMAKE_TOOLCHAIN_FILE + "${CMAKE_SCRIPT_PATH}/RPiCrossCompileConfig.cmake" + PARENT_SCOPE + ) + else() + message(WARNING "Target BSP (TGT_BSP) ${TGT_BSP} unknown!") + endif() +endif() + +endfunction() \ No newline at end of file diff --git a/buildsystem/cmake/RPiCrossCompileConfig.cmake b/buildsystem/cmake/RPiCrossCompileConfig.cmake new file mode 100644 index 00000000..26ca5781 --- /dev/null +++ b/buildsystem/cmake/RPiCrossCompileConfig.cmake @@ -0,0 +1,146 @@ +# Based on https://github.com/Pro/raspi-toolchain but rewritten completely. + +# Adapted for the FSFW Example +if(NOT $ENV{RASPBERRY_VERSION}) + message(STATUS "Raspberry Pi version not specified, setting version 4!") + set(RASPBERRY_VERSION 4) +else() + set(RASPBERRY_VERSION $ENV{RASPBERRY_VERSION}) +endif() + + +# RASPBIAN_ROOTFS should point to the local directory which contains all the +# libraries and includes from the target raspi. +# The following command can be used to do this, replace and the +# local accordingly: +# rsync -vR --progress -rl --delete-after --safe-links pi@:/{lib,usr,opt/vc/lib} +# RASPBIAN_ROOTFS needs to be passed to the CMake command or defined in the +# application CMakeLists.txt before loading the toolchain file. + +# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command + +if(NOT DEFINED ENV{RASPBIAN_ROOTFS}) + message(FATAL_ERROR + "Define the RASPBIAN_ROOTFS variable to " + "point to the raspbian rootfs." + ) +else() + set(SYSROOT_PATH "$ENV{RASPBIAN_ROOTFS}") +endif() + +if(NOT DEFINED ENV{CROSS_COMPILE}) + set(CROSS_COMPILE "arm-linux-gnueabihf") + message(STATUS + "No CROSS_COMPILE environmental variable set, using default ARM linux " + "cross compiler name ${CROSS_COMPILE}" + ) +else() + set(CROSS_COMPILE "$ENV{CROSS_COMPILE}") + message(STATUS + "Using environmental variable CROSS_COMPILE as cross-compiler: " + "$ENV{CROSS_COMPILE}" + ) +endif() + +message(STATUS "Using sysroot path: ${SYSROOT_PATH}") + +set(CROSS_COMPILE_CC "${CROSS_COMPILE}-gcc") +set(CROSS_COMPILE_CXX "${CROSS_COMPILE}-g++") +set(CROSS_COMPILE_LD "${CROSS_COMPILE}-ld") +set(CROSS_COMPILE_AR "${CROSS_COMPILE}-ar") +set(CROSS_COMPILE_RANLIB "${CROSS_COMPILE}-ranlib") +set(CROSS_COMPILE_STRIP "${CROSS_COMPILE}-strip") +set(CROSS_COMPILE_NM "${CROSS_COMPILE}-nm") +set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy") +set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size") + +# At the very least, cross compile gcc and g++ have to be set! +find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED) +find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED) + +set(CMAKE_CROSSCOMPILING TRUE) +set(CMAKE_SYSROOT "${SYSROOT_PATH}") + +# Define name of the target system +set(CMAKE_SYSTEM_NAME "Linux") +if(RASPBERRY_VERSION VERSION_GREATER 1) + set(CMAKE_SYSTEM_PROCESSOR "armv7") +else() + set(CMAKE_SYSTEM_PROCESSOR "arm") +endif() + +# Define the compiler +set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC}) +set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX}) + +# List of library dirs where LD has to look. Pass them directly through gcc. +# LD_LIBRARY_PATH is not evaluated by arm-*-ld +set(LIB_DIRS + "/opt/cross-pi-gcc/arm-linux-gnueabihf/lib" + "/opt/cross-pi-gcc/lib" + "${SYSROOT_PATH}/opt/vc/lib" + "${SYSROOT_PATH}/lib/${CROSS_COMPILE}" + "${SYSROOT_PATH}/usr/local/lib" + "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}" + "${SYSROOT_PATH}/usr/lib" + "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}/blas" + "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}/lapack" +) +# You can additionally check the linker paths if you add the +# flags ' -Xlinker --verbose' +set(COMMON_FLAGS "-I${SYSROOT_PATH}/usr/include") +foreach(LIB ${LIB_DIRS}) + set(COMMON_FLAGS "${COMMON_FLAGS} -L${LIB} -Wl,-rpath-link,${LIB}") +endforeach() + +set(CMAKE_PREFIX_PATH + "${CMAKE_PREFIX_PATH}" + "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}" +) + +if(RASPBERRY_VERSION VERSION_GREATER 3) + set(CMAKE_C_FLAGS + "-mcpu=cortex-a72 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" + CACHE STRING "Flags for Raspberry PI 4" + ) + set(CMAKE_CXX_FLAGS + "${CMAKE_C_FLAGS}" + CACHE STRING "Flags for Raspberry PI 4" + ) +elseif(RASPBERRY_VERSION VERSION_GREATER 2) + set(CMAKE_C_FLAGS + "-mcpu=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" + CACHE STRING "Flags for Raspberry PI 3" + ) + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" + CACHE STRING "Flags for Raspberry PI 3" + ) +elseif(RASPBERRY_VERSION VERSION_GREATER 1) + set(CMAKE_C_FLAGS + "-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" + CACHE STRING "Flags for Raspberry PI 2" + ) + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" + CACHE STRING "Flags for Raspberry PI 2" + ) +else() + set(CMAKE_C_FLAGS + "-mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard ${COMMON_FLAGS}" + CACHE STRING "Flags for Raspberry PI 1 B+ Zero" + ) + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" + CACHE STRING "Flags for Raspberry PI 1 B+ Zero" + ) +endif() + +set(CMAKE_FIND_ROOT_PATH + "${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH};${CMAKE_SYSROOT}" +) + + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml b/buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/.idea/misc.xml b/buildsystem/cmake/scripts/.idea/misc.xml new file mode 100644 index 00000000..d56657ad --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/.idea/modules.xml b/buildsystem/cmake/scripts/.idea/modules.xml new file mode 100644 index 00000000..bb83e262 --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/.idea/scripts.iml b/buildsystem/cmake/scripts/.idea/scripts.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/scripts.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/.idea/vcs.xml b/buildsystem/cmake/scripts/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/.idea/workspace.xml b/buildsystem/cmake/scripts/.idea/workspace.xml new file mode 100644 index 00000000..70a189f3 --- /dev/null +++ b/buildsystem/cmake/scripts/.idea/workspace.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1609084345199 + + + + + + + + + + + + \ No newline at end of file diff --git a/buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh b/buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh new file mode 100644 index 00000000..ee7b441a --- /dev/null +++ b/buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh @@ -0,0 +1,26 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="" +os_fsfw="host" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" diff --git a/buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh b/buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh new file mode 100644 index 00000000..778cde3b --- /dev/null +++ b/buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh @@ -0,0 +1,26 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="" +os_fsfw="host" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" diff --git a/buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh b/buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh new file mode 100644 index 00000000..f9321e69 --- /dev/null +++ b/buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh @@ -0,0 +1,26 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="" +os_fsfw="host" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" diff --git a/buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh b/buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh new file mode 100644 index 00000000..6a3cbe60 --- /dev/null +++ b/buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh @@ -0,0 +1,26 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="" +os_fsfw="host" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size" \ No newline at end of file diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh b/buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh new file mode 100644 index 00000000..5dff0fc7 --- /dev/null +++ b/buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh @@ -0,0 +1,20 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="Unix Makefiles" +os_fsfw="linux" + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh b/buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh new file mode 100644 index 00000000..914c4581 --- /dev/null +++ b/buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh @@ -0,0 +1,20 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="Unix Makefiles" +os_fsfw="linux" + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh b/buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh new file mode 100644 index 00000000..3414d111 --- /dev/null +++ b/buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh @@ -0,0 +1,20 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="Unix Makefiles" +os_fsfw="linux" + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh b/buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh new file mode 100644 index 00000000..d4500d6d --- /dev/null +++ b/buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh @@ -0,0 +1,20 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "create_cmake_cfg.sh not found in upper directories!" + exit 1 +fi + +build_generator="Unix Makefiles" +os_fsfw="linux" + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size" diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh b/buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh new file mode 100644 index 00000000..deb78243 --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/raspberrypi" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh b/buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh new file mode 100644 index 00000000..0e23bee4 --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/raspberrypi" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh b/buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh new file mode 100644 index 00000000..3e952750 --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/raspberrypi" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh b/buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh new file mode 100644 index 00000000..f7bad84e --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/raspberrypi" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/RPi/rpi_path_helper.sh b/buildsystem/cmake/scripts/RPi/rpi_path_helper.sh new file mode 100644 index 00000000..95044281 --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/rpi_path_helper.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# This script can be used to set the path to the cross-compile toolchain +# A default path is set if the path is not supplied via command line +if [ $# -eq 1 ];then + export PATH=$PATH:"$1" +else + # TODO: make version configurable via shell argument + export PATH=$PATH:"/opt/cross-pi-gcc/bin" + export CROSS_COMPILE="arm-linux-gnueabihf" + export RASPBERRY_VERSION="4" + export RASPBIAN_ROOTFS="${HOME}/raspberrypi/rootfs" +fi + +# It is also recommended to set up a custom shell script to perform the +# sysroot synchronization so that any software is built with the library and +# headers of the Raspberry Pi. This can for example be dome with the rsync +# command. +# The following command can be used, and the local +# need to be set accordingly. + +# rsync -vR --progress -rl --delete-after --safe-links pi@:/{lib,usr,opt/vc/lib} + +# It is recommended to use $HOME/raspberrypi/rootfs as the rootfs path, +# so the default RASPBIAN_ROOTFS variable set in the CMakeLists.txt is correct. diff --git a/buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh b/buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh new file mode 100644 index 00000000..2b590e92 --- /dev/null +++ b/buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# This script can be used to set the path to the cross-compile toolchain +# A default path is set if the path is not supplied via command line +if [ $# -eq 1 ];then + export PATH=$PATH:"$1" +else + # TODO: make version configurable via shell argument + export PATH=$PATH:"/c/SysGCC/raspberry/bin" + export CROSS_COMPILE="arm-linux-gnueabihf" + export RASPBERRY_VERSION="4" + export RASPBIAN_ROOTFS="/c/Users//raspberrypi/rootfs" +fi + +# It is also recommended to set up a custom shell script to perform the +# sysroot synchronization so that any software is built with the library and +# headers of the Raspberry Pi. This can for example be dome with the rsync +# command. +# The following command can be used, and the local +# need to be set accordingly. + +# rsync -vR --progress -rl --delete-after --safe-links pi@:/{lib,usr,opt/vc/lib} + diff --git a/buildsystem/cmake/scripts/cmake_build_config.py b/buildsystem/cmake/scripts/cmake_build_config.py new file mode 100644 index 00000000..a6388ef8 --- /dev/null +++ b/buildsystem/cmake/scripts/cmake_build_config.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +""" +@brief CMake configuration helper +@details +This script was written to have a portable way to perform the CMake configuration with various parameters on +different OSes. It was first written for the FSFW Example, but could be adapted to be more generic +in the future. + +Run cmake_build_config.py --help to get more information. +""" +import os +import sys +import argparse +import shutil + + +def main(): + print("-- Python CMake build configurator utility --") + + print("Parsing command line arguments..") + parser = argparse.ArgumentParser(description="Processing arguments for CMake build configuration.") + parser.add_argument("-o", "--osal", type=str, choices=["freertos", "linux", "rtems", "host"], + help="FSFW OSAL. Valid arguments: host, linux, rtems, freertos") + parser.add_argument("-b", "--buildtype", type=str, choices=["debug", "release", "size", "reldeb"], + help="CMake build type. Valid arguments: debug, release, size, reldeb (Release with Debug " + "Information)", default="debug") + parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.") + parser.add_argument("-g", "--generator", type=str, help="CMake Generator") + parser.add_argument("-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine") + + args = parser.parse_args() + + print("Determining source location..") + source_location = determine_source_location() + print(f"Determined source location: {source_location}") + + print("Building cmake configuration command..") + + if args.osal is None: + print("No FSFW OSAL specified, setting to default (host)..") + osal = "host" + else: + osal = args.osal + + if args.generator is None: + generator_cmake_arg = "" + else: + generator_cmake_arg = f"-G \"{args.generator}\"" + + if args.buildtype == "debug": + cmake_build_type = "Debug" + elif args.buildtype == "release": + cmake_build_type = "Release" + elif args.buildtype == "size": + cmake_build_type = "MinSizeRel" + else: + cmake_build_type = "RelWithDebInfo" + + if args.target_bsp is not None: + cmake_target_cfg_cmd = f"-DTGT_BSP=\"{args.target_bsp}\"" + else: + cmake_target_cfg_cmd = "" + + # TODO: Use builddir if given (need to check whether path is relative or absolute) + build_folder = cmake_build_type + + build_path = source_location + os.path.sep + build_folder + if os.path.isdir(build_path): + remove_old_dir = input(f"{build_folder} folder already exists. Remove old directory? [y/n]: ") + if str(remove_old_dir).lower() in ["yes", "y", 1]: + remove_old_dir = True + else: + build_folder = determine_new_folder() + build_path = source_location + os.path.sep + build_folder + remove_old_dir = False + if remove_old_dir: + shutil.rmtree(build_path) + os.chdir(source_location) + os.mkdir(build_folder) + print(f"Navigating into build directory: {build_path}") + os.chdir(build_folder) + + cmake_command = f"cmake {generator_cmake_arg} -DOS_FSFW=\"{osal}\" " \ + f"-DCMAKE_BUILD_TYPE=\"{cmake_build_type}\" {cmake_target_cfg_cmd} {source_location}" + # Remove redundant spaces + cmake_command = ' '.join(cmake_command.split()) + print("Running CMake command: ") + print(f"\" {cmake_command} \"") + os.system(cmake_command) + print("-- CMake configuration done. --") + + +def determine_source_location() -> str: + index = 0 + while not os.path.isdir("fsfw"): + index += 1 + os.chdir("..") + if index >= 5: + print("Error: Could not find source directory (determined by looking for fsfw folder!)") + sys.exit(1) + return os.getcwd() + + +def determine_new_folder() -> str: + new_folder = input(f"Use different folder name? [y/n]: ") + if str(new_folder).lower() in ["yes", "y", 1]: + new_folder_name = input("New folder name: ") + return new_folder_name + else: + print("Aborting configuration.") + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/fsfw b/fsfw index dcc111e4..5b9c0e01 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dcc111e4facf39137fe52d8234361b7d99bdde06 +Subproject commit 5b9c0e013e35ab1353d402c6fa2cd75866e3afa5 diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index 7b9dfbc4..4ceaf459 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -6,13 +6,27 @@ #ifndef FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_ -#include "returnvalues/classIds.h" -#include "events/subsystemIdRanges.h" - #define OBSW_ADD_TEST_CODE 0 // These defines should be disabled for mission code but are useful for // debugging. #define OBSW_ENHANCED_PRINTOUT 1 +#include "OBSWVersion.h" + +#ifdef __cplusplus + +#include "objects/systemObjectList.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + +namespace config { +#endif + +/* Add mission configuration flags here */ + +#ifdef __cplusplus +} +#endif + #endif /* FSFWCONFIG_OBSWCONFIG_H_ */ diff --git a/mission/CMakeLists.txt b/mission/CMakeLists.txt new file mode 100644 index 00000000..9cb18749 --- /dev/null +++ b/mission/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(core) +add_subdirectory(devices) +add_subdirectory(utility) diff --git a/mission/core/CMakeLists.txt b/mission/core/CMakeLists.txt new file mode 100644 index 00000000..5d088e48 --- /dev/null +++ b/mission/core/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${TARGET_NAME} PUBLIC + GenericFactory.cpp +) + + diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt new file mode 100644 index 00000000..f01df0e1 --- /dev/null +++ b/mission/devices/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + GPSHandler.cpp + GyroL3GD20Handler.cpp + MGMHandlerLIS3MDL.cpp + MGMHandlerRM3100.cpp +) + + diff --git a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h index 60a107d8..921c9e5f 100644 --- a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h @@ -12,7 +12,7 @@ namespace RM3100 { static constexpr uint8_t READ_MASK = 0b1000'0000; /*----------------------------------------------------------------------------*/ -/* CMM Register +/* CMM Register */ /*----------------------------------------------------------------------------*/ static constexpr uint8_t SET_CMM_CMZ = 1 << 6; static constexpr uint8_t SET_CMM_CMY = 1 << 5; @@ -25,7 +25,7 @@ static constexpr uint8_t CMM_VALUE = SET_CMM_CMZ | SET_CMM_CMY | SET_CMM_CMX | SET_CMM_DRDM | SET_CMM_START; /*----------------------------------------------------------------------------*/ -/* Cycle count register +/* Cycle count register */ /*----------------------------------------------------------------------------*/ // Default value (200) static constexpr uint8_t CYCLE_COUNT_VALUE = 0xC8; @@ -35,7 +35,7 @@ static constexpr float DEFAULT_GAIN = static_cast(CYCLE_COUNT_VALUE) / static constexpr uint8_t CYCLE_COUNT_START_REGISTER = 0x04; /*----------------------------------------------------------------------------*/ -/* TMRC register +/* TMRC register */ /*----------------------------------------------------------------------------*/ static constexpr uint8_t TMRC_150HZ_VALUE = 0x94; static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; diff --git a/mission/utility/CMakeLists.txt b/mission/utility/CMakeLists.txt new file mode 100644 index 00000000..4847dddd --- /dev/null +++ b/mission/utility/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${TARGET_NAME} PUBLIC + TmFunnel.cpp +) + + diff --git a/tmtc b/tmtc index 9be8713f..07b6a9df 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9be8713fa0cc6128e9469da2e635365b03146de3 +Subproject commit 07b6a9df18baff999ca52c2f2781f8f77f8dcb65 -- 2.43.0 From e2d790533400d15e2cc89d2f36bc0f7658aa001c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 01:15:35 +0100 Subject: [PATCH 03/23] bugfix --- mission/devices/GyroL3GD20Handler.cpp | 6 +++--- mission/devices/devicedefinitions/GyroL3GD20Definitions.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index b6067e5b..11a053c8 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -171,11 +171,11 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id, int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; float temperature = 25.0 + temperaturOffset; - ReturnValue_t result = dataset.read(20); + result = dataset.read(20); if(result == HasReturnvaluesIF::RETURN_OK) { dataset.angVelocX = angVelocX; - dataset.angVelocY = angVelocX; - dataset.angVelocZ = angVelocX; + dataset.angVelocY = angVelocY; + dataset.angVelocZ = angVelocZ; dataset.temperature = temperature; dataset.setValidity(true, true); result = dataset.commit(20); diff --git a/mission/devices/devicedefinitions/GyroL3GD20Definitions.h b/mission/devices/devicedefinitions/GyroL3GD20Definitions.h index c6042f58..d2fa9903 100644 --- a/mission/devices/devicedefinitions/GyroL3GD20Definitions.h +++ b/mission/devices/devicedefinitions/GyroL3GD20Definitions.h @@ -14,7 +14,7 @@ static constexpr uint8_t WHO_AM_I_REG = 0b0000'1111; static constexpr uint8_t WHO_AM_I_VAL = 0b1101'0111; /*------------------------------------------------------------------------*/ -/* Control registers +/* Control registers */ /*------------------------------------------------------------------------*/ static constexpr uint8_t CTRL_REG_1 = 0b0010'0000; static constexpr uint8_t CTRL_REG_2 = 0b0010'0001; @@ -88,7 +88,7 @@ static constexpr uint8_t OUT_Z_L = 13; static constexpr uint8_t OUT_Z_H = 14; /*------------------------------------------------------------------------*/ -/* Device Handler specific +/* Device Handler specific */ /*------------------------------------------------------------------------*/ static constexpr DeviceCommandId_t READ_REGS = 0; static constexpr DeviceCommandId_t CONFIGURE_CTRL_REGS = 1; -- 2.43.0 From be82cd472ec86fb19bd4eb6545ba8c51758b493d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 01:26:22 +0100 Subject: [PATCH 04/23] added rpi support --- CMakeLists.txt | 9 +++++++-- bsp_linux/boardconfig/CMakeLists.txt | 4 ++++ buildsystem/cmake/HardwareOsPreConfig.cmake | 4 +++- fsfwconfig/CMakeLists.txt | 11 +++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 fsfwconfig/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 98f2b5e8..159779b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,11 @@ set(MISSION_PATH mission) include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() +if(${OS_FSFW} MATCHES linux) +set(FSFW_CONFIG_PATH "fsfwconfig") +else() set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") +endif() ################################################################################ # Executable and Sources @@ -57,9 +61,10 @@ set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") add_executable(${TARGET_NAME}) # Add subdirectories -if(LIB_OS_NAME) - add_subdirectory(${LIB_OS_NAME}) +if(${OS_FSFW} MATCHES linux) + add_subdirectory(${FSFW_CONFIG_PATH}) endif() + add_subdirectory(${BSP_PATH}) add_subdirectory(${FSFW_PATH}) add_subdirectory(${MISSION_PATH}) diff --git a/bsp_linux/boardconfig/CMakeLists.txt b/bsp_linux/boardconfig/CMakeLists.txt index 2a1cb58a..c32b326d 100644 --- a/bsp_linux/boardconfig/CMakeLists.txt +++ b/bsp_linux/boardconfig/CMakeLists.txt @@ -1,3 +1,7 @@ +target_sources(${TARGET_NAME} PRIVATE + print.c +) + target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/buildsystem/cmake/HardwareOsPreConfig.cmake index c2524bd7..39e52168 100644 --- a/buildsystem/cmake/HardwareOsPreConfig.cmake +++ b/buildsystem/cmake/HardwareOsPreConfig.cmake @@ -53,7 +53,9 @@ if(CMAKE_CROSSCOMPILING) endif() if(${TGT_BSP} MATCHES "arm/raspberrypi") - + + set(BSP_PATH "bsp_linux") + else() if(TGT_BSP) diff --git a/fsfwconfig/CMakeLists.txt b/fsfwconfig/CMakeLists.txt new file mode 100644 index 00000000..897789ef --- /dev/null +++ b/fsfwconfig/CMakeLists.txt @@ -0,0 +1,11 @@ +target_sources(${TARGET_NAME} PRIVATE + ipc/MissionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp +) + +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + + + -- 2.43.0 From 4c30deb6cb193d0333da2216a943ce4dda8cdd7d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 01:28:21 +0100 Subject: [PATCH 05/23] including taspbery pi bsp --- CMakeLists.txt | 6 ++++++ bsp_rpi/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 bsp_rpi/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 159779b9..71918df8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,8 @@ else() set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") endif() +set(RPI_BSP_PATH "bsp_rpi") + ################################################################################ # Executable and Sources ################################################################################ @@ -65,6 +67,10 @@ if(${OS_FSFW} MATCHES linux) add_subdirectory(${FSFW_CONFIG_PATH}) endif() +if(${TGT_BSP} MATCHES "arm/raspberrypi") + add_subdirectory(${RPI_BSP_PATH}) +endif() + add_subdirectory(${BSP_PATH}) add_subdirectory(${FSFW_PATH}) add_subdirectory(${MISSION_PATH}) diff --git a/bsp_rpi/CMakeLists.txt b/bsp_rpi/CMakeLists.txt new file mode 100644 index 00000000..e2ad16aa --- /dev/null +++ b/bsp_rpi/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${TARGET_NAME} PUBLIC + +) + + + -- 2.43.0 From 9ee2e4e1da288c7b5f2c0b4dfbe967737b80dfff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 01:40:47 +0100 Subject: [PATCH 06/23] added q7s xcompile file --- buildsystem/cmake/HardwareOsPreConfig.cmake | 4 +- buildsystem/cmake/PreProjectConfig.cmake | 7 +- buildsystem/cmake/Q7SCrossCompileConfig.cmake | 81 +++++++++++++++++++ buildsystem/cmake/RPiCrossCompileConfig.cmake | 16 ++-- .../scripts/Q7S/create_cmake_debug_cfg.sh | 27 +++++++ .../scripts/Q7S/create_cmake_release_cfg.sh | 27 +++++++ .../Q7S/create_cmake_relwithdeb_cfg.sh | 27 +++++++ 7 files changed, 178 insertions(+), 11 deletions(-) create mode 100644 buildsystem/cmake/Q7SCrossCompileConfig.cmake create mode 100644 buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh create mode 100644 buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh create mode 100644 buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/buildsystem/cmake/HardwareOsPreConfig.cmake index 39e52168..32080176 100644 --- a/buildsystem/cmake/HardwareOsPreConfig.cmake +++ b/buildsystem/cmake/HardwareOsPreConfig.cmake @@ -48,11 +48,11 @@ if(CMAKE_CROSSCOMPILING) set_property(CACHE TGT_BSP PROPERTY STRINGS - "arm/raspberrypi" + "arm/q7s" "arm/raspberrypi" ) endif() -if(${TGT_BSP} MATCHES "arm/raspberrypi") +if(${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/q7s") set(BSP_PATH "bsp_linux") diff --git a/buildsystem/cmake/PreProjectConfig.cmake b/buildsystem/cmake/PreProjectConfig.cmake index cc9fe00a..ce18d89d 100644 --- a/buildsystem/cmake/PreProjectConfig.cmake +++ b/buildsystem/cmake/PreProjectConfig.cmake @@ -12,7 +12,12 @@ endif() # Disable compiler checks for cross-compiling. if(${OS_FSFW} STREQUAL linux AND TGT_BSP) - if(${TGT_BSP} MATCHES "arm/raspberrypi") + if(${TGT_BSP} MATCHES "arm/q7s") + set(CMAKE_TOOLCHAIN_FILE + "${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake" + PARENT_SCOPE + ) + elseif (${TGT_BSP} MATCHES "arm/raspberrypi") if(NOT DEFINED ENV{RASPBIAN_ROOTFS}) if(NOT RASPBIAN_ROOTFS) set(ENV{RASPBIAN_ROOTFS} "$ENV{HOME}/raspberrypi/rootfs") diff --git a/buildsystem/cmake/Q7SCrossCompileConfig.cmake b/buildsystem/cmake/Q7SCrossCompileConfig.cmake new file mode 100644 index 00000000..665869f9 --- /dev/null +++ b/buildsystem/cmake/Q7SCrossCompileConfig.cmake @@ -0,0 +1,81 @@ +# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command + +#if(NOT DEFINED ENV{Q7S_ROOTFS}) +# message(FATAL_ERROR +# "Define the Q7S_ROOTFS variable to " +# "point to the raspbian rootfs." +# ) +#else() +# set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}") +#endif() + +if(NOT DEFINED ENV{CROSS_COMPILE}) + set(CROSS_COMPILE "arm-linux-gnueabihf") + message(STATUS + "No CROSS_COMPILE environmental variable set, using default ARM linux " + "cross compiler name ${CROSS_COMPILE}" + ) +else() + set(CROSS_COMPILE "$ENV{CROSS_COMPILE}") + message(STATUS + "Using environmental variable CROSS_COMPILE as cross-compiler: " + "$ENV{CROSS_COMPILE}" + ) +endif() + +# message(STATUS "Using sysroot path: ${SYSROOT_PATH}") + +set(CROSS_COMPILE_CC "${CROSS_COMPILE}-gcc") +set(CROSS_COMPILE_CXX "${CROSS_COMPILE}-g++") +set(CROSS_COMPILE_LD "${CROSS_COMPILE}-ld") +set(CROSS_COMPILE_AR "${CROSS_COMPILE}-ar") +set(CROSS_COMPILE_RANLIB "${CROSS_COMPILE}-ranlib") +set(CROSS_COMPILE_STRIP "${CROSS_COMPILE}-strip") +set(CROSS_COMPILE_NM "${CROSS_COMPILE}-nm") +set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy") +set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size") + +# At the very least, cross compile gcc and g++ have to be set! +find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED) +find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED) + +set(CMAKE_CROSSCOMPILING TRUE) +# set(CMAKE_SYSROOT "${SYSROOT_PATH}") + +# Define name of the target system +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_PROCESSOR "armv7") + +# Define the compiler +set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC}) +set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX}) + +# List of library dirs where LD has to look. Pass them directly through gcc. +set(LIB_DIRS +) +# You can additionally check the linker paths if you add the +# flags ' -Xlinker --verbose' +foreach(LIB ${LIB_DIRS}) + set(COMMON_FLAGS "${COMMON_FLAGS} -L${LIB} -Wl,-rpath-link,${LIB}") +endforeach() + +set(CMAKE_PREFIX_PATH + "${CMAKE_PREFIX_PATH}" + # "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}" +) + +set(CMAKE_C_FLAGS + "-mcpu=cortex-a9 -mfpu=neon-vfpv3 -mfloat-abi=hard ${COMMON_FLAGS}" + CACHE STRING "C flags for Q7S" +) +set(CMAKE_CXX_FLAGS + "${CMAKE_C_FLAGS}" + CACHE STRING "CPP flags for Q7S" +) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/buildsystem/cmake/RPiCrossCompileConfig.cmake b/buildsystem/cmake/RPiCrossCompileConfig.cmake index 26ca5781..e1b4cce3 100644 --- a/buildsystem/cmake/RPiCrossCompileConfig.cmake +++ b/buildsystem/cmake/RPiCrossCompileConfig.cmake @@ -101,35 +101,35 @@ set(CMAKE_PREFIX_PATH if(RASPBERRY_VERSION VERSION_GREATER 3) set(CMAKE_C_FLAGS "-mcpu=cortex-a72 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" - CACHE STRING "Flags for Raspberry PI 4" + CACHE STRING "CPP flags for Raspberry PI 4" ) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" - CACHE STRING "Flags for Raspberry PI 4" + CACHE STRING "C flags for Raspberry PI 4" ) elseif(RASPBERRY_VERSION VERSION_GREATER 2) set(CMAKE_C_FLAGS "-mcpu=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" - CACHE STRING "Flags for Raspberry PI 3" + CACHE STRING "C flags for Raspberry PI 3" ) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" - CACHE STRING "Flags for Raspberry PI 3" + CACHE STRING "CPP flags for Raspberry PI 3" ) elseif(RASPBERRY_VERSION VERSION_GREATER 1) set(CMAKE_C_FLAGS "-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard ${COMMON_FLAGS}" - CACHE STRING "Flags for Raspberry PI 2" + CACHE STRING "C flags for Raspberry PI 2" ) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" - CACHE STRING "Flags for Raspberry PI 2" + CACHE STRING "CPP flags for Raspberry PI 2" ) else() set(CMAKE_C_FLAGS "-mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard ${COMMON_FLAGS}" - CACHE STRING "Flags for Raspberry PI 1 B+ Zero" + CACHE STRING "C flags for Raspberry PI 1 B+ Zero" ) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" - CACHE STRING "Flags for Raspberry PI 1 B+ Zero" + CACHE STRING "CPP flags for Raspberry PI 1 B+ Zero" ) endif() diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh b/buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh new file mode 100644 index 00000000..7f6753ac --- /dev/null +++ b/buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/q7s" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh b/buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh new file mode 100644 index 00000000..6048a1c6 --- /dev/null +++ b/buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/q7s" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh b/buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh new file mode 100644 index 00000000..346067cd --- /dev/null +++ b/buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh @@ -0,0 +1,27 @@ +#!/bin/sh +counter=0 +while [ ${counter} -lt 5 ] +do + cd .. + if [ -f "cmake_build_config.py" ];then + break + fi + counter=$((counter=counter + 1)) +done + +if [ "${counter}" -ge 5 ];then + echo "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/q7s" +build_generator="" +if [ "${OS}" = "Windows_NT" ]; then + build_generator="MinGW Makefiles" +# Could be other OS but this works for now. +else + build_generator="Unix Makefiles" +fi + +python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -t "${tgt_bsp}" -- 2.43.0 From d4c4c6dd40a115be8074dd0091bf5015153be64d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 02:15:04 +0100 Subject: [PATCH 07/23] project name corrected --- CMakeLists.txt | 2 +- misc/eclipse/{ => Host}/eive-linux-host-debug.launch | 0 misc/eclipse/{ => Host}/eive-linux-host-release.launch | 0 misc/eclipse/{ => Host}/eive-mingw-debug.launch | 0 misc/eclipse/{ => Host}/eive-mingw-release.launch | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename misc/eclipse/{ => Host}/eive-linux-host-debug.launch (100%) rename misc/eclipse/{ => Host}/eive-linux-host-release.launch (100%) rename misc/eclipse/{ => Host}/eive-mingw-debug.launch (100%) rename misc/eclipse/{ => Host}/eive-mingw-release.launch (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71918df8..cd91447c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake) pre_project_config() # Project Name -project(fsfw_example ASM C CXX) +project(eive_obsw ASM C CXX) ################################################################################ # Pre-Sources preparation diff --git a/misc/eclipse/eive-linux-host-debug.launch b/misc/eclipse/Host/eive-linux-host-debug.launch similarity index 100% rename from misc/eclipse/eive-linux-host-debug.launch rename to misc/eclipse/Host/eive-linux-host-debug.launch diff --git a/misc/eclipse/eive-linux-host-release.launch b/misc/eclipse/Host/eive-linux-host-release.launch similarity index 100% rename from misc/eclipse/eive-linux-host-release.launch rename to misc/eclipse/Host/eive-linux-host-release.launch diff --git a/misc/eclipse/eive-mingw-debug.launch b/misc/eclipse/Host/eive-mingw-debug.launch similarity index 100% rename from misc/eclipse/eive-mingw-debug.launch rename to misc/eclipse/Host/eive-mingw-debug.launch diff --git a/misc/eclipse/eive-mingw-release.launch b/misc/eclipse/Host/eive-mingw-release.launch similarity index 100% rename from misc/eclipse/eive-mingw-release.launch rename to misc/eclipse/Host/eive-mingw-release.launch -- 2.43.0 From d0114d53c22d5c4a4524d15df938145ce4924a36 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 02:16:39 +0100 Subject: [PATCH 08/23] correction in factoryx --- bsp_linux/ObjectFactory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bsp_linux/ObjectFactory.cpp b/bsp_linux/ObjectFactory.cpp index a0f82887..4300fbeb 100644 --- a/bsp_linux/ObjectFactory.cpp +++ b/bsp_linux/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include @@ -25,6 +26,8 @@ void Factory::setStaticFrameworkObjectIds() { // No storage object for now. TmFunnel::storageDestination = objects::NO_OBJECT; + LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; TmPacketStored::timeStamperId = objects::TIME_STAMPER; } -- 2.43.0 From fe9364550dc38070b19c04ad4093ae0a12c57f60 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 12:15:55 +0100 Subject: [PATCH 09/23] fsfw points to devel now --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 5b9c0e01..dcc111e4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5b9c0e013e35ab1353d402c6fa2cd75866e3afa5 +Subproject commit dcc111e4facf39137fe52d8234361b7d99bdde06 -- 2.43.0 From 33b48e97a35c49a615ade25cdcb00bfac671f6c6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 12:16:38 +0100 Subject: [PATCH 10/23] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index dcc111e4..426514b9 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dcc111e4facf39137fe52d8234361b7d99bdde06 +Subproject commit 426514b9a29274f46ea3723c8ef17c989c70bdac -- 2.43.0 From 6666ae0e3e9e8f0e2eb2c696cf4ea13a86a920fe Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 12:22:35 +0100 Subject: [PATCH 11/23] small bugfix --- buildsystem/cmake/HardwareOsPreConfig.cmake | 11 ++++------- fsfw | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/buildsystem/cmake/HardwareOsPreConfig.cmake index 32080176..b8a11f97 100644 --- a/buildsystem/cmake/HardwareOsPreConfig.cmake +++ b/buildsystem/cmake/HardwareOsPreConfig.cmake @@ -52,17 +52,14 @@ if(CMAKE_CROSSCOMPILING) ) endif() -if(${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/q7s") - - set(BSP_PATH "bsp_linux") - -else() - if(TGT_BSP) +if(TGT_BSP) + if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/q7s") + # set(BSP_PATH "bsp_linux") + else() message(WARNING "CMake not configured for this target!") message(FATAL_ERROR "Target: ${TGT_BSP}!") endif() - endif() set(BSP_PATH ${BSP_PATH} PARENT_SCOPE) diff --git a/fsfw b/fsfw index 426514b9..5b9c0e01 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 426514b9a29274f46ea3723c8ef17c989c70bdac +Subproject commit 5b9c0e013e35ab1353d402c6fa2cd75866e3afa5 -- 2.43.0 From 9a6fbbaff633301ecb399aeb91ee409d1a3bc6bc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 13:59:31 +0100 Subject: [PATCH 12/23] added cmake support for csp lib --- CMakeLists.txt | 22 ++- Makefile | 2 +- bsp_hosted/InitMission.cpp | 5 +- {bsp_linux => bsp_q7s}/CMakeLists.txt | 0 {bsp_linux => bsp_q7s}/InitMission.cpp | 11 +- bsp_q7s/InitMission.h | 9 + bsp_q7s/ObjectFactory.cpp | 77 +++++++++ bsp_q7s/ObjectFactory.h | 10 ++ .../boardconfig/CMakeLists.txt | 0 .../boardconfig/etl_profile.h | 0 {bsp_linux => bsp_q7s}/boardconfig/gcov.h | 0 {bsp_linux => bsp_q7s}/boardconfig/print.c | 2 +- {bsp_linux => bsp_q7s}/boardconfig/print.h | 0 bsp_linux/bsp_linux.mk => bsp_q7s/bsp_q7s.mk | 0 {bsp_linux => bsp_q7s}/comIF/CspComIF.cpp | 3 +- {bsp_linux => bsp_q7s}/comIF/CspComIF.h | 0 .../comIF/cookies/CspCookie.cpp | 0 .../comIF/cookies/CspCookie.h | 8 +- bsp_q7s/main.cpp | 29 ++++ bsp_rpi/CMakeLists.txt | 7 +- bsp_rpi/InitMission.cpp | 158 ++++++++++++++++++ {bsp_linux => bsp_rpi}/InitMission.h | 0 {bsp_linux => bsp_rpi}/ObjectFactory.cpp | 0 {bsp_linux => bsp_rpi}/ObjectFactory.h | 0 bsp_rpi/boardconfig/CMakeLists.txt | 10 ++ bsp_rpi/boardconfig/etl_profile.h | 38 +++++ bsp_rpi/boardconfig/gcov.h | 14 ++ bsp_rpi/boardconfig/print.c | 14 ++ bsp_rpi/boardconfig/print.h | 8 + {bsp_linux => bsp_rpi}/main.cpp | 0 buildsystem/cmake/HardwareOsPreConfig.cmake | 7 +- libcsp/CMakeLists.txt | 12 ++ libcsp/include/CMakeLists.txt | 7 + libcsp/src/CMakeLists.txt | 25 +++ libcsp/src/arch/posix/CMakeLists.txt | 9 + libcsp/src/crypto/CMakeLists.txt | 5 + libcsp/src/drivers/CMakeLists.txt | 1 + libcsp/src/drivers/can/CMakeLists.txt | 3 + libcsp/src/interfaces/CMakeLists.txt | 7 + libcsp/src/rtable/CMakeLists.txt | 3 + libcsp/src/transport/CMakeLists.txt | 4 + mission/core/GenericFactory.cpp | 47 +----- 42 files changed, 490 insertions(+), 67 deletions(-) rename {bsp_linux => bsp_q7s}/CMakeLists.txt (100%) rename {bsp_linux => bsp_q7s}/InitMission.cpp (96%) create mode 100644 bsp_q7s/InitMission.h create mode 100644 bsp_q7s/ObjectFactory.cpp create mode 100644 bsp_q7s/ObjectFactory.h rename {bsp_linux => bsp_q7s}/boardconfig/CMakeLists.txt (100%) rename {bsp_linux => bsp_q7s}/boardconfig/etl_profile.h (100%) rename {bsp_linux => bsp_q7s}/boardconfig/gcov.h (100%) rename {bsp_linux => bsp_q7s}/boardconfig/print.c (81%) rename {bsp_linux => bsp_q7s}/boardconfig/print.h (100%) rename bsp_linux/bsp_linux.mk => bsp_q7s/bsp_q7s.mk (100%) rename {bsp_linux => bsp_q7s}/comIF/CspComIF.cpp (99%) rename {bsp_linux => bsp_q7s}/comIF/CspComIF.h (100%) rename {bsp_linux => bsp_q7s}/comIF/cookies/CspCookie.cpp (100%) rename {bsp_linux => bsp_q7s}/comIF/cookies/CspCookie.h (71%) create mode 100644 bsp_q7s/main.cpp create mode 100644 bsp_rpi/InitMission.cpp rename {bsp_linux => bsp_rpi}/InitMission.h (100%) rename {bsp_linux => bsp_rpi}/ObjectFactory.cpp (100%) rename {bsp_linux => bsp_rpi}/ObjectFactory.h (100%) create mode 100644 bsp_rpi/boardconfig/CMakeLists.txt create mode 100644 bsp_rpi/boardconfig/etl_profile.h create mode 100644 bsp_rpi/boardconfig/gcov.h create mode 100644 bsp_rpi/boardconfig/print.c create mode 100644 bsp_rpi/boardconfig/print.h rename {bsp_linux => bsp_rpi}/main.cpp (100%) create mode 100644 libcsp/CMakeLists.txt create mode 100644 libcsp/include/CMakeLists.txt create mode 100644 libcsp/src/CMakeLists.txt create mode 100644 libcsp/src/arch/posix/CMakeLists.txt create mode 100644 libcsp/src/crypto/CMakeLists.txt create mode 100644 libcsp/src/drivers/CMakeLists.txt create mode 100644 libcsp/src/drivers/can/CMakeLists.txt create mode 100644 libcsp/src/interfaces/CMakeLists.txt create mode 100644 libcsp/src/rtable/CMakeLists.txt create mode 100644 libcsp/src/transport/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index cd91447c..9a27a5cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,20 +41,26 @@ set(LIB_FSFW_NAME fsfw) # Set path names set(FSFW_PATH fsfw) set(MISSION_PATH mission) +set(CSPLIB_PATH libcsp) # Analyse different OS and architecture/target options, determine BSP_PATH, # display information about compiler etc. include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() -if(${OS_FSFW} MATCHES linux) -set(FSFW_CONFIG_PATH "fsfwconfig") +if(TGT_BSP) + if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") + set(ROOT_CONFIG_FOLDER TRUE) + set(FSFW_CONFIG_PATH "fsfwconfig") + endif() + + if(${TGT_BSP} MATCHES "arm/q7s") + set(ADD_CSP_LIB TRUE) + endif() else() -set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") + set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") endif() -set(RPI_BSP_PATH "bsp_rpi") - ################################################################################ # Executable and Sources ################################################################################ @@ -63,12 +69,12 @@ set(RPI_BSP_PATH "bsp_rpi") add_executable(${TARGET_NAME}) # Add subdirectories -if(${OS_FSFW} MATCHES linux) +if(ROOT_CONFIG_FOLDER) add_subdirectory(${FSFW_CONFIG_PATH}) endif() -if(${TGT_BSP} MATCHES "arm/raspberrypi") - add_subdirectory(${RPI_BSP_PATH}) +if(ADD_CSP_LIB) + add_subdirectory(${CSPLIB_PATH}) endif() add_subdirectory(${BSP_PATH}) diff --git a/Makefile b/Makefile index 3956d5f1..b1ccd741 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SHELL = /bin/sh # Chip & board used for compilation # (can be overriden by adding CHIP=chip and BOARD=board to the command-line) -BOARD_FILE_ROOT = bsp_linux +BOARD_FILE_ROOT = bsp_q7s BOARD = linux OS_FSFW = linux CUSTOM_DEFINES += -D$(OS_FSFW) diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index cfc33db9..d4e58b99 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -1,6 +1,5 @@ -#include -#include - +#include +#include #include #include #include diff --git a/bsp_linux/CMakeLists.txt b/bsp_q7s/CMakeLists.txt similarity index 100% rename from bsp_linux/CMakeLists.txt rename to bsp_q7s/CMakeLists.txt diff --git a/bsp_linux/InitMission.cpp b/bsp_q7s/InitMission.cpp similarity index 96% rename from bsp_linux/InitMission.cpp rename to bsp_q7s/InitMission.cpp index c50a1d38..94892adf 100644 --- a/bsp_linux/InitMission.cpp +++ b/bsp_q7s/InitMission.cpp @@ -1,5 +1,6 @@ -#include -#include +#include "InitMission.h" +#include "ObjectFactory.h" +#include #include #include @@ -8,8 +9,6 @@ #include #include #include -#include -#include #include #include @@ -144,7 +143,7 @@ void InitMission::initTasks(){ } -#if ADD_TEST_CODE == 1 +#if OBSW_ADD_TEST_CODE == 1 // FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()-> // createFixedTimeslotTask("PST_TEST_TASK", 10, // PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); @@ -172,7 +171,7 @@ void InitMission::initTasks(){ // P60DockTask->startTask(); -#if ADD_TEST_CODE == 1 +#if OBSW_ADD_TEST_CODE == 1 // TestTimeslotTask->startTask(); #endif sif::info << "Tasks started.." << std::endl; diff --git a/bsp_q7s/InitMission.h b/bsp_q7s/InitMission.h new file mode 100644 index 00000000..89d65ada --- /dev/null +++ b/bsp_q7s/InitMission.h @@ -0,0 +1,9 @@ +#ifndef BSP_Q7S_INITMISSION_H_ +#define BSP_Q7S_INITMISSION_H_ + +namespace InitMission { +void initMission(); +void initTasks(); +}; + +#endif /* BSP_Q7S_INITMISSION_H_ */ diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp new file mode 100644 index 00000000..86c0f068 --- /dev/null +++ b/bsp_q7s/ObjectFactory.cpp @@ -0,0 +1,77 @@ +#include "ObjectFactory.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +void Factory::setStaticFrameworkObjectIds() { + PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; + PusServiceBase::packetDestination = objects::TM_FUNNEL; + + CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; + CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; + + TmFunnel::downlinkDestination = objects::UDP_BRIDGE; + // No storage object for now. + TmFunnel::storageDestination = objects::NO_OBJECT; + + LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; + + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + TmPacketStored::timeStamperId = objects::TIME_STAMPER; +} + + + +void ObjectFactory::produce(){ + Factory::setStaticFrameworkObjectIds(); + ObjectFactory::produceGenericObjects(); + + /* Cookies */ + CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, + addresses::P60DOCK); + CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, + addresses::PDU1); + CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, + addresses::PDU2); + CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, + addresses::ACU); + + /* Communication interfaces */ + new CspComIF(objects::CSP_COM_IF); + + /* Device Handler */ + new GomspaceDeviceHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, + p60DockCspCookie, P60Dock::MAX_CONFIGTABLE_ADDRESS, + P60Dock::MAX_HKTABLE_ADDRESS); + new GomspaceDeviceHandler(objects::PDU1_HANDLER, objects::CSP_COM_IF, + pdu1CspCookie, PDU::MAX_CONFIGTABLE_ADDRESS, + PDU::MAX_HKTABLE_ADDRESS); + new GomspaceDeviceHandler(objects::PDU2_HANDLER, objects::CSP_COM_IF, + pdu2CspCookie, PDU::MAX_CONFIGTABLE_ADDRESS, + PDU::MAX_HKTABLE_ADDRESS); + new GomspaceDeviceHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, + acuCspCookie, ACU::MAX_CONFIGTABLE_ADDRESS, + ACU::MAX_HKTABLE_ADDRESS); + + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, + objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); +} diff --git a/bsp_q7s/ObjectFactory.h b/bsp_q7s/ObjectFactory.h new file mode 100644 index 00000000..5e3358ae --- /dev/null +++ b/bsp_q7s/ObjectFactory.h @@ -0,0 +1,10 @@ +#ifndef BSP_Q7S_OBJECTFACTORY_H_ +#define BSP_Q7S_OBJECTFACTORY_H_ + + +namespace ObjectFactory { + void setStatics(); + void produce(); +}; + +#endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/bsp_linux/boardconfig/CMakeLists.txt b/bsp_q7s/boardconfig/CMakeLists.txt similarity index 100% rename from bsp_linux/boardconfig/CMakeLists.txt rename to bsp_q7s/boardconfig/CMakeLists.txt diff --git a/bsp_linux/boardconfig/etl_profile.h b/bsp_q7s/boardconfig/etl_profile.h similarity index 100% rename from bsp_linux/boardconfig/etl_profile.h rename to bsp_q7s/boardconfig/etl_profile.h diff --git a/bsp_linux/boardconfig/gcov.h b/bsp_q7s/boardconfig/gcov.h similarity index 100% rename from bsp_linux/boardconfig/gcov.h rename to bsp_q7s/boardconfig/gcov.h diff --git a/bsp_linux/boardconfig/print.c b/bsp_q7s/boardconfig/print.c similarity index 81% rename from bsp_linux/boardconfig/print.c rename to bsp_q7s/boardconfig/print.c index f409ee1b..c501e0b7 100644 --- a/bsp_linux/boardconfig/print.c +++ b/bsp_q7s/boardconfig/print.c @@ -1,4 +1,4 @@ -#include "print.h" +#include #include void printChar(const char* character, bool errStream) { diff --git a/bsp_linux/boardconfig/print.h b/bsp_q7s/boardconfig/print.h similarity index 100% rename from bsp_linux/boardconfig/print.h rename to bsp_q7s/boardconfig/print.h diff --git a/bsp_linux/bsp_linux.mk b/bsp_q7s/bsp_q7s.mk similarity index 100% rename from bsp_linux/bsp_linux.mk rename to bsp_q7s/bsp_q7s.mk diff --git a/bsp_linux/comIF/CspComIF.cpp b/bsp_q7s/comIF/CspComIF.cpp similarity index 99% rename from bsp_linux/comIF/CspComIF.cpp rename to bsp_q7s/comIF/CspComIF.cpp index 83be2864..cf72be94 100644 --- a/bsp_linux/comIF/CspComIF.cpp +++ b/bsp_q7s/comIF/CspComIF.cpp @@ -1,5 +1,6 @@ #include "CspComIF.h" -#include +#include "cookies/CspCookie.h" + #include #include #include diff --git a/bsp_linux/comIF/CspComIF.h b/bsp_q7s/comIF/CspComIF.h similarity index 100% rename from bsp_linux/comIF/CspComIF.h rename to bsp_q7s/comIF/CspComIF.h diff --git a/bsp_linux/comIF/cookies/CspCookie.cpp b/bsp_q7s/comIF/cookies/CspCookie.cpp similarity index 100% rename from bsp_linux/comIF/cookies/CspCookie.cpp rename to bsp_q7s/comIF/cookies/CspCookie.cpp diff --git a/bsp_linux/comIF/cookies/CspCookie.h b/bsp_q7s/comIF/cookies/CspCookie.h similarity index 71% rename from bsp_linux/comIF/cookies/CspCookie.h rename to bsp_q7s/comIF/cookies/CspCookie.h index 128926e5..e877761d 100644 --- a/bsp_linux/comIF/cookies/CspCookie.h +++ b/bsp_q7s/comIF/cookies/CspCookie.h @@ -1,8 +1,8 @@ -#ifndef BSP_LINUX_COMIF_COOKIES_CSPCOOKIE_H_ -#define BSP_LINUX_COMIF_COOKIES_CSPCOOKIE_H_ +#ifndef BSP_Q7S_COMIF_COOKIES_CSPCOOKIE_H_ +#define BSP_Q7S_COMIF_COOKIES_CSPCOOKIE_H_ #include -#include +#include /** * @brief This is the cookie for devices supporting the CSP (CubeSat Space @@ -24,4 +24,4 @@ private: uint8_t cspAddress; }; -#endif /* BSP_LINUX_COMIF_COOKIES_CSPCOOKIE_H_ */ +#endif /* BSP_Q7S_COMIF_COOKIES_CSPCOOKIE_H_ */ diff --git a/bsp_q7s/main.cpp b/bsp_q7s/main.cpp new file mode 100644 index 00000000..49416ae2 --- /dev/null +++ b/bsp_q7s/main.cpp @@ -0,0 +1,29 @@ +#include "InitMission.h" +#include +#include + +#include + +#include + +/** + * @brief This is the main program for the target hardware. + * @return + */ +int main(void) +{ + std::cout << "-- EIVE OBSW --" << std::endl; + std::cout << "-- Compiled for Linux " << " --" << std::endl; + std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." + << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl; + std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; + + InitMission::initMission(); + + for(;;) { + // suspend main thread by sleeping it. + TaskFactory::delayTask(5000); + } +} + + diff --git a/bsp_rpi/CMakeLists.txt b/bsp_rpi/CMakeLists.txt index e2ad16aa..8dd8e6f1 100644 --- a/bsp_rpi/CMakeLists.txt +++ b/bsp_rpi/CMakeLists.txt @@ -1,6 +1,11 @@ target_sources(${TARGET_NAME} PUBLIC - + InitMission.cpp + main.cpp + ObjectFactory.cpp ) +add_subdirectory(boardconfig) + + diff --git a/bsp_rpi/InitMission.cpp b/bsp_rpi/InitMission.cpp new file mode 100644 index 00000000..76918716 --- /dev/null +++ b/bsp_rpi/InitMission.cpp @@ -0,0 +1,158 @@ +#include "InitMission.h" +#include "ObjectFactory.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// This is configured for linux without \cr +#ifdef LINUX +ServiceInterfaceStream sif::debug("DEBUG"); +ServiceInterfaceStream sif::info("INFO"); +ServiceInterfaceStream sif::warning("WARNING"); +ServiceInterfaceStream sif::error("ERROR", false, false, true); +#else +ServiceInterfaceStream sif::debug("DEBUG", true); +ServiceInterfaceStream sif::info("INFO", true); +ServiceInterfaceStream sif::warning("WARNING", true); +ServiceInterfaceStream sif::error("ERROR", true, false, true); +#endif + +ObjectManagerIF *objectManager = nullptr; + +void InitMission::initMission() { + sif::info << "Building global objects.." << std::endl; + /* Instantiate global object manager and also create all objects */ + objectManager = new ObjectManager(ObjectFactory::produce); + sif::info << "Initializing all objects.." << std::endl; + objectManager->initialize(); + + /* This function creates and starts all tasks */ + initTasks(); +} + +void InitMission::initTasks(){ + /* TMTC Distribution */ + PeriodicTaskIF* TmTcDistributor = TaskFactory::instance()-> + createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.100, nullptr); + ReturnValue_t result = TmTcDistributor->addComponent( + objects::CCSDS_PACKET_DISTRIBUTOR); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = TmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = TmTcDistributor->addComponent(objects::TM_FUNNEL); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Object add component failed" << std::endl; + } + + /* UDP bridge */ + PeriodicTaskIF* UdpBridgeTask = TaskFactory::instance()->createPeriodicTask( + "UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.2, nullptr); + result = UdpBridgeTask->addComponent(objects::UDP_BRIDGE); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component UDP Unix Bridge failed" << std::endl; + } + PeriodicTaskIF* UdpPollingTask = TaskFactory::instance()-> + createPeriodicTask("UDP_POLLING", 80, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr); + result = UdpPollingTask->addComponent(objects::UDP_POLLING_TASK); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Add component UDP Polling failed" << std::endl; + } + + /* PUS Services */ + PeriodicTaskIF* PusVerification = TaskFactory::instance()-> + createPeriodicTask("PUS_VERIF_1", 40, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); + result = PusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusEvents = TaskFactory::instance()-> + createPeriodicTask("PUS_VERIF_1", 60, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr); + result = PusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusHighPrio = TaskFactory::instance()-> + createPeriodicTask("PUS_HIGH_PRIO", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.200, nullptr); + result = PusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = PusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusMedPrio = TaskFactory::instance()-> + createPeriodicTask("PUS_HIGH_PRIO", 40, + PeriodicTaskIF::MINIMUM_STACK_SIZE, + 0.8, nullptr); + result = PusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + result = PusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + PeriodicTaskIF* PusLowPrio = TaskFactory::instance()-> + createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, + 1.6, nullptr); + result = PusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); + if(result!=HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + + +#if OBSW_ADD_TEST_CODE == 1 + FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()-> + createFixedTimeslotTask("PST_TEST_TASK", 10, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); + result = pst::pollingSequenceTestFunction(TestTimeslotTask); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::createTasks: Test PST initialization " + << "failed!" << std::endl; + } + +#endif + + //Main thread sleep + sif::info << "Starting tasks.." << std::endl; + TmTcDistributor->startTask(); + UdpBridgeTask->startTask(); + UdpPollingTask->startTask(); + + PusVerification->startTask(); + PusEvents->startTask(); + PusHighPrio->startTask(); + PusMedPrio->startTask(); + PusLowPrio->startTask(); + +#if OBSW_ADD_TEST_CODE == 1 + TestTimeslotTask->startTask(); +#endif + sif::info << "Tasks started.." << std::endl; +} diff --git a/bsp_linux/InitMission.h b/bsp_rpi/InitMission.h similarity index 100% rename from bsp_linux/InitMission.h rename to bsp_rpi/InitMission.h diff --git a/bsp_linux/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp similarity index 100% rename from bsp_linux/ObjectFactory.cpp rename to bsp_rpi/ObjectFactory.cpp diff --git a/bsp_linux/ObjectFactory.h b/bsp_rpi/ObjectFactory.h similarity index 100% rename from bsp_linux/ObjectFactory.h rename to bsp_rpi/ObjectFactory.h diff --git a/bsp_rpi/boardconfig/CMakeLists.txt b/bsp_rpi/boardconfig/CMakeLists.txt new file mode 100644 index 00000000..c32b326d --- /dev/null +++ b/bsp_rpi/boardconfig/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${TARGET_NAME} PRIVATE + print.c +) + +target_include_directories(${TARGET_NAME} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + + + diff --git a/bsp_rpi/boardconfig/etl_profile.h b/bsp_rpi/boardconfig/etl_profile.h new file mode 100644 index 00000000..c35ffb46 --- /dev/null +++ b/bsp_rpi/boardconfig/etl_profile.h @@ -0,0 +1,38 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2019 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ +#ifndef __ETL_PROFILE_H__ +#define __ETL_PROFILE_H__ + +#define ETL_CHECK_PUSH_POP + +#define ETL_CPP11_SUPPORTED 1 +#define ETL_NO_NULLPTR_SUPPORT 0 + +#endif diff --git a/bsp_rpi/boardconfig/gcov.h b/bsp_rpi/boardconfig/gcov.h new file mode 100644 index 00000000..491d24c6 --- /dev/null +++ b/bsp_rpi/boardconfig/gcov.h @@ -0,0 +1,14 @@ +#ifndef LINUX_GCOV_H_ +#define LINUX_GCOV_H_ +#include + +#ifdef GCOV +extern "C" void __gcov_flush(); +#else +void __gcov_flush() { + sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if " + "coverage information is desired.\n" << std::flush; +} +#endif + +#endif /* LINUX_GCOV_H_ */ diff --git a/bsp_rpi/boardconfig/print.c b/bsp_rpi/boardconfig/print.c new file mode 100644 index 00000000..c501e0b7 --- /dev/null +++ b/bsp_rpi/boardconfig/print.c @@ -0,0 +1,14 @@ +#include +#include + +void printChar(const char* character, bool errStream) { + if(errStream) { + putc(*character, stderr); + return; + } + putc(*character, stdout); +} + + + + diff --git a/bsp_rpi/boardconfig/print.h b/bsp_rpi/boardconfig/print.h new file mode 100644 index 00000000..8e7e2e5d --- /dev/null +++ b/bsp_rpi/boardconfig/print.h @@ -0,0 +1,8 @@ +#ifndef HOSTED_BOARDCONFIG_PRINT_H_ +#define HOSTED_BOARDCONFIG_PRINT_H_ + +#include + +void printChar(const char* character, bool errStream); + +#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */ diff --git a/bsp_linux/main.cpp b/bsp_rpi/main.cpp similarity index 100% rename from bsp_linux/main.cpp rename to bsp_rpi/main.cpp diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/buildsystem/cmake/HardwareOsPreConfig.cmake index b8a11f97..4ead6540 100644 --- a/buildsystem/cmake/HardwareOsPreConfig.cmake +++ b/buildsystem/cmake/HardwareOsPreConfig.cmake @@ -10,7 +10,6 @@ elseif(${OS_FSFW} STREQUAL rtems) elseif(${OS_FSFW} STREQUAL linux) add_definitions(-DUNIX -DLINUX) find_package(Threads REQUIRED) - set(BSP_PATH "bsp_linux") # Hosted else() set(BSP_PATH "bsp_hosted") @@ -54,8 +53,10 @@ endif() if(TGT_BSP) - if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/q7s") - # set(BSP_PATH "bsp_linux") + if (${TGT_BSP} MATCHES "arm/raspberrypi") + set(BSP_PATH "bsp_rpi") + elseif(${TGT_BSP} MATCHES "arm/q7s") + set(BSP_PATH "bsp_q7s") else() message(WARNING "CMake not configured for this target!") message(FATAL_ERROR "Target: ${TGT_BSP}!") diff --git a/libcsp/CMakeLists.txt b/libcsp/CMakeLists.txt new file mode 100644 index 00000000..5c9f7677 --- /dev/null +++ b/libcsp/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.13) + +set(LIB_CSP_NAME libcsp) + +add_library(${LIB_CSP_NAME}) + +add_subdirectory(src) +add_subdirectory(include) + +target_include_directories(${LIB_CSP_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) \ No newline at end of file diff --git a/libcsp/include/CMakeLists.txt b/libcsp/include/CMakeLists.txt new file mode 100644 index 00000000..94fee196 --- /dev/null +++ b/libcsp/include/CMakeLists.txt @@ -0,0 +1,7 @@ +target_include_directories(${LIB_CSP_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/csp + ${CMAKE_CURRENT_SOURCE_DIR}/csp/crypto +) + + diff --git a/libcsp/src/CMakeLists.txt b/libcsp/src/CMakeLists.txt new file mode 100644 index 00000000..5d1bfbf5 --- /dev/null +++ b/libcsp/src/CMakeLists.txt @@ -0,0 +1,25 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_bridge.c + csp_buffer.c + csp_conn.c + csp_crc32.c + csp_debug.c + csp_dedup.c + csp_endian.c + csp_hex_dump.c + csp_pflist.c + csp_io.c + csp_port.c + csp_promisc.c + csp_qfifo.c + csp_route.c + csp_service_handler.c + csp_services.c + csp_sfp.c +) + +add_subdirectory(drivers) +add_subdirectory(crypto) +add_subdirectory(interfaces) +add_subdirectory(rtable) + diff --git a/libcsp/src/arch/posix/CMakeLists.txt b/libcsp/src/arch/posix/CMakeLists.txt new file mode 100644 index 00000000..856040bc --- /dev/null +++ b/libcsp/src/arch/posix/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_malloc.c + csp_queue.c + csp_sempahore.c + csp_system.c + csp_thread.c + csp_time.c + pthread_queue.c +) diff --git a/libcsp/src/crypto/CMakeLists.txt b/libcsp/src/crypto/CMakeLists.txt new file mode 100644 index 00000000..19cb878a --- /dev/null +++ b/libcsp/src/crypto/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_hmac.c + csp_sha1.c + csp_xtea.c +) diff --git a/libcsp/src/drivers/CMakeLists.txt b/libcsp/src/drivers/CMakeLists.txt new file mode 100644 index 00000000..e2dd440b --- /dev/null +++ b/libcsp/src/drivers/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(can) diff --git a/libcsp/src/drivers/can/CMakeLists.txt b/libcsp/src/drivers/can/CMakeLists.txt new file mode 100644 index 00000000..d291fccc --- /dev/null +++ b/libcsp/src/drivers/can/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + can_socketcan.c +) diff --git a/libcsp/src/interfaces/CMakeLists.txt b/libcsp/src/interfaces/CMakeLists.txt new file mode 100644 index 00000000..33f779e3 --- /dev/null +++ b/libcsp/src/interfaces/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_if_can_pbuf.c + csp_if_can.c + csp_if_i2c.c + csp_if_kiss.c + csp_if_lo.c +) diff --git a/libcsp/src/rtable/CMakeLists.txt b/libcsp/src/rtable/CMakeLists.txt new file mode 100644 index 00000000..101f4fb9 --- /dev/null +++ b/libcsp/src/rtable/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_rtable_cidr.c +) diff --git a/libcsp/src/transport/CMakeLists.txt b/libcsp/src/transport/CMakeLists.txt new file mode 100644 index 00000000..c509b755 --- /dev/null +++ b/libcsp/src/transport/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${LIB_CSP_NAME} PRIVATE + csp_rdp.c + csp_udp.c +) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 24572218..b708f964 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,9 +1,9 @@ #include "GenericFactory.h" -#include -#include -#include + #include -#include + +#include +#include #include #include @@ -21,13 +21,9 @@ #include #include #include -#include -#include -#include "mission/devices/GomspaceDeviceHandler.h" -#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" -#if ADD_TEST_CODE == 1 -//#include +#if OBSW_ADD_TEST_CODE == 1 + #include #endif void ObjectFactory::produceGenericObjects() { @@ -84,35 +80,8 @@ void ObjectFactory::produceGenericObjects() { new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_200); - /* Cookies */ - CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, - addresses::P60DOCK); - CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, - addresses::PDU1); - CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, - addresses::PDU2); - CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, - addresses::ACU); - - /* Communication interfaces */ - new CspComIF(objects::CSP_COM_IF); - - /* Device Handler */ - new GomspaceDeviceHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, - p60DockCspCookie, P60Dock::MAX_CONFIGTABLE_ADDRESS, - P60Dock::MAX_HKTABLE_ADDRESS); - new GomspaceDeviceHandler(objects::PDU1_HANDLER, objects::CSP_COM_IF, - pdu1CspCookie, PDU::MAX_CONFIGTABLE_ADDRESS, - PDU::MAX_HKTABLE_ADDRESS); - new GomspaceDeviceHandler(objects::PDU2_HANDLER, objects::CSP_COM_IF, - pdu2CspCookie, PDU::MAX_CONFIGTABLE_ADDRESS, - PDU::MAX_HKTABLE_ADDRESS); - new GomspaceDeviceHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, - acuCspCookie, ACU::MAX_CONFIGTABLE_ADDRESS, - ACU::MAX_HKTABLE_ADDRESS); - /* Test Device Handler */ -#if ADD_TEST_CODE == 1 -// new TestTask(objects::TEST_TASK); +#if OBSW_ADD_TEST_CODE == 1 + new TestTask(objects::TEST_TASK); #endif } -- 2.43.0 From dd37efd34de639f11eedb30171087be59ca96a02 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:14:11 +0100 Subject: [PATCH 13/23] fsfw points to eive/develop now --- CMakeLists.txt | 7 +++++++ bsp_q7s/CMakeLists.txt | 1 + bsp_q7s/comIF/CMakeLists.txt | 8 ++++++++ fsfw | 2 +- libcsp/include/CMakeLists.txt | 4 ++++ libcsp/src/CMakeLists.txt | 4 +++- libcsp/src/arch/CMakeLists.txt | 3 +++ libcsp/src/arch/posix/CMakeLists.txt | 2 +- mission/devices/CMakeLists.txt | 1 + 9 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 bsp_q7s/comIF/CMakeLists.txt create mode 100644 libcsp/src/arch/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a27a5cc..7d631d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) # Set names and variables set(TARGET_NAME ${CMAKE_PROJECT_NAME}) set(LIB_FSFW_NAME fsfw) +set(LIB_CSP_NAME libcsp) # Set path names set(FSFW_PATH fsfw) @@ -91,6 +92,12 @@ target_link_libraries(${TARGET_NAME} PRIVATE ${LIB_OS_NAME} ) +if(ADD_CSP_LIB) + target_link_libraries(${TARGET_NAME} PRIVATE + ${LIB_CSP_NAME} + ) +endif() + # Add include paths for all sources. target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 8df43ca7..004a2fcd 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources(${TARGET_NAME} PUBLIC ) add_subdirectory(boardconfig) +add_subdirectory(comIF) diff --git a/bsp_q7s/comIF/CMakeLists.txt b/bsp_q7s/comIF/CMakeLists.txt new file mode 100644 index 00000000..1652702c --- /dev/null +++ b/bsp_q7s/comIF/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PRIVATE + cookies/CspCookie.cpp + CspComIF.cpp +) + + + + diff --git a/fsfw b/fsfw index 5b9c0e01..8ef6283b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5b9c0e013e35ab1353d402c6fa2cd75866e3afa5 +Subproject commit 8ef6283bf4f5cf5d12131c48365a753825fea637 diff --git a/libcsp/include/CMakeLists.txt b/libcsp/include/CMakeLists.txt index 94fee196..cc80ebb5 100644 --- a/libcsp/include/CMakeLists.txt +++ b/libcsp/include/CMakeLists.txt @@ -4,4 +4,8 @@ target_include_directories(${LIB_CSP_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/csp/crypto ) +target_include_directories(${LIB_CSP_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + diff --git a/libcsp/src/CMakeLists.txt b/libcsp/src/CMakeLists.txt index 5d1bfbf5..39c67877 100644 --- a/libcsp/src/CMakeLists.txt +++ b/libcsp/src/CMakeLists.txt @@ -7,7 +7,7 @@ target_sources(${LIB_CSP_NAME} PRIVATE csp_dedup.c csp_endian.c csp_hex_dump.c - csp_pflist.c + csp_iflist.c csp_io.c csp_port.c csp_promisc.c @@ -22,4 +22,6 @@ add_subdirectory(drivers) add_subdirectory(crypto) add_subdirectory(interfaces) add_subdirectory(rtable) +add_subdirectory(transport) +add_subdirectory(arch) diff --git a/libcsp/src/arch/CMakeLists.txt b/libcsp/src/arch/CMakeLists.txt new file mode 100644 index 00000000..aa0e4ca6 --- /dev/null +++ b/libcsp/src/arch/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(posix) + + diff --git a/libcsp/src/arch/posix/CMakeLists.txt b/libcsp/src/arch/posix/CMakeLists.txt index 856040bc..6bf13773 100644 --- a/libcsp/src/arch/posix/CMakeLists.txt +++ b/libcsp/src/arch/posix/CMakeLists.txt @@ -1,7 +1,7 @@ target_sources(${LIB_CSP_NAME} PRIVATE csp_malloc.c csp_queue.c - csp_sempahore.c + csp_semaphore.c csp_system.c csp_thread.c csp_time.c diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index f01df0e1..c751800f 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -3,6 +3,7 @@ target_sources(${TARGET_NAME} PUBLIC GyroL3GD20Handler.cpp MGMHandlerLIS3MDL.cpp MGMHandlerRM3100.cpp + GomspaceDeviceHandler.cpp ) -- 2.43.0 From df355652e0892d6a91004e3c376a0d1ed37f5238 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:21:52 +0100 Subject: [PATCH 14/23] restructured build system support --- CMakeLists.txt | 2 +- {buildsystem/cmake => cmake}/BuildType.cmake | 0 {buildsystem/cmake => cmake}/HardwareOsPostConfig.cmake | 0 {buildsystem/cmake => cmake}/HardwareOsPreConfig.cmake | 0 {buildsystem/cmake => cmake}/PreProjectConfig.cmake | 0 {buildsystem/cmake => cmake}/Q7SCrossCompileConfig.cmake | 0 {buildsystem/cmake => cmake}/RPiCrossCompileConfig.cmake | 0 .../scripts/.idea/inspectionProfiles/profiles_settings.xml | 0 {buildsystem/cmake => cmake}/scripts/.idea/misc.xml | 0 {buildsystem/cmake => cmake}/scripts/.idea/modules.xml | 0 {buildsystem/cmake => cmake}/scripts/.idea/scripts.iml | 0 {buildsystem/cmake => cmake}/scripts/.idea/vcs.xml | 0 {buildsystem/cmake => cmake}/scripts/.idea/workspace.xml | 0 .../cmake => cmake}/scripts/Host/create_cmake_debug_cfg.sh | 0 .../cmake => cmake}/scripts/Host/create_cmake_release_cfg.sh | 0 .../cmake => cmake}/scripts/Host/create_cmake_relwithdeb_cfg.sh | 0 .../cmake => cmake}/scripts/Host/create_cmake_size_cfg.sh | 0 .../cmake => cmake}/scripts/Linux/create_cmake_debug_cfg.sh | 0 .../cmake => cmake}/scripts/Linux/create_cmake_release_cfg.sh | 0 .../scripts/Linux/create_cmake_relwithdeb_cfg.sh | 0 .../cmake => cmake}/scripts/Linux/create_cmake_size_cfg.sh | 0 .../cmake => cmake}/scripts/Q7S/create_cmake_debug_cfg.sh | 0 .../cmake => cmake}/scripts/Q7S/create_cmake_release_cfg.sh | 0 .../cmake => cmake}/scripts/Q7S/create_cmake_relwithdeb_cfg.sh | 0 .../cmake => cmake}/scripts/RPi/create_cmake_debug_cfg.sh | 0 .../cmake => cmake}/scripts/RPi/create_cmake_release_cfg.sh | 0 .../cmake => cmake}/scripts/RPi/create_cmake_relwithdeb_cfg.sh | 0 .../cmake => cmake}/scripts/RPi/create_cmake_size_cfg.sh | 0 {buildsystem/cmake => cmake}/scripts/RPi/rpi_path_helper.sh | 0 {buildsystem/cmake => cmake}/scripts/RPi/rpi_path_helper_win.sh | 0 {buildsystem/cmake => cmake}/scripts/cmake_build_config.py | 0 31 files changed, 1 insertion(+), 1 deletion(-) rename {buildsystem/cmake => cmake}/BuildType.cmake (100%) rename {buildsystem/cmake => cmake}/HardwareOsPostConfig.cmake (100%) rename {buildsystem/cmake => cmake}/HardwareOsPreConfig.cmake (100%) rename {buildsystem/cmake => cmake}/PreProjectConfig.cmake (100%) rename {buildsystem/cmake => cmake}/Q7SCrossCompileConfig.cmake (100%) rename {buildsystem/cmake => cmake}/RPiCrossCompileConfig.cmake (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/inspectionProfiles/profiles_settings.xml (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/misc.xml (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/modules.xml (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/scripts.iml (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/vcs.xml (100%) rename {buildsystem/cmake => cmake}/scripts/.idea/workspace.xml (100%) rename {buildsystem/cmake => cmake}/scripts/Host/create_cmake_debug_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Host/create_cmake_release_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Host/create_cmake_relwithdeb_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Host/create_cmake_size_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Linux/create_cmake_debug_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Linux/create_cmake_release_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Linux/create_cmake_relwithdeb_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Linux/create_cmake_size_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Q7S/create_cmake_debug_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Q7S/create_cmake_release_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/Q7S/create_cmake_relwithdeb_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/create_cmake_debug_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/create_cmake_release_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/create_cmake_relwithdeb_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/create_cmake_size_cfg.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/rpi_path_helper.sh (100%) rename {buildsystem/cmake => cmake}/scripts/RPi/rpi_path_helper_win.sh (100%) rename {buildsystem/cmake => cmake}/scripts/cmake_build_config.py (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d631d3b..1be2bbdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.13) # set(CMAKE_VERBOSE TRUE) -set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildsystem/cmake") +set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") if(NOT OS_FSFW) set(OS_FSFW host CACHE STRING "OS for the FSFW.") diff --git a/buildsystem/cmake/BuildType.cmake b/cmake/BuildType.cmake similarity index 100% rename from buildsystem/cmake/BuildType.cmake rename to cmake/BuildType.cmake diff --git a/buildsystem/cmake/HardwareOsPostConfig.cmake b/cmake/HardwareOsPostConfig.cmake similarity index 100% rename from buildsystem/cmake/HardwareOsPostConfig.cmake rename to cmake/HardwareOsPostConfig.cmake diff --git a/buildsystem/cmake/HardwareOsPreConfig.cmake b/cmake/HardwareOsPreConfig.cmake similarity index 100% rename from buildsystem/cmake/HardwareOsPreConfig.cmake rename to cmake/HardwareOsPreConfig.cmake diff --git a/buildsystem/cmake/PreProjectConfig.cmake b/cmake/PreProjectConfig.cmake similarity index 100% rename from buildsystem/cmake/PreProjectConfig.cmake rename to cmake/PreProjectConfig.cmake diff --git a/buildsystem/cmake/Q7SCrossCompileConfig.cmake b/cmake/Q7SCrossCompileConfig.cmake similarity index 100% rename from buildsystem/cmake/Q7SCrossCompileConfig.cmake rename to cmake/Q7SCrossCompileConfig.cmake diff --git a/buildsystem/cmake/RPiCrossCompileConfig.cmake b/cmake/RPiCrossCompileConfig.cmake similarity index 100% rename from buildsystem/cmake/RPiCrossCompileConfig.cmake rename to cmake/RPiCrossCompileConfig.cmake diff --git a/buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml b/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml similarity index 100% rename from buildsystem/cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml rename to cmake/scripts/.idea/inspectionProfiles/profiles_settings.xml diff --git a/buildsystem/cmake/scripts/.idea/misc.xml b/cmake/scripts/.idea/misc.xml similarity index 100% rename from buildsystem/cmake/scripts/.idea/misc.xml rename to cmake/scripts/.idea/misc.xml diff --git a/buildsystem/cmake/scripts/.idea/modules.xml b/cmake/scripts/.idea/modules.xml similarity index 100% rename from buildsystem/cmake/scripts/.idea/modules.xml rename to cmake/scripts/.idea/modules.xml diff --git a/buildsystem/cmake/scripts/.idea/scripts.iml b/cmake/scripts/.idea/scripts.iml similarity index 100% rename from buildsystem/cmake/scripts/.idea/scripts.iml rename to cmake/scripts/.idea/scripts.iml diff --git a/buildsystem/cmake/scripts/.idea/vcs.xml b/cmake/scripts/.idea/vcs.xml similarity index 100% rename from buildsystem/cmake/scripts/.idea/vcs.xml rename to cmake/scripts/.idea/vcs.xml diff --git a/buildsystem/cmake/scripts/.idea/workspace.xml b/cmake/scripts/.idea/workspace.xml similarity index 100% rename from buildsystem/cmake/scripts/.idea/workspace.xml rename to cmake/scripts/.idea/workspace.xml diff --git a/buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh b/cmake/scripts/Host/create_cmake_debug_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Host/create_cmake_debug_cfg.sh rename to cmake/scripts/Host/create_cmake_debug_cfg.sh diff --git a/buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh b/cmake/scripts/Host/create_cmake_release_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Host/create_cmake_release_cfg.sh rename to cmake/scripts/Host/create_cmake_release_cfg.sh diff --git a/buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/Host/create_cmake_relwithdeb_cfg.sh diff --git a/buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh b/cmake/scripts/Host/create_cmake_size_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Host/create_cmake_size_cfg.sh rename to cmake/scripts/Host/create_cmake_size_cfg.sh diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh b/cmake/scripts/Linux/create_cmake_debug_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Linux/create_cmake_debug_cfg.sh rename to cmake/scripts/Linux/create_cmake_debug_cfg.sh diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh b/cmake/scripts/Linux/create_cmake_release_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Linux/create_cmake_release_cfg.sh rename to cmake/scripts/Linux/create_cmake_release_cfg.sh diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh diff --git a/buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh b/cmake/scripts/Linux/create_cmake_size_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Linux/create_cmake_size_cfg.sh rename to cmake/scripts/Linux/create_cmake_size_cfg.sh diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh b/cmake/scripts/Q7S/create_cmake_debug_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Q7S/create_cmake_debug_cfg.sh rename to cmake/scripts/Q7S/create_cmake_debug_cfg.sh diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh b/cmake/scripts/Q7S/create_cmake_release_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Q7S/create_cmake_release_cfg.sh rename to cmake/scripts/Q7S/create_cmake_release_cfg.sh diff --git a/buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/Q7S/create_cmake_relwithdeb_cfg.sh diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh b/cmake/scripts/RPi/create_cmake_debug_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/create_cmake_debug_cfg.sh rename to cmake/scripts/RPi/create_cmake_debug_cfg.sh diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh b/cmake/scripts/RPi/create_cmake_release_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/create_cmake_release_cfg.sh rename to cmake/scripts/RPi/create_cmake_release_cfg.sh diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/RPi/create_cmake_relwithdeb_cfg.sh diff --git a/buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh b/cmake/scripts/RPi/create_cmake_size_cfg.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/create_cmake_size_cfg.sh rename to cmake/scripts/RPi/create_cmake_size_cfg.sh diff --git a/buildsystem/cmake/scripts/RPi/rpi_path_helper.sh b/cmake/scripts/RPi/rpi_path_helper.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/rpi_path_helper.sh rename to cmake/scripts/RPi/rpi_path_helper.sh diff --git a/buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh b/cmake/scripts/RPi/rpi_path_helper_win.sh similarity index 100% rename from buildsystem/cmake/scripts/RPi/rpi_path_helper_win.sh rename to cmake/scripts/RPi/rpi_path_helper_win.sh diff --git a/buildsystem/cmake/scripts/cmake_build_config.py b/cmake/scripts/cmake_build_config.py similarity index 100% rename from buildsystem/cmake/scripts/cmake_build_config.py rename to cmake/scripts/cmake_build_config.py -- 2.43.0 From 455ad12fec4175461135e2c6d9ea7124ef8ccee7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:28:38 +0100 Subject: [PATCH 15/23] updated project files --- misc/eclipse/.cproject | 309 +++++++++++++++++- misc/eclipse/make/.cproject | 257 +++++++++++++++ misc/eclipse/make/.project | 27 ++ .../Host/eive-linux-host-debug.launch | 0 .../Host/eive-linux-host-release.launch | 0 .../{ => make}/Host/eive-mingw-debug.launch | 0 .../{ => make}/Host/eive-mingw-release.launch | 0 7 files changed, 589 insertions(+), 4 deletions(-) create mode 100644 misc/eclipse/make/.cproject create mode 100644 misc/eclipse/make/.project rename misc/eclipse/{ => make}/Host/eive-linux-host-debug.launch (100%) rename misc/eclipse/{ => make}/Host/eive-linux-host-release.launch (100%) rename misc/eclipse/{ => make}/Host/eive-mingw-debug.launch (100%) rename misc/eclipse/{ => make}/Host/eive-mingw-release.launch (100%) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 6a50d831..80fd68eb 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -15,11 +15,11 @@ - + - + @@ -45,6 +45,9 @@ + + + @@ -67,7 +70,7 @@ - + @@ -93,6 +96,9 @@ + + + @@ -115,7 +121,7 @@ - + + + + @@ -201,6 +210,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -220,6 +520,7 @@ + diff --git a/misc/eclipse/make/.cproject b/misc/eclipse/make/.cproject new file mode 100644 index 00000000..6a50d831 --- /dev/null +++ b/misc/eclipse/make/.cproject @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/misc/eclipse/make/.project b/misc/eclipse/make/.project new file mode 100644 index 00000000..906c567f --- /dev/null +++ b/misc/eclipse/make/.project @@ -0,0 +1,27 @@ + + + eive_obsw + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/misc/eclipse/Host/eive-linux-host-debug.launch b/misc/eclipse/make/Host/eive-linux-host-debug.launch similarity index 100% rename from misc/eclipse/Host/eive-linux-host-debug.launch rename to misc/eclipse/make/Host/eive-linux-host-debug.launch diff --git a/misc/eclipse/Host/eive-linux-host-release.launch b/misc/eclipse/make/Host/eive-linux-host-release.launch similarity index 100% rename from misc/eclipse/Host/eive-linux-host-release.launch rename to misc/eclipse/make/Host/eive-linux-host-release.launch diff --git a/misc/eclipse/Host/eive-mingw-debug.launch b/misc/eclipse/make/Host/eive-mingw-debug.launch similarity index 100% rename from misc/eclipse/Host/eive-mingw-debug.launch rename to misc/eclipse/make/Host/eive-mingw-debug.launch diff --git a/misc/eclipse/Host/eive-mingw-release.launch b/misc/eclipse/make/Host/eive-mingw-release.launch similarity index 100% rename from misc/eclipse/Host/eive-mingw-release.launch rename to misc/eclipse/make/Host/eive-mingw-release.launch -- 2.43.0 From bc5f340e2b33643fd09484db6ab93c19bee55f2e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:29:38 +0100 Subject: [PATCH 16/23] renamed launch configs for clear distrinction --- .../Host/eive-linux-host-debug-make.launch | 33 +++++++++++++++++++ .../Host/eive-linux-host-release-make.launch | 33 +++++++++++++++++++ .../eclipse/Host/eive-mingw-debug-make.launch | 33 +++++++++++++++++++ .../Host/eive-mingw-release-make.launch | 33 +++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 misc/eclipse/Host/eive-linux-host-debug-make.launch create mode 100644 misc/eclipse/Host/eive-linux-host-release-make.launch create mode 100644 misc/eclipse/Host/eive-mingw-debug-make.launch create mode 100644 misc/eclipse/Host/eive-mingw-release-make.launch diff --git a/misc/eclipse/Host/eive-linux-host-debug-make.launch b/misc/eclipse/Host/eive-linux-host-debug-make.launch new file mode 100644 index 00000000..f5ab1ac7 --- /dev/null +++ b/misc/eclipse/Host/eive-linux-host-debug-make.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/eclipse/Host/eive-linux-host-release-make.launch b/misc/eclipse/Host/eive-linux-host-release-make.launch new file mode 100644 index 00000000..7548f831 --- /dev/null +++ b/misc/eclipse/Host/eive-linux-host-release-make.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/eclipse/Host/eive-mingw-debug-make.launch b/misc/eclipse/Host/eive-mingw-debug-make.launch new file mode 100644 index 00000000..4ab7b736 --- /dev/null +++ b/misc/eclipse/Host/eive-mingw-debug-make.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/misc/eclipse/Host/eive-mingw-release-make.launch b/misc/eclipse/Host/eive-mingw-release-make.launch new file mode 100644 index 00000000..da2f47a9 --- /dev/null +++ b/misc/eclipse/Host/eive-mingw-release-make.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.43.0 From dd211f23cbe0cf99c65d317a621ee5441e366924 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:31:10 +0100 Subject: [PATCH 17/23] added cmake launch config --- misc/eclipse/Host/eive-mingw-debug-cmake.launch | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 misc/eclipse/Host/eive-mingw-debug-cmake.launch diff --git a/misc/eclipse/Host/eive-mingw-debug-cmake.launch b/misc/eclipse/Host/eive-mingw-debug-cmake.launch new file mode 100644 index 00000000..e69de29b -- 2.43.0 From 3f41fc181c106b6b922a4965b4d42ca1327918ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:37:39 +0100 Subject: [PATCH 18/23] include fix --- CMakeLists.txt | 1 + bsp_hosted/InitMission.cpp | 9 ++--- .../fsfwconfig/events/subsystemIdRanges.h | 2 +- .../Host/eive-mingw-release-cmake.launch | 33 +++++++++++++++++++ mission/core/GenericFactory.cpp | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 misc/eclipse/Host/eive-mingw-release-cmake.launch diff --git a/CMakeLists.txt b/CMakeLists.txt index 1be2bbdc..1786f1af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ if(TGT_BSP) set(ADD_CSP_LIB TRUE) endif() else() + # Required by FSFW library set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") endif() diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index d4e58b99..39dcafff 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -1,5 +1,8 @@ -#include -#include +#include "InitMission.h" +#include "ObjectFactory.h" + +#include + #include #include #include @@ -7,8 +10,6 @@ #include #include #include -#include -#include #include diff --git a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h index 1128b26b..51534f60 100644 --- a/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h +++ b/bsp_hosted/fsfwconfig/events/subsystemIdRanges.h @@ -10,7 +10,7 @@ */ namespace SUBSYSTEM_ID { enum: uint8_t { - SUBSYSTE_ID_START = FW_SUBSYSTEM_ID_RANGE, + SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE, PUS_SERVICE_2, PUS_SERVICE_3, PUS_SERVICE_5, diff --git a/misc/eclipse/Host/eive-mingw-release-cmake.launch b/misc/eclipse/Host/eive-mingw-release-cmake.launch new file mode 100644 index 00000000..0a5fbd71 --- /dev/null +++ b/misc/eclipse/Host/eive-mingw-release-cmake.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index b708f964..e0e857da 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,6 +1,6 @@ #include "GenericFactory.h" -#include +#include #include #include -- 2.43.0 From 7afd80d0abb047794d345cc1569aff7f0df46a71 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 14:39:03 +0100 Subject: [PATCH 19/23] includes formal correction --- mission/core/GenericFactory.cpp | 2 +- mission/devices/devicedefinitions/GomSpacePackets.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index e0e857da..b3866cb0 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,6 +1,6 @@ #include "GenericFactory.h" -#include +#include #include #include diff --git a/mission/devices/devicedefinitions/GomSpacePackets.h b/mission/devices/devicedefinitions/GomSpacePackets.h index 6c3509f8..24bb67e7 100644 --- a/mission/devices/devicedefinitions/GomSpacePackets.h +++ b/mission/devices/devicedefinitions/GomSpacePackets.h @@ -1,10 +1,10 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEPACKETS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEPACKETS_H_ -#include "fsfw/serialize/SerialBufferAdapter.h" -#include "fsfw/serialize/SerializeElement.h" -#include "fsfw/serialize/SerialLinkedListAdapter.h" -#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include +#include +#include +#include namespace GOMSPACE{ static const uint16_t IGNORE_CHECKSUM = 0xbb0; -- 2.43.0 From a8edb349319bf47c2a356be8f87f5f95477d6f7c Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 29 Dec 2020 14:53:34 +0100 Subject: [PATCH 20/23] some fixes, launch configs added --- cmake/HardwareOsPreConfig.cmake | 2 ++ cmake/scripts/Linux/create_cmake_debug_cfg.sh | 0 .../scripts/Linux/create_cmake_release_cfg.sh | 0 .../Linux/create_cmake_relwithdeb_cfg.sh | 0 cmake/scripts/Linux/create_cmake_size_cfg.sh | 0 .../Host/eive-linux-host-debug-cmake.launch | 33 +++++++++++++++++++ 6 files changed, 35 insertions(+) mode change 100644 => 100755 cmake/scripts/Linux/create_cmake_debug_cfg.sh mode change 100644 => 100755 cmake/scripts/Linux/create_cmake_release_cfg.sh mode change 100644 => 100755 cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh mode change 100644 => 100755 cmake/scripts/Linux/create_cmake_size_cfg.sh create mode 100644 misc/eclipse/Host/eive-linux-host-debug-cmake.launch diff --git a/cmake/HardwareOsPreConfig.cmake b/cmake/HardwareOsPreConfig.cmake index 4ead6540..ab5c16fd 100644 --- a/cmake/HardwareOsPreConfig.cmake +++ b/cmake/HardwareOsPreConfig.cmake @@ -61,6 +61,8 @@ if(TGT_BSP) message(WARNING "CMake not configured for this target!") message(FATAL_ERROR "Target: ${TGT_BSP}!") endif() +else() + set(BSP_PATH "bsp_hosted") endif() set(BSP_PATH ${BSP_PATH} PARENT_SCOPE) diff --git a/cmake/scripts/Linux/create_cmake_debug_cfg.sh b/cmake/scripts/Linux/create_cmake_debug_cfg.sh old mode 100644 new mode 100755 diff --git a/cmake/scripts/Linux/create_cmake_release_cfg.sh b/cmake/scripts/Linux/create_cmake_release_cfg.sh old mode 100644 new mode 100755 diff --git a/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/Linux/create_cmake_relwithdeb_cfg.sh old mode 100644 new mode 100755 diff --git a/cmake/scripts/Linux/create_cmake_size_cfg.sh b/cmake/scripts/Linux/create_cmake_size_cfg.sh old mode 100644 new mode 100755 diff --git a/misc/eclipse/Host/eive-linux-host-debug-cmake.launch b/misc/eclipse/Host/eive-linux-host-debug-cmake.launch new file mode 100644 index 00000000..e79e2e8d --- /dev/null +++ b/misc/eclipse/Host/eive-linux-host-debug-cmake.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.43.0 From 326c595bbeb3b7ea02d537b0ac65b966c0c3e72a Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 29 Dec 2020 14:55:10 +0100 Subject: [PATCH 21/23] deleted make luanch config --- .../Host/eive-linux-host-debug-make.launch | 33 ------------------- .../Host/eive-linux-host-release-make.launch | 33 ------------------- .../eclipse/Host/eive-mingw-debug-make.launch | 33 ------------------- .../Host/eive-mingw-release-make.launch | 33 ------------------- 4 files changed, 132 deletions(-) delete mode 100644 misc/eclipse/Host/eive-linux-host-debug-make.launch delete mode 100644 misc/eclipse/Host/eive-linux-host-release-make.launch delete mode 100644 misc/eclipse/Host/eive-mingw-debug-make.launch delete mode 100644 misc/eclipse/Host/eive-mingw-release-make.launch diff --git a/misc/eclipse/Host/eive-linux-host-debug-make.launch b/misc/eclipse/Host/eive-linux-host-debug-make.launch deleted file mode 100644 index f5ab1ac7..00000000 --- a/misc/eclipse/Host/eive-linux-host-debug-make.launch +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/misc/eclipse/Host/eive-linux-host-release-make.launch b/misc/eclipse/Host/eive-linux-host-release-make.launch deleted file mode 100644 index 7548f831..00000000 --- a/misc/eclipse/Host/eive-linux-host-release-make.launch +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/misc/eclipse/Host/eive-mingw-debug-make.launch b/misc/eclipse/Host/eive-mingw-debug-make.launch deleted file mode 100644 index 4ab7b736..00000000 --- a/misc/eclipse/Host/eive-mingw-debug-make.launch +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/misc/eclipse/Host/eive-mingw-release-make.launch b/misc/eclipse/Host/eive-mingw-release-make.launch deleted file mode 100644 index da2f47a9..00000000 --- a/misc/eclipse/Host/eive-mingw-release-make.launch +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.43.0 From 9bedc302f44bbba20731e1c1d88eef2524ae24db Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 29 Dec 2020 14:57:19 +0100 Subject: [PATCH 22/23] added linux release launch config --- .../Host/eive-linux-host-release-cmake.launch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 misc/eclipse/make/Host/eive-linux-host-release-cmake.launch diff --git a/misc/eclipse/make/Host/eive-linux-host-release-cmake.launch b/misc/eclipse/make/Host/eive-linux-host-release-cmake.launch new file mode 100644 index 00000000..f2647a4f --- /dev/null +++ b/misc/eclipse/make/Host/eive-linux-host-release-cmake.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.43.0 From 6995d52a9a8066f51dfbd8fad212cfe73f36a65e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 29 Dec 2020 14:59:14 +0100 Subject: [PATCH 23/23] added launch config --- .../Host/eive-linux-host-release-cmake.launch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 misc/eclipse/Host/eive-linux-host-release-cmake.launch diff --git a/misc/eclipse/Host/eive-linux-host-release-cmake.launch b/misc/eclipse/Host/eive-linux-host-release-cmake.launch new file mode 100644 index 00000000..f2647a4f --- /dev/null +++ b/misc/eclipse/Host/eive-linux-host-release-cmake.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.43.0