forked from ROMEO/obsw
123 lines
3.7 KiB
CMake
123 lines
3.7 KiB
CMake
cmake_minimum_required(VERSION 3.13)
|
|
|
|
# Project Name
|
|
project(freeRTOS C CXX ASM)
|
|
|
|
|
|
# ##############################################################################
|
|
# Pre-Sources preparation
|
|
# ##############################################################################
|
|
|
|
|
|
|
|
# Specify the C++ standard
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
# Set names and variables
|
|
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
|
|
|
# Set path names
|
|
set(FreeRTOS_PATH FreeRTOS-Kernel/)
|
|
set(MISSION_PATH mission/)
|
|
set(FreeRTOS_CONFIG_PATH bsp_z7/freeRTOS)
|
|
set(BSP_PATH bsp_z7)
|
|
|
|
set (LWIP_DIR contrib/lwip)
|
|
|
|
|
|
# ##############################################################################
|
|
# Configuration
|
|
# ##############################################################################
|
|
|
|
|
|
|
|
|
|
# ##############################################################################
|
|
# Executable and Sources
|
|
# ##############################################################################
|
|
|
|
# Add executable
|
|
add_executable(${TARGET_NAME})
|
|
|
|
# lwip
|
|
set (LWIP_INCLUDE_DIRS
|
|
"${LWIP_DIR}/src/include"
|
|
"${LWIP_DIR}/src/include/compat/posix"
|
|
"${LWIP_DIR}/contrib"
|
|
"${LWIP_DIR}/contrib/ports/freertos/include"
|
|
"${BSP_PATH}/lwip"
|
|
)
|
|
include(${LWIP_DIR}/src/Filelists.cmake)
|
|
set(lwip_SRCS
|
|
${lwipcore_SRCS}
|
|
${lwipcore4_SRCS}
|
|
${lwipcore6_SRCS}
|
|
${lwipapi_SRCS}
|
|
${lwipnetif_SRCS}
|
|
${LWIP_DIR}/src/netif/slipif.c
|
|
${LWIP_DIR}/contrib/ports/freertos/sys_arch.c
|
|
)
|
|
add_library(lwip ${lwip_SRCS})
|
|
target_include_directories(lwip PUBLIC ${LWIP_INCLUDE_DIRS})
|
|
|
|
#target_compile_options(${TARGET_NAME} PUBLIC -g -O0 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard)
|
|
|
|
# Add freeRTOS
|
|
set(FREERTOS_PORT GCC_ARM_CA9 CACHE STRING "")
|
|
add_library(freertos_config INTERFACE)
|
|
target_include_directories(freertos_config SYSTEM
|
|
INTERFACE ${FreeRTOS_CONFIG_PATH}) # The config file directory
|
|
target_compile_definitions(freertos_config
|
|
INTERFACE
|
|
projCOVERAGE_TEST=0)
|
|
target_include_directories(
|
|
freertos_config INTERFACE ${BSP_PATH}/ps7_cortexa9_0/include)
|
|
# our compiler options, will trickle down through the project
|
|
target_compile_options(freertos_config INTERFACE -c -fmessage-length=0 -g -O0 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -ffunction-sections -fdata-sections)
|
|
|
|
|
|
add_subdirectory(${FreeRTOS_PATH})
|
|
|
|
add_subdirectory(bsp_z7)
|
|
|
|
#set(FSFW_OSAL freertos CACHE STRING "FSFW OSAL")
|
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
|
set(COMMON_CONFIG_PATH "common/config")
|
|
set(FSFW_ADDITIONAL_INC_PATHS
|
|
"${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}" "contrib/"
|
|
CACHE STRING "FSFW configuration paths")
|
|
|
|
set(FSFW_OSAL freertos CACHE STRING "FSFW OSAL")
|
|
|
|
set(FSFW_ADD_MONITORING ON)
|
|
|
|
add_subdirectory(fsfw)
|
|
add_subdirectory(common)
|
|
|
|
add_subdirectory(${MISSION_PATH})
|
|
|
|
# ##############################################################################
|
|
# Post-Sources preparation
|
|
# ##############################################################################
|
|
|
|
# Add libraries for all sources.
|
|
target_link_libraries(lwip freertos_kernel)
|
|
target_link_libraries(fsfw PUBLIC freertos_kernel)
|
|
target_link_libraries(${TARGET_NAME} PUBLIC fsfw lwip)
|
|
|
|
target_include_directories(
|
|
${TARGET_NAME} PUBLIC ${BSP_PATH})
|
|
|
|
|
|
target_link_options(${TARGET_NAME} PRIVATE -Wl,--start-group,-lgcc,-lc,--end-group -Wl,-Map=${TARGET_NAME}.map -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -T${CMAKE_SOURCE_DIR}/${FreeRTOS_CONFIG_PATH}/lscript.ld -specs=${CMAKE_SOURCE_DIR}/${FreeRTOS_CONFIG_PATH}/Xilinx.spec)
|
|
|
|
# Removed unused sections.
|
|
target_link_options(${TARGET_NAME} PRIVATE "-Wl,--gc-sections")
|
|
|
|
if(CMAKE_VERBOSE)
|
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
|
endif()
|
|
|
|
# Compile options for all sources.
|
|
target_compile_options(${TARGET_NAME} PRIVATE ${WARNING_FLAGS}) |