removed unrequired code
This commit is contained in:
parent
9ad6e9ed95
commit
4a1399aecb
@ -12,7 +12,6 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
# set(RTEMS_VERBOSE TRUE)
|
||||
|
||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
@ -20,25 +19,12 @@ if(NOT OS_FSFW)
|
||||
set(OS_FSFW host CACHE STRING "OS for the FSFW.")
|
||||
endif()
|
||||
|
||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||
option(LINUX_CROSS_COMPILE OFF)
|
||||
set(FSFW_HAL_ADD_LINUX ON)
|
||||
endif()
|
||||
|
||||
if(TGT_BSP MATCHES "arm/raspberrypi")
|
||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||
endif()
|
||||
|
||||
if(TGT_BSP MATCHES "arm/stm32h743zi-nucleo")
|
||||
set(FSFW_HAL_ADD_STM32H7 ON)
|
||||
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)
|
||||
project(fsfw-example-hosted C CXX)
|
||||
|
||||
|
||||
################################################################################
|
||||
@ -57,7 +43,7 @@ set(LIB_FSFW_HAL_NAME fsfw_hal)
|
||||
# Set path names
|
||||
set(FSFW_PATH fsfw)
|
||||
set(MISSION_PATH mission)
|
||||
set(COMMON_PATH common)
|
||||
set(COMMON_PATH example_common)
|
||||
set(TEST_PATH test)
|
||||
set(LWIP_PATH lwip)
|
||||
set(LIB_FSFW_HAL_PATH fsfw_hal)
|
||||
@ -89,16 +75,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
-Wno-psabi
|
||||
)
|
||||
|
||||
set(SHADOW_LOCAL_WARNING ON)
|
||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||
set(SHADOW_LOCAL_WARNING OFF)
|
||||
endif()
|
||||
|
||||
if(SHADOW_LOCAL_WARNING)
|
||||
# Some older compilers emit odd warnings if this is used.
|
||||
set(WARNING_FLAGS ${WARNING_FLAGS} -Wshadow=local)
|
||||
endif()
|
||||
|
||||
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/permissive- /d2SSAOptimizer-)
|
||||
@ -117,15 +93,10 @@ add_executable(${TARGET_NAME})
|
||||
if(LIB_OS_NAME)
|
||||
add_subdirectory(${LIB_OS_NAME})
|
||||
endif()
|
||||
if(ADD_LWIP_STACK)
|
||||
add_subdirectory(${LWIP_PATH})
|
||||
endif()
|
||||
add_subdirectory(${BSP_PATH})
|
||||
add_subdirectory(${FSFW_PATH})
|
||||
add_subdirectory(${MISSION_PATH})
|
||||
add_subdirectory(${COMMON_PATH})
|
||||
add_subdirectory(${TEST_PATH})
|
||||
add_subdirectory(${LIB_FSFW_HAL_PATH})
|
||||
|
||||
################################################################################
|
||||
# Post-Sources preparation
|
||||
@ -163,12 +134,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
"-Wl,--gc-sections"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TGT_BSP MATCHES "arm/stm32h743zi-nucleo")
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
-Wl,--undefined,_printf_float -Wl,--undefined,_scanf_float
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
endif()
|
||||
|
||||
@ -182,10 +147,8 @@ target_compile_options(${TARGET_NAME} PRIVATE
|
||||
${WARNING_FLAGS}
|
||||
)
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
include(${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
||||
post_source_hw_os_config()
|
||||
endif()
|
||||
include(${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
||||
post_source_hw_os_config()
|
||||
|
||||
if(NOT CMAKE_SIZE)
|
||||
set(CMAKE_SIZE size)
|
||||
@ -216,8 +179,3 @@ add_custom_command(
|
||||
|
||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
||||
set_build_type()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,61 +1,8 @@
|
||||
function(post_source_hw_os_config)
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/stm32h743zi-nucleo")
|
||||
if(${OS_FSFW} MATCHES "freertos")
|
||||
|
||||
if(ADD_LWIP_STACK)
|
||||
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()
|
||||
|
||||
elseif(${OS_FSFW} MATCHES "rtems")
|
||||
|
||||
if(ADD_LWIP_STACK)
|
||||
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()
|
||||
|
||||
include("${RTEMS_CONFIG_DIR}/RTEMSPostProjectConfig.cmake")
|
||||
rtems_post_project_config(${TARGET_NAME})
|
||||
|
||||
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(C_DEFS "" CACHE INTERNAL "C Defines")
|
||||
|
||||
set(CXX_FLAGS ${C_FLAGS})
|
||||
set(CXX_DEFS ${C_DEFS})
|
||||
@ -74,11 +21,4 @@ target_compile_options(${TARGET_NAME} PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${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()
|
@ -1,166 +1,16 @@
|
||||
function(pre_source_hw_os_config)
|
||||
|
||||
# FreeRTOS
|
||||
if(${OS_FSFW} MATCHES freertos)
|
||||
add_definitions(-DFREERTOS)
|
||||
# RTEMS
|
||||
elseif(${OS_FSFW} STREQUAL rtems)
|
||||
add_definitions(-DRTEMS)
|
||||
elseif(${OS_FSFW} STREQUAL linux)
|
||||
add_definitions(-DUNIX -DLINUX)
|
||||
if(${OS_FSFW} STREQUAL linux)
|
||||
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/stm32h743zi-nucleo" "arm/raspberrypi"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/stm32h743zi-nucleo")
|
||||
add_definitions(-DSTM32H743ZI_NUCLEO)
|
||||
if(${OS_FSFW} MATCHES freertos)
|
||||
option(ADD_LWIP_STACK "Add LwIP stack for application" ON)
|
||||
|
||||
set(LIB_OS_NAME "freertos" CACHE STRING "OS FSFW library name")
|
||||
set(BSP_PATH "bsp_stm32_freertos")
|
||||
set(BOARD_CONFIG_PATH
|
||||
"${BSP_PATH}/STM32CubeH7/Boards/NUCLEO-H743ZI/Inc"
|
||||
CACHE STRING
|
||||
"Board configuration include path."
|
||||
)
|
||||
set(MIDDLEWARES_PATH
|
||||
"${BSP_PATH}/STM32CubeH7/Middlewares"
|
||||
)
|
||||
set(CMSIS_INC_PATH
|
||||
"${BSP_PATH}/STM32CubeH7/Drivers/CMSIS/Include"
|
||||
CACHE STRING
|
||||
"CMSIS include path"
|
||||
)
|
||||
set(FREERTOS_GENERIC_PORT_PATH
|
||||
"${MIDDLEWARES_PATH}/Third_Party/FreeRTOS"
|
||||
)
|
||||
set(FREERTOS_PORT_PATH
|
||||
"${FREERTOS_GENERIC_PORT_PATH}/portable/GCC/ARM_CM7/r0p1"
|
||||
)
|
||||
set(FREERTOS_CONFIG_AND_PORT_PATHS
|
||||
"${FREERTOS_PORT_PATH}"
|
||||
"${BOARD_CONFIG_PATH}"
|
||||
"${CMSIS_INC_PATH}"
|
||||
CACHE STRING
|
||||
"FreeRTOS configuration and port paths."
|
||||
)
|
||||
|
||||
set(FREERTOS_PORT_SOURCES
|
||||
${FREERTOS_PORT_PATH}/port.c
|
||||
CACHE INTERNAL
|
||||
"FreeRTOS port sources"
|
||||
)
|
||||
set(LIB_STM_HAL_NAME "stm_hal" CACHE STRING "STM32 HAL library name")
|
||||
set(LIB_HAL_NAME ${LIB_STM_HAL_NAME} PARENT_SCOPE)
|
||||
set(LINK_HAL TRUE PARENT_SCOPE)
|
||||
|
||||
set(STM_HAL_CONFIG_PATH
|
||||
"${BOARD_CONFIG_PATH}"
|
||||
CACHE INTERNAL
|
||||
"STM HAL config path."
|
||||
)
|
||||
|
||||
set(STM_HAL_DEFINES
|
||||
"USE_HAL_DRIVER"
|
||||
"STM32H743xx"
|
||||
CACHE INTERNAL
|
||||
"HAL defines for target machine"
|
||||
)
|
||||
|
||||
set(LINKER_SCRIPT_PATH "${BSP_PATH}/STM32CubeH7/Boards/NUCLEO-H743ZI")
|
||||
set(LINKER_SCRIPT_NAME "STM32H743ZITx_FLASH.ld")
|
||||
|
||||
get_filename_component(LINKER_SCRIPT
|
||||
${LINKER_SCRIPT_PATH}/${LINKER_SCRIPT_NAME}
|
||||
REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(LINKER_SCRIPT ${LINKER_SCRIPT} CACHE STRING "Custom linker script")
|
||||
|
||||
if(ADD_LWIP_STACK)
|
||||
set(LWIP_CONFIG_PATH
|
||||
"${BOARD_CONFIG_PATH}"
|
||||
CACHE INTERNAL
|
||||
"lwIP configuration include path"
|
||||
)
|
||||
|
||||
set(LIB_LWIP_NAME "lwip" CACHE STRING "lwIP library name")
|
||||
endif()
|
||||
|
||||
elseif(${OS_FSFW} MATCHES rtems)
|
||||
option(ADD_LWIP_STACK "Add LwIP stack for application" ON)
|
||||
|
||||
set(BSP_PATH "bsp_stm32_rtems")
|
||||
set(BOARD_CONFIG_PATH "${BSP_PATH}/boardconfig")
|
||||
if(ADD_LWIP_STACK)
|
||||
set(LWIP_CONFIG_PATH
|
||||
"${BOARD_CONFIG_PATH}"
|
||||
CACHE INTERNAL
|
||||
"lwIP configuration include path"
|
||||
)
|
||||
|
||||
set(LIB_LWIP_NAME "lwip" CACHE STRING "lwIP library name")
|
||||
endif()
|
||||
|
||||
endif() # ${OS_FSFW} MATCHES XYZ
|
||||
|
||||
elseif(${TGT_BSP} MATCHES "arm/raspberrypi")
|
||||
add_definitions(-DRASPBERRY_PI)
|
||||
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
|
||||
add_definitions(-DBEAGLE_BONE_BLACK)
|
||||
elseif(${TGT_BSP} MATCHES "host/none")
|
||||
option(ADD_LWIP_STACK "Add LwIP stack for application" OFF)
|
||||
|
||||
else()
|
||||
option(ADD_LWIP_STACK "Add LwIP stack for application" OFF)
|
||||
|
||||
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()
|
||||
|
@ -1,131 +0,0 @@
|
||||
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")
|
||||
if(${TGT_BSP} MATCHES "arm/stm32h743zi-nucleo")
|
||||
if(NOT ${OS_FSFW} MATCHES freertos)
|
||||
message(STATUS
|
||||
"FSFW OSAL invalid for specified target BSP ${TGT_BSP}!"
|
||||
)
|
||||
message(STATUS "Setting valid OS_FSFW: freertos")
|
||||
set(OS_FSFW "freertos")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# Disable compiler checks for cross-compiling.
|
||||
if(${OS_FSFW} MATCHES freertos)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"${CMAKE_SCRIPT_PATH}/STM32FreeRTOSConfig.cmake"
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
elseif(${OS_FSFW} MATCHES rtems)
|
||||
|
||||
set(RTEMS_CONFIG_DIR
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/rtems-cmake"
|
||||
CACHE FILEPATH
|
||||
"Directory containing the RTEMS *.cmake files"
|
||||
)
|
||||
|
||||
include(${RTEMS_CONFIG_DIR}/RTEMSPreProjectConfig.cmake)
|
||||
|
||||
if(NOT DEFINED RTEMS_PREFIX)
|
||||
if(NOT DEFINED ENV{RTEMS_PREFIX})
|
||||
message(FATAL_ERROR
|
||||
"RTEMS_PREFIX must be set either manually or as an environment "
|
||||
"variable!"
|
||||
)
|
||||
else()
|
||||
message(STATUS
|
||||
"Using environment variable RTEMS_PREFIX $ENV{RTEMS_PREFIX} "
|
||||
"as RTEMS prefix"
|
||||
)
|
||||
set(RTEMS_PREFIX $ENV{RTEMS_PREFIX})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/stm32h743zi-nucleo")
|
||||
set(RTEMS_BSP "arm/nucleo-h743zi")
|
||||
else()
|
||||
if(NOT DEFINED RTEMS_BSP)
|
||||
if(NOT DEFINED ENV{RTEMS_BSP})
|
||||
message(FATAL_ERROR
|
||||
"RTEMS_BSP must be set either manually or as an environment"
|
||||
"variable!"
|
||||
)
|
||||
else()
|
||||
set(RTEMS_BSP $ENV{RTEMS_BSP})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
rtems_pre_project_config(${RTEMS_PREFIX} ${RTEMS_BSP})
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
${RTEMS_CONFIG_DIR}/RTEMSToolchain.cmake
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
elseif(${OS_FSFW} STREQUAL linux AND TGT_BSP)
|
||||
if(${TGT_BSP} MATCHES "host/none")
|
||||
|
||||
elseif(${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()
|
||||
if(LINUX_CROSS_COMPILE)
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"${CMAKE_SCRIPT_PATH}/RPiCrossCompileConfig.cmake"
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
|
||||
if(LINUX_CROSS_COMPILE)
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"${CMAKE_SCRIPT_PATH}/BBBCrossCompileConfig.cmake"
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Target BSP (TGT_BSP) ${TGT_BSP} unknown!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
@ -1 +1 @@
|
||||
Subproject commit 51475efaab014e72410973a57ed2e801bcb0b1d2
|
||||
Subproject commit 2755045be11cc8c91fd24f0939a37b9b2e8fa862
|
Loading…
Reference in New Issue
Block a user