2022-04-29 15:47:54 +02:00
|
|
|
function(obsw_module_config)
|
|
|
|
endfunction()
|
|
|
|
|
2022-04-22 14:09:08 +02:00
|
|
|
function(pre_source_hw_os_config)
|
|
|
|
|
|
|
|
# FreeRTOS
|
|
|
|
if(FSFW_OSAL MATCHES freertos)
|
|
|
|
message(FATAL_ERROR "No FreeRTOS support implemented yet.")
|
|
|
|
# RTEMS
|
|
|
|
elseif(FSFW_OSAL STREQUAL rtems)
|
|
|
|
add_definitions(-DRTEMS)
|
|
|
|
message(FATAL_ERROR "No RTEMS support implemented yet.")
|
|
|
|
elseif(FSFW_OSAL STREQUAL linux)
|
|
|
|
add_definitions(-DUNIX -DLINUX)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
# 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/q7s" "arm/raspberrypi" "arm/egse"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if(TGT_BSP)
|
|
|
|
if (TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
|
|
|
set(BSP_PATH "bsp_linux_board")
|
|
|
|
elseif(TGT_BSP MATCHES "arm/q7s")
|
|
|
|
set(BSP_PATH "bsp_q7s")
|
|
|
|
elseif(TGT_BSP MATCHES "arm/egse")
|
|
|
|
set(BSP_PATH "bsp_egse")
|
|
|
|
elseif(TGT_BSP MATCHES "arm/te0720-1cfa")
|
|
|
|
set(BSP_PATH "bsp_te0720_1cfa")
|
|
|
|
else()
|
|
|
|
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)
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
2020-12-29 01:09:59 +01:00
|
|
|
function(pre_project_config)
|
|
|
|
|
|
|
|
# Basic input sanitization
|
|
|
|
if(DEFINED TGT_BSP)
|
2021-07-15 01:25:32 +02:00
|
|
|
if(${TGT_BSP} MATCHES "arm/raspberrypi" AND NOT FSFW_OSAL MATCHES linux)
|
2020-12-29 01:09:59 +01:00
|
|
|
message(STATUS "FSFW OSAL invalid for specified target BSP ${TGT_BSP}!")
|
2021-07-15 01:25:32 +02:00
|
|
|
message(STATUS "Setting valid FSFW_OSAL: linux")
|
|
|
|
set(FSFW_OSAL "linux")
|
2020-12-29 01:09:59 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-02-09 21:38:56 +01:00
|
|
|
|
2020-12-29 01:09:59 +01:00
|
|
|
# Disable compiler checks for cross-compiling.
|
2022-04-20 01:25:56 +02:00
|
|
|
if(FSFW_OSAL MATCHES linux AND TGT_BSP AND EIVE_HARDCODED_TOOLCHAIN_FILE)
|
2022-03-17 14:28:32 +01:00
|
|
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa")
|
2020-12-29 01:40:47 +01:00
|
|
|
set(CMAKE_TOOLCHAIN_FILE
|
2022-04-22 16:06:44 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Zynq7020CrossCompileConfig.cmake"
|
2020-12-29 01:40:47 +01:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
2022-02-05 13:19:20 +01:00
|
|
|
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
2021-07-15 19:06:57 +02:00
|
|
|
if(NOT DEFINED ENV{LINUX_ROOTFS})
|
|
|
|
if(NOT DEFINED LINUX_ROOTFS)
|
|
|
|
message(WARNING "No LINUX_ROOTFS environmental or CMake variable set!")
|
|
|
|
set(ENV{LINUX_ROOTFS} "$ENV{HOME}/raspberrypi/rootfs")
|
2020-12-29 01:09:59 +01:00
|
|
|
else()
|
2021-07-15 19:06:57 +02:00
|
|
|
set(ENV{LINUX_ROOTFS} "${LINUX_ROOTFS}")
|
2020-12-29 01:09:59 +01:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(STATUS
|
2021-07-15 19:06:57 +02:00
|
|
|
"LINUX_ROOTFS from environmental variables used: $ENV{LINUX_ROOTFS}"
|
2020-12-29 01:09:59 +01:00
|
|
|
)
|
|
|
|
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()
|
2021-01-14 10:52:41 +01:00
|
|
|
message(STATUS "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}")
|
|
|
|
set(RASPBERRY_VERSION ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version")
|
2021-05-05 22:43:17 +02:00
|
|
|
set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION})
|
2020-12-29 01:09:59 +01:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(STATUS
|
|
|
|
"RASPBERRY_VERSION from environmental variables used: "
|
|
|
|
"$ENV{RASPBERRY_VERSION}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_TOOLCHAIN_FILE
|
2022-04-22 16:01:10 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/RPiCrossCompileConfig.cmake"
|
2020-12-29 01:09:59 +01:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
2021-05-05 20:25:52 +02:00
|
|
|
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
|
|
|
|
if(LINUX_CROSS_COMPILE)
|
|
|
|
set(CMAKE_TOOLCHAIN_FILE
|
2022-04-22 16:01:10 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/BBBCrossCompileConfig.cmake"
|
2021-05-05 20:25:52 +02:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
else()
|
2020-12-29 01:09:59 +01:00
|
|
|
message(WARNING "Target BSP (TGT_BSP) ${TGT_BSP} unknown!")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction()
|