|
|
@ -31,65 +31,30 @@ |
|
|
|
# |
|
|
|
# |
|
|
|
############################################################################ |
|
|
|
############################################################################ |
|
|
|
|
|
|
|
|
|
|
|
# uavcan project |
|
|
|
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03") |
|
|
|
set(uavcan_c_flags ${c_flags}) |
|
|
|
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform") |
|
|
|
list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__) |
|
|
|
|
|
|
|
set(uavcan_cxx_flags ${cxx_flags}) |
|
|
|
|
|
|
|
list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__) |
|
|
|
|
|
|
|
set(uavcan_deps git_uavcan) |
|
|
|
|
|
|
|
set(uavcan_platform generic) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string(TOUPPER "${OS}" OS_UPPER) |
|
|
|
string(TOUPPER "${OS}" OS_UPPER) |
|
|
|
|
|
|
|
add_definitions( |
|
|
|
set(uavcan_definitions |
|
|
|
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03 |
|
|
|
-DUAVCAN_NO_ASSERTIONS |
|
|
|
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16 |
|
|
|
-DUAVCAN_STM32_NUM_IFACES=2 |
|
|
|
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48 |
|
|
|
-DUAVCAN_USE_EXTERNAL_SNPRINT |
|
|
|
-DUAVCAN_NO_ASSERTIONS |
|
|
|
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48 |
|
|
|
-DUAVCAN_PLATFORM=stm32 |
|
|
|
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16 |
|
|
|
-DUAVCAN_STM32_${OS_UPPER}=1 |
|
|
|
-DUAVCAN_STM32_TIMER_NUMBER=5 |
|
|
|
-DUAVCAN_STM32_NUM_IFACES=2 |
|
|
|
-DUAVCAN_STM32_${OS_UPPER}=1 |
|
|
|
-DUAVCAN_STM32_TIMER_NUMBER=5 |
|
|
|
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
set(uavcan_extra_flags ${uavcan_definitions} -I${CMAKE_SOURCE_DIR}/src/include) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (${OS} STREQUAL "nuttx") |
|
|
|
|
|
|
|
set(uavcan_platform stm32) |
|
|
|
|
|
|
|
list(APPEND uavcan_extra_flags |
|
|
|
|
|
|
|
-I${nuttx_export_dir}/include |
|
|
|
|
|
|
|
-I${nuttx_export_dir}/include/cxx |
|
|
|
|
|
|
|
-I${nuttx_export_dir}/arch/chip |
|
|
|
|
|
|
|
-I${nuttx_export_dir}/arch/common |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
list(APPEND uavcan_deps nuttx_export_${BOARD}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list(APPEND uavcan_c_flags ${uavcan_extra_flags}) |
|
|
|
|
|
|
|
list(APPEND uavcan_cxx_flags ${uavcan_extra_flags}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
px4_join(OUT uavcan_c_flags LIST "${uavcan_c_flags}" GLUE " ") |
|
|
|
|
|
|
|
px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
externalproject_add(libuavcan |
|
|
|
|
|
|
|
DEPENDS ${uavcan_deps} |
|
|
|
|
|
|
|
DOWNLOAD_COMMAND "" |
|
|
|
|
|
|
|
UPDATE_COMMAND git submodule update --init |
|
|
|
|
|
|
|
LOG_INSTALL 1 |
|
|
|
|
|
|
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan |
|
|
|
|
|
|
|
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} |
|
|
|
|
|
|
|
-DUAVCAN_USE_CPP03=ON |
|
|
|
-DUAVCAN_USE_CPP03=ON |
|
|
|
-DUAVCAN_PLATFORM=${uavcan_platform} |
|
|
|
-DUAVCAN_USE_EXTERNAL_SNPRINT |
|
|
|
-DUAVCAN_OS=${OS} |
|
|
|
) |
|
|
|
-DCMAKE_CXX_FLAGS=${uavcan_cxx_flags} |
|
|
|
|
|
|
|
-DCMAKE_C_FLAGS=${uavcan_c_flags} |
|
|
|
|
|
|
|
-DCMAKE_INSTALL_PREFIX=${ep_base}/Install |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string(TOUPPER ${OS} OS_UPPER) |
|
|
|
add_subdirectory(libuavcan EXCLUDE_FROM_ALL) |
|
|
|
|
|
|
|
add_dependencies(uavcan platforms__nuttx) |
|
|
|
|
|
|
|
|
|
|
|
add_definitions(${uavcan_definitions}) |
|
|
|
include_directories(libuavcan/libuavcan/include) |
|
|
|
|
|
|
|
include_directories(libuavcan/libuavcan/include/dsdlc_generated) |
|
|
|
|
|
|
|
include_directories(libuavcan/libuavcan_drivers/posix/include) |
|
|
|
|
|
|
|
include_directories(libuavcan/libuavcan_drivers/stm32/driver/include) |
|
|
|
|
|
|
|
|
|
|
|
px4_add_module( |
|
|
|
px4_add_module( |
|
|
|
MODULE modules__uavcan |
|
|
|
MODULE modules__uavcan |
|
|
@ -100,7 +65,6 @@ px4_add_module( |
|
|
|
-Wno-deprecated-declarations |
|
|
|
-Wno-deprecated-declarations |
|
|
|
-O3 |
|
|
|
-O3 |
|
|
|
SRCS |
|
|
|
SRCS |
|
|
|
|
|
|
|
|
|
|
|
# Main |
|
|
|
# Main |
|
|
|
uavcan_main.cpp |
|
|
|
uavcan_main.cpp |
|
|
|
uavcan_servers.cpp |
|
|
|
uavcan_servers.cpp |
|
|
@ -117,7 +81,7 @@ px4_add_module( |
|
|
|
|
|
|
|
|
|
|
|
DEPENDS |
|
|
|
DEPENDS |
|
|
|
platforms__common |
|
|
|
platforms__common |
|
|
|
libuavcan |
|
|
|
uavcan |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
## vim: set noet ft=cmake fenc=utf-8 ff=unix : |
|
|
|
## vim: set noet ft=cmake fenc=utf-8 ff=unix : |
|
|
|