forked from ROMEO/obsw
Merge branch 'main' into nehlich/ffs
This commit is contained in:
@ -1,17 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# Project Name
|
||||
project(romeo-obsw C CXX ASM)
|
||||
|
||||
project(romeo-obsw C 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})
|
||||
@ -19,9 +15,6 @@ 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(CMAKE_MODULE_PATH Findcommon.cmake)
|
||||
|
||||
set (LWIP_DIR contrib/lwip)
|
||||
|
||||
@ -30,14 +23,18 @@ set (LWIP_DIR contrib/lwip)
|
||||
# Configuration
|
||||
# ##############################################################################
|
||||
|
||||
set(ZYNQ_UART UART1 CACHE STRING "Which PS UART to use for stdout")
|
||||
set_property(CACHE ZYNQ_UART PROPERTY STRINGS UART0 UART1)
|
||||
if (${CMAKE_CROSSCOMPILING})
|
||||
set(ZYNQ_UART UART1 CACHE STRING "Which PS UART to use for stdout")
|
||||
set_property(CACHE ZYNQ_UART PROPERTY STRINGS UART0 UART1)
|
||||
|
||||
if(${ZYNQ_UART} STREQUAL UART0)
|
||||
add_compile_definitions(ZYNQ_USE_UART0)
|
||||
if(${ZYNQ_UART} STREQUAL UART0)
|
||||
add_compile_definitions(ZYNQ_USE_UART0)
|
||||
endif()
|
||||
else()
|
||||
unset(ZYNQ_UART)
|
||||
unset(ZYNQ_UART CACHE)
|
||||
endif()
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# Executable and Sources
|
||||
# ##############################################################################
|
||||
@ -48,7 +45,7 @@ add_executable(${TARGET_NAME})
|
||||
# lwip
|
||||
set (LWIP_INCLUDE_DIRS
|
||||
"${LWIP_DIR}/src/include"
|
||||
"${BSP_PATH}/lwip"
|
||||
"bsp_z7/lwip"
|
||||
)
|
||||
#include(${LWIP_DIR}/src/Filelists.cmake)
|
||||
set(lwip_SRCS
|
||||
@ -58,30 +55,48 @@ set(lwip_SRCS
|
||||
${LWIP_DIR}/src/netif/slipif.c
|
||||
${LWIP_DIR}/src/apps/tftp/tftp.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)
|
||||
if(${CMAKE_CROSSCOMPILING})
|
||||
add_library(lwip ${lwip_SRCS})
|
||||
target_include_directories(lwip PUBLIC ${LWIP_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Add freeRTOS
|
||||
set(FREERTOS_PORT GCC_ARM_CA9 CACHE STRING "")
|
||||
set(FREERTOS_HEAP 1 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)
|
||||
|
||||
|
||||
if(${CMAKE_CROSSCOMPILING})
|
||||
#TODO: this somewhat hardcodes zynq as the only cross target
|
||||
set(FREERTOS_PORT GCC_ARM_CA9 CACHE STRING "")
|
||||
set(FREERTOS_HEAP 1 CACHE STRING "")
|
||||
add_library(freertos_config INTERFACE)
|
||||
target_include_directories(freertos_config SYSTEM
|
||||
INTERFACE bsp_z7/freeRTOS) # The config file directory
|
||||
target_compile_definitions(freertos_config
|
||||
INTERFACE
|
||||
projCOVERAGE_TEST=0)
|
||||
target_include_directories(
|
||||
freertos_config INTERFACE bsp_z7/ps7_cortexa9_0/include)
|
||||
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL armv7a-none-eabihf)
|
||||
# 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)
|
||||
else()
|
||||
message(FATAL_ERROR "invalid architecture ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
endif()
|
||||
add_subdirectory(bsp_z7)
|
||||
target_link_options(${TARGET_NAME} PRIVATE -Wl,--cref -Wl,-Map=${TARGET_NAME}.map -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -T${CMAKE_SOURCE_DIR}/bsp_z7/freeRTOS/lscript.ld -specs=${CMAKE_SOURCE_DIR}/bsp_z7/freeRTOS/Xilinx.spec )
|
||||
else()
|
||||
set(FREERTOS_PORT GCC_POSIX CACHE STRING "")
|
||||
add_library(freertos_config INTERFACE)
|
||||
target_include_directories(freertos_config SYSTEM
|
||||
INTERFACE bsp_linux/freeRTOS) # The config file directory
|
||||
target_compile_options(freertos_config INTERFACE -c -fmessage-length=0 -g -O0 -ffunction-sections -fdata-sections)
|
||||
target_compile_definitions(freertos_config
|
||||
INTERFACE
|
||||
projCOVERAGE_TEST=0
|
||||
projENABLE_TRACING=0)
|
||||
add_subdirectory(bsp_linux)
|
||||
endif()
|
||||
add_subdirectory(${FreeRTOS_PATH})
|
||||
|
||||
add_subdirectory(bsp_z7)
|
||||
|
||||
|
||||
add_subdirectory(common)
|
||||
|
||||
@ -93,14 +108,16 @@ add_subdirectory(mission_rust)
|
||||
# ##############################################################################
|
||||
|
||||
# Add libraries for all sources.
|
||||
target_link_libraries(lwip PUBLIC freertos_kernel)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC freertos_kernel mission_rust lwip)
|
||||
if(${CMAKE_CROSSCOMPILING})
|
||||
target_link_libraries(lwip PUBLIC freertos_kernel)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC lwip)
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
${TARGET_NAME} PUBLIC ${BSP_PATH})
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC freertos_kernel mission_rust)
|
||||
|
||||
# target_include_directories(
|
||||
# ${TARGET_NAME} PUBLIC ${BSP_PATH})
|
||||
|
||||
target_link_options(${TARGET_NAME} PRIVATE -Wl,--cref -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")
|
||||
|
Reference in New Issue
Block a user