forked from Archive/PX4-Autopilot
Working on uavcan building.
This commit is contained in:
parent
c8e75c98b0
commit
e1bb618371
|
@ -6,7 +6,7 @@
|
|||
url = git://github.com/PX4/NuttX.git
|
||||
[submodule "src/lib/uavcan"]
|
||||
path = src/lib/uavcan
|
||||
url = git://github.com/UAVCAN/libuavcan.git
|
||||
url = git://github.com/jgoppert/libuavcan.git
|
||||
[submodule "Tools/genmsg"]
|
||||
path = Tools/genmsg
|
||||
url = https://github.com/ros/genmsg.git
|
||||
|
|
|
@ -155,6 +155,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
|||
set(config_module "configs/${CONFIG}")
|
||||
include(${config_module})
|
||||
|
||||
# cmake modules
|
||||
include(ExternalProject)
|
||||
|
||||
# require px4 module interface
|
||||
set(px4_required_interface
|
||||
px4_os_prebuild_targets
|
||||
|
@ -269,6 +272,17 @@ px4_generate_messages(TARGET msg_gen
|
|||
DEPENDS git_genmsg git_gencpp
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# external projects
|
||||
#
|
||||
|
||||
set(ep_base ${CMAKE_BINARY_DIR}/external)
|
||||
set_property(DIRECTORY PROPERTY EP_BASE ${ep_base})
|
||||
|
||||
# add external project install folders to build
|
||||
link_directories(${ep_base}/Install/lib)
|
||||
include_directories(${ep_base}/Install/include)
|
||||
|
||||
#=============================================================================
|
||||
# subdirectories
|
||||
#
|
||||
|
@ -286,7 +300,6 @@ if (config_io_board)
|
|||
add_subdirectory(src/modules/px4iofirmware)
|
||||
endif()
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# generate git version
|
||||
#
|
||||
|
|
8
Makefile
8
Makefile
|
@ -48,6 +48,9 @@
|
|||
# directory build_nuttx_px4fmu-v2_default and then call make
|
||||
# in that directory with the target upload.
|
||||
|
||||
# explicity set default build target
|
||||
all: px4fmu-v2_default
|
||||
|
||||
# Parsing
|
||||
# --------------------------------------------------------------------
|
||||
# assume 1st argument passed is the main target, the
|
||||
|
@ -138,9 +141,6 @@ sitl_ros:
|
|||
|
||||
# Other targets
|
||||
# --------------------------------------------------------------------
|
||||
# explicity set default build target
|
||||
all: px4fmu-v2_default
|
||||
|
||||
clean:
|
||||
@rm -rf build_*/
|
||||
|
||||
|
@ -153,7 +153,7 @@ distclean: clean
|
|||
@cd ../../..
|
||||
|
||||
# targets handled by cmake
|
||||
cmake_targets = test upload package package_source debug debug_io check_weak
|
||||
cmake_targets = test upload package package_source debug debug_io check_weak libuavcan
|
||||
$(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ))))
|
||||
|
||||
.PHONY: clean
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
|
||||
set(config_module_list
|
||||
#
|
||||
|
@ -63,7 +63,7 @@ set(config_module_list
|
|||
modules/navigator
|
||||
modules/mavlink
|
||||
modules/gpio_led
|
||||
#modules/uavcan # have to fix CMakeLists.txt
|
||||
modules/uavcan
|
||||
modules/land_detector
|
||||
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
|
||||
set(config_module_list
|
||||
#
|
||||
|
@ -67,7 +67,7 @@ set(config_module_list
|
|||
modules/navigator
|
||||
modules/mavlink
|
||||
modules/gpio_led
|
||||
#modules/uavcan # have to fix CMakeLists.txt
|
||||
modules/uavcan
|
||||
modules/land_detector
|
||||
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-none-eabi.cmake)
|
||||
|
||||
set(config_module_list
|
||||
#
|
||||
|
|
|
@ -2,7 +2,7 @@ include(nuttx/px4_impl_nuttx)
|
|||
|
||||
message(WARNING "this is a work in progress and doesn't build yet")
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
set(config_module_list
|
||||
#platforms/nuttx
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(posix/px4_impl_posix)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -5,7 +5,7 @@ if("${DSPAL_STUBS_ENABLE}" STREQUAL "")
|
|||
set(DSPAL_STUBS_ENABLE "1")
|
||||
endif()
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -5,7 +5,7 @@ if("${DSPAL_STUBS_ENABLE}" STREQUAL "")
|
|||
set(DSPAL_STUBS_ENABLE "1")
|
||||
endif()
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(posix/px4_impl_posix)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/led
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -20,7 +20,7 @@ set(target_libraries
|
|||
)
|
||||
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(qurt/px4_impl_qurt)
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -3,7 +3,7 @@ include(qurt/px4_impl_qurt)
|
|||
# Run a full link with build stubs to make sure qurt target isn't broken
|
||||
set(QURT_ENABLE_STUBS "1")
|
||||
|
||||
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-hexagon-7.4.cmake)
|
||||
|
||||
set(config_module_list
|
||||
drivers/device
|
||||
|
|
|
@ -40,6 +40,8 @@ target_link_libraries(firmware_nuttx
|
|||
${module_libraries}
|
||||
${config_extra_libs}
|
||||
${link_libs}
|
||||
libuavcan_stm32_driver.a
|
||||
libuavcan.a
|
||||
-Wl,--end-group)
|
||||
|
||||
add_custom_target(check_weak
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 50dc08663af2d9b55eae0ccf5f07c63db0ee8907
|
||||
Subproject commit 0b0e7bc6cc7fa6ec22905f3a519190e24714205d
|
|
@ -30,6 +30,64 @@
|
|||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# uavcan project
|
||||
set(uavcan_c_flags ${c_flags})
|
||||
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 -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)
|
||||
|
||||
set(uavcan_definitions
|
||||
-DUAVCAN_NO_ASSERTIONS
|
||||
-DUAVCAN_STM32_NUM_IFACES=2
|
||||
-DUAVCAN_USE_EXTERNAL_SNPRINT
|
||||
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
|
||||
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
-DUAVCAN_STM32_TIMER_NUMBER=5
|
||||
-DUAVCAN_STM32_${OS_UPPER}=1
|
||||
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
|
||||
)
|
||||
set(uavcan_extra_flags ${uavcan_definitions})
|
||||
|
||||
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}
|
||||
UPDATE_COMMAND git submodule update --init
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan
|
||||
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
-DUAVCAN_PLATFORM=${uavcan_platform}
|
||||
-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_definitions(${uavcan_definitions})
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__uavcan
|
||||
MAIN uavcan
|
||||
|
@ -41,7 +99,6 @@ px4_add_module(
|
|||
# Main
|
||||
uavcan_main.cpp
|
||||
uavcan_servers.cpp
|
||||
uavcan_clock.cpp
|
||||
uavcan_params.c
|
||||
|
||||
# Actuators
|
||||
|
@ -55,43 +112,7 @@ px4_add_module(
|
|||
|
||||
DEPENDS
|
||||
platforms__common
|
||||
libuavcan
|
||||
)
|
||||
|
||||
# TODO convert rest of module.mk
|
||||
|
||||
##
|
||||
## libuavcan
|
||||
##
|
||||
#include $(PX4_LIB_DIR)uavcan/libuavcan/include.mk
|
||||
## Use the relitive path to keep the genrated files in the BUILD_DIR
|
||||
#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_SRC))
|
||||
#INCLUDE_DIRS += $(LIBUAVCAN_INC)
|
||||
## Since actual compiler mode is C++11, the library will default to UAVCAN_CPP11, but it will fail to compile
|
||||
## because this platform lacks most of the standard library and STL. Hence we need to force C++03 mode.
|
||||
#override EXTRADEFINES := $(EXTRADEFINES) \
|
||||
#-DUAVCAN_CPP_VERSION=UAVCAN_CPP03 \
|
||||
#-DUAVCAN_NO_ASSERTIONS \
|
||||
#-DUAVCAN_MEM_POOL_BLOCK_SIZE=48 \
|
||||
#-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
|
||||
##
|
||||
## libuavcan drivers for STM32
|
||||
##
|
||||
#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/stm32/driver/include.mk
|
||||
## Use the relitive path to keep the genrated files in the BUILD_DIR
|
||||
#SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_STM32_SRC))
|
||||
#INCLUDE_DIRS += $(LIBUAVCAN_STM32_INC)
|
||||
#override EXTRADEFINES := $(EXTRADEFINES) -DUAVCAN_STM32_NUTTX -DUAVCAN_STM32_NUM_IFACES=2
|
||||
|
||||
##
|
||||
## libuavcan drivers for posix
|
||||
##
|
||||
#include $(PX4_LIB_DIR)uavcan/libuavcan_drivers/posix/include.mk
|
||||
#INCLUDE_DIRS += $(LIBUAVCAN_POSIX_INC)
|
||||
|
||||
##
|
||||
## Invoke DSDL compiler
|
||||
##
|
||||
#$(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR)))
|
||||
#INCLUDE_DIRS += dsdlc_generated
|
||||
## vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
|
Loading…
Reference in New Issue