mirror of https://github.com/ArduPilot/ardupilot
mk: compilation settings to include CAN bus drivers and UAVCAN protocol
This commit is contained in:
parent
59ef501a19
commit
b121145c33
|
@ -6,4 +6,4 @@ include $(SKETCHBOOK)/mk/PX4/px4_common.mk
|
|||
MODULES += drivers/boards/px4fmu-v2
|
||||
MODULES += drivers/pwm_input
|
||||
MODULES += drivers/px4io
|
||||
MODULES += modules/uavcan
|
||||
|
||||
|
|
|
@ -5,6 +5,5 @@ include $(SKETCHBOOK)/mk/PX4/px4_common.mk
|
|||
|
||||
MODULES += drivers/boards/px4fmu-v2
|
||||
MODULES += drivers/pwm_input
|
||||
MODULES += modules/uavcan
|
||||
MODULES += drivers/px4io
|
||||
MODULES += drivers/oreoled
|
||||
|
|
|
@ -5,5 +5,3 @@ include $(SKETCHBOOK)/mk/PX4/px4_common.mk
|
|||
|
||||
MODULES += drivers/boards/px4fmu-v4
|
||||
MODULES += drivers/pwm_input
|
||||
MODULES += modules/uavcan
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ include $(MK_DIR)/help.mk
|
|||
# common makefile components
|
||||
include $(MK_DIR)/targets.mk
|
||||
include $(MK_DIR)/sketch_sources.mk
|
||||
include $(SKETCHBOOK)/modules/uavcan/libuavcan/include.mk
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
|
||||
|
|
|
@ -2,10 +2,21 @@ TOOLCHAIN = NATIVE
|
|||
|
||||
include $(MK_DIR)/find_tools.mk
|
||||
|
||||
UAVCAN_DIRECTORY ?= $(SKETCHBOOK)/modules/uavcan
|
||||
UAVCAN_DIR=$(shell cd $(UAVCAN_DIRECTORY) && pwd)/
|
||||
|
||||
# Hardcoded libraries/AP_Common/missing/cmath defines in "make" to retain the current behavior
|
||||
EXTRAFLAGS += -DHAVE_CMATH_ISFINITE -DNEED_CMATH_ISFINITE_STD_NAMESPACE
|
||||
|
||||
EXTRAFLAGS += -DHAVE_ENDIAN_H -DHAVE_BYTESWAP_H
|
||||
|
||||
# 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.
|
||||
EXTRAFLAGS += -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_NO_ASSERTIONS -DUAVCAN_NULLPTR=nullptr
|
||||
|
||||
EXTRAFLAGS += -I$(UAVCAN_DIRECTORY)/libuavcan/include
|
||||
EXTRAFLAGS += -I$(UAVCAN_DIRECTORY)/libuavcan/include/dsdlc_generated
|
||||
|
||||
#
|
||||
# Tool options
|
||||
#
|
||||
|
@ -133,7 +144,7 @@ $(SKETCHELF): $(SKETCHOBJS) $(LIBOBJS)
|
|||
@echo "Firmware is in $(BUILDELF)"
|
||||
endif
|
||||
|
||||
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES)
|
||||
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES)
|
||||
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES) -I$(UAVCAN_DIRECTORY)/libuavcan/include -I$(UAVCAN_DIRECTORY)/libuavcan/include/dsdlc_generated
|
||||
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES) -I$(UAVCAN_DIRECTORY)/libuavcan/include -I$(UAVCAN_DIRECTORY)/libuavcan/include/dsdlc_generated
|
||||
|
||||
include $(MK_DIR)/build_rules.mk
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
# Build sketch objects
|
||||
#
|
||||
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS)
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
|
||||
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS)
|
||||
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $*.cpp $(SKETCH_INCLUDES)
|
||||
|
||||
$(BUILDROOT)/%.o: $(SRCROOT)/%.c
|
||||
$(BUILDROOT)/%.o: $(SRCROOT)/%.c $(UAVCAN_HEADERS)
|
||||
$(RULEHDR)
|
||||
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
|
||||
|
||||
|
@ -23,7 +23,7 @@ $(BUILDROOT)/%.o: $(SRCROOT)/%.S
|
|||
# Build library objects from sources in the sketchbook
|
||||
#
|
||||
|
||||
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS)
|
||||
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
|
||||
$(RULEHDR)
|
||||
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
|
||||
|
||||
|
|
|
@ -4,3 +4,4 @@ LIBRARIES += AP_Button
|
|||
LIBRARIES += AP_ICEngine
|
||||
LIBRARIES += AP_FlashStorage
|
||||
LIBRARIES += SRV_Channel
|
||||
LIBRARIES += AP_UAVCAN
|
||||
|
|
|
@ -8,9 +8,9 @@ ifneq ($(NUTTX_SRC),)
|
|||
$(error NUTTX_SRC found in config.mk - Please see http://dev.ardupilot.org/wiki/git-submodules/)
|
||||
endif
|
||||
|
||||
ifneq ($(UAVCAN_DIR),)
|
||||
$(error UAVCAN_DIR found in config.mk - Please see http://dev.ardupilot.org/wiki/git-submodules/)
|
||||
endif
|
||||
#ifneq ($(UAVCAN_DIR),)
|
||||
#$(error UAVCAN_DIR found in config.mk - Please see http://dev.ardupilot.org/wiki/git-submodules/)
|
||||
#endif
|
||||
|
||||
# these can be overridden in developer.mk
|
||||
PX4FIRMWARE_DIRECTORY ?= $(SKETCHBOOK)/modules/PX4Firmware
|
||||
|
@ -37,6 +37,8 @@ EXTRAFLAGS += -DHAVE_BYTESWAP_H=0
|
|||
EXTRAFLAGS += -DHAVE_OCLOEXEC=0
|
||||
|
||||
EXTRAFLAGS += -I$(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink
|
||||
EXTRAFLAGS += -I$(UAVCAN_DIRECTORY)/libuavcan/include
|
||||
EXTRAFLAGS += -I$(UAVCAN_DIRECTORY)/libuavcan/include/dsdlc_generated
|
||||
|
||||
# we have different config files for V1 and V2
|
||||
PX4_V1_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v1_APM.mk
|
||||
|
@ -44,7 +46,9 @@ PX4_V2_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v2_APM.mk
|
|||
PX4_V3_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v3_APM.mk
|
||||
PX4_V4_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v4_APM.mk
|
||||
|
||||
SKETCHFLAGS=$(SKETCHLIBINCLUDES) -DARDUPILOT_BUILD -DTESTS_MATHLIB_DISABLE -DCONFIG_HAL_BOARD=HAL_BOARD_PX4 -DSKETCHNAME="\\\"$(SKETCH)\\\"" -DSKETCH_MAIN=ArduPilot_main -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
|
||||
# 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.
|
||||
SKETCHFLAGS=$(SKETCHLIBINCLUDES) -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_NO_ASSERTIONS -DUAVCAN_NULLPTR=nullptr -DARDUPILOT_BUILD -DTESTS_MATHLIB_DISABLE -DCONFIG_HAL_BOARD=HAL_BOARD_PX4 -DSKETCHNAME="\\\"$(SKETCH)\\\"" -DSKETCH_MAIN=ArduPilot_main -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
|
||||
|
||||
WARNFLAGS = -Wall -Wextra -Wlogical-op -Werror -Wno-unknown-pragmas -Wno-redundant-decls -Wno-psabi -Wno-packed -Wno-error=double-promotion -Wno-error=unused-variable -Wno-error=reorder -Wno-error=float-equal -Wno-error=pmf-conversions -Wno-error=missing-declarations -Wno-error=unused-function
|
||||
OPTFLAGS = -fsingle-precision-constant
|
||||
|
@ -74,13 +78,13 @@ module_mk:
|
|||
$(RULEHDR)
|
||||
$(v) echo "# Auto-generated file - do not edit" > $(SKETCHBOOK)/module.mk.new
|
||||
$(v) echo "MODULE_COMMAND = ArduPilot" >> $(SKETCHBOOK)/module.mk.new
|
||||
$(v) echo "SRCS = $(wildcard $(SRCROOT)/*.cpp) $(SKETCHLIBSRCSRELATIVE)" >> $(SKETCHBOOK)/module.mk.new
|
||||
$(v) echo "SRCS = $(wildcard $(SRCROOT)/*.cpp) $(SKETCHLIBSRCSRELATIVE) $(LIBUAVCAN_SRC)" >> $(SKETCHBOOK)/module.mk.new
|
||||
$(v) echo "MODULE_STACKSIZE = 4096" >> $(SKETCHBOOK)/module.mk.new
|
||||
$(v) echo "EXTRACXXFLAGS = -Wframe-larger-than=1300" >> $(SKETCHBOOK)/module.mk.new
|
||||
$(v) cmp $(SKETCHBOOK)/module.mk $(SKETCHBOOK)/module.mk.new 2>/dev/null || mv $(SKETCHBOOK)/module.mk.new $(SKETCHBOOK)/module.mk
|
||||
$(v) rm -f $(SKETCHBOOK)/module.mk.new
|
||||
|
||||
px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v1.export $(SKETCHCPP) module_mk px4-io-v1
|
||||
px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v1.export $(SKETCHCPP) module_mk px4-io-v1
|
||||
$(v) echo Building px4-v1
|
||||
$(RULEHDR)
|
||||
$(v) cp $(PX4_V1_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
@ -90,7 +94,7 @@ px4-v1: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Arc
|
|||
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v1.px4" "$(SKETCH)-v1.px4"
|
||||
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v1.px4"
|
||||
|
||||
px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v2.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v2.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
$(v) echo Building px4-v2
|
||||
$(RULEHDR)
|
||||
$(v) cp $(PX4_V2_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
@ -100,7 +104,7 @@ px4-v2: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Arc
|
|||
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v2.px4" "$(SKETCH)-v2.px4"
|
||||
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v2.px4"
|
||||
|
||||
px4-v3: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v3.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
px4-v3: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v3.export $(SKETCHCPP) module_mk px4-io-v2
|
||||
$(v) echo Building px4-v3
|
||||
$(RULEHDR)
|
||||
$(v) cp $(PX4_V3_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
@ -110,7 +114,7 @@ px4-v3: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Arc
|
|||
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v3.px4" "$(SKETCH)-v3.px4"
|
||||
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v3.px4"
|
||||
|
||||
px4-v4: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v4.export $(SKETCHCPP) module_mk
|
||||
px4-v4: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v4.export $(SKETCHCPP) module_mk
|
||||
$(v) echo Building px4-v4
|
||||
$(RULEHDR)
|
||||
$(v) cp $(PX4_V4_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
|
||||
|
|
|
@ -158,4 +158,5 @@ clean:
|
|||
@rm -fr $(BUILDROOT)
|
||||
|
||||
include $(MK_DIR)/modules.mk
|
||||
include $(MK_DIR)/uavcangen.mk
|
||||
include $(MK_DIR)/mavgen.mk
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
#include $(SKETCHBOOK)/modules/uavcan/libuavcan/include.mk
|
||||
|
||||
ifeq ($(UAVCAN_DIRECTORY),)
|
||||
UAVCAN_DIRECTORY := $(SKETCHBOOK)/modules/uavcan
|
||||
endif
|
||||
|
||||
UAVCAN_GEN := $(UAVCAN_DIRECTORY)/libuavcan/include/#$(BUILDROOT)/modules/uavcan/
|
||||
UAVCAN_GEN_INC := $(UAVCAN_GEN)dsdlc_generated/
|
||||
UAVCAN_HEADERS := $(UAVCAN_GEN_INC)/uavcan/Timestamp.hpp $(wildcard $(UAVCAN_GEN_INC),*.hpp)
|
||||
UAVCAN_DSDL_MESSAGE_DEFINITIONS := $(wildcard $(UAVCAN_DIRECTORY)/dsdl/uavcan/,*.uavcan) # $(UAVCAN_DIRECTORY)/dsdl/uavcan/Timestamp.uavcan
|
||||
|
||||
UAVCANgen: $(UAVCAN_HEADERS)
|
||||
|
||||
$(UAVCAN_HEADERS): $(UAVCAN_DSDL_MESSAGE_DEFINITIONS)
|
||||
@echo "Generating UAVCAN headers..."
|
||||
|
||||
# PYTHONPATH=$(UAVCAN_DIR)libuavcan/dsdl_compiler/python $(UAVCAN_DIR)libuavcan/dsdl_compiler/setup.py build
|
||||
# PYTHONPATH=$(UAVCAN_DIR)libuavcan/dsdl_compiler/ python $(UAVCAN_DIR)libuavcan/dsdl_compiler/setup.py install
|
||||
|
||||
PYTHONPATH=$(UAVCAN_DIRECTORY)/libuavcan/ python $(UAVCAN_DIRECTORY)/libuavcan/dsdl_compiler/libuavcan_dsdlc "$(UAVCAN_DIRECTORY)/dsdl/uavcan" -O"$(UAVCAN_GEN_INC)"
|
Loading…
Reference in New Issue