build: remove remaining make build

This commit is contained in:
Andrew Tridgell 2018-11-20 21:25:41 +11:00
parent 088442880e
commit f056391fea
19 changed files with 0 additions and 1725 deletions

View File

@ -1,52 +0,0 @@
# find the mk/ directory, which is where this makefile fragment
# lives. (patsubst strips the trailing slash.)
SYSTYPE := $(shell uname)
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
MK_DIR := $(shell cygpath -m ../mk)
else
MK_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
endif
include $(MK_DIR)/environ.mk
# short-circuit build for the configure target
ifeq ($(MAKECMDGOALS),configure)
include $(MK_DIR)/configure.mk
else
# short-circuit build for the help target
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)
# board specific includes
ifeq ($(HAL_BOARD),HAL_BOARD_SITL)
include $(MK_DIR)/board_native.mk
endif
ifeq ($(HAL_BOARD),HAL_BOARD_LINUX)
include $(MK_DIR)/board_linux.mk
endif
ifeq ($(HAL_BOARD),HAL_BOARD_PX4)
include $(MK_DIR)/board_px4.mk
endif
ifeq ($(HAL_BOARD),HAL_BOARD_VRBRAIN)
include $(MK_DIR)/board_vrbrain.mk
endif
ifeq ($(HAL_BOARD),HAL_BOARD_F4LIGHT)
include $(MK_DIR)/board_F4Light.mk
endif
endif
endif

View File

@ -1,376 +0,0 @@
TOOLCHAIN = ARM
ARM_CXX := arm-none-eabi-g++
ARM_CC := arm-none-eabi-gcc
ARM_AS := arm-none-eabi-gcc
ARM_AR := arm-none-eabi-ar
#ARM_LD := arm-none-eabi-g++
ARM_LD := arm-none-eabi-ld
ARM_GDB := arm-none-eabi-gdb
ARM_OBJCOPY := arm-none-eabi-objcopy
SIZE := arm-none-eabi-size
DISAS := arm-none-eabi-objdump
#TOOLCHAIN = arm-none-eabi
include $(MK_DIR)/find_tools.mk
.DEFAULT_GOAL := all
##
## Target-specific configuration. This determines some compiler and
## linker options/flags.
##
PATH:=$(PATH):/usr/local/bin
# these default to a Maple Flash build.
BOARD ?= f4light_Revolution
MEMORY_TARGET ?= flash
##
## Useful paths, constants, etc.
##
STFLASH := /usr/local/stlink/st-flash
STUTIL := /usr/local/stlink/st-util
BL_ADDRESS := 0x08000000
FLASH_ADDRESS := 0x08010000
UPLOADER := dfu-util
#leaflabs bootloader
USBID := 1EAF:0003
BLDROOT := $(SRCROOT)/..
#BUILD_PATH := $(BLDROOT)/build
BUILD_PATH := $(BUILDROOT)
LIBRARIES_PATH := $(BLDROOT)/libraries
HAL_PATH := $(LIBRARIES_PATH)/AP_HAL_F4Light
WIRISH_PATH := $(HAL_PATH)/wirish
BOARDS_PATH := $(HAL_PATH)/boards
HARDWARE_PATH := $(HAL_PATH)/hardware
HAL_HW_PATH := $(HAL_PATH)/hardware/hal
STM32_PATH := $(HARDWARE_PATH)/STM32F4xx_DSP_StdPeriph_Lib_V1.1.0
STM32USB_PATH := $(HARDWARE_PATH)/STM32_USB_Driver
cpu_flags := -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
FIRMWARE_PATH := $(BLDROOT)/$(SKETCH)
# List of input files to the sketch.cpp file in the order they should be appended to create it
LIBRARY_INCLUDES :=
SUPPORT_PATH := $(BLDROOT)/libraries/AP_HAL_F4Light/support
TOOLS_PATH := $(BLDROOT)/libraries/AP_HAL_F4Light/support/tools
# Support files for linker
LDDIR := $(BOARDS_PATH)/$(BOARD)/ld
BOOTLOADERS := $(BLDROOT)/Tools/bootloaders
APJTOOL := $(BLDROOT)/Tools/ardupilotwaf/px_mkfw.py
# $(BOARD)- and $(MEMORY_TARGET)-specific configuration
include $(BOARDS_PATH)/$(BOARD)/target-config.mk
##
## Compilation flags
##
EXTRAFLAGS += -DHAVE_STD_NULLPTR_T=0 -DHAVE_BYTESWAP_H=0
EXTRAFLAGS += $(SKETCHLIBINCLUDES) -DARDUPILOT_BUILD -DTESTS_MATHLIB_DISABLE -DSKETCH_MAIN=ArduPilot_main
GITFLAGS := -DGIT_VERSION="\"$(GIT_VERSION) $(shell date --rfc-3339=date)\""
#-Werror
WARNFLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-align -Wno-psabi -Wno-unused-parameter -Wno-error=cast-align -Wno-error=unused-but-set-variable
WARNFLAGS += -Wwrite-strings -Wformat=2 -Wshadow -Wfloat-equal -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-pragmas
WARNFLAGS += -Wextra -Wlogical-op -Wno-unknown-pragmas -Wno-redundant-decls -Wno-packed -Wno-error=double-promotion -Wno-error=type-limits
WARNFLAGS += -Wno-error=unused-variable -Wno-error=reorder -Wno-error=float-equal -Wno-error=unused-parameter -Wno-missing-field-initializers
WARNFLAGS += -Wno-error=pmf-conversions -Wno-error=missing-declarations -Wno-error=unused-function -Werror=format-security -Werror=array-bounds
WARNFLAGS += -Wno-error=unused-label -Wno-trigraphs
OPTFLAGS = -Os
OPTFLAGS += -fsingle-precision-constant -g3 -fno-strict-aliasing -fomit-frame-pointer -frename-registers
#-fno-strength-reduce
OPTFLAGS += -fno-builtin-printf -fno-aggressive-loop-optimizations -fpredictive-commoning
#OPTFLAGS += -fassociative-math -freciprocal-math -ffast-math - cause EKF errors
OPTFLAGS += -fno-signed-zeros -fno-trapping-math
OPTFLAGS += -finline-functions-called-once -fearly-inlining -finline-small-functions
OPTFLAGS += -fmerge-all-constants
WARNFLAGSCXX = -Wno-reorder
DEPFLAGS = -MD -MT $@
GLOBAL_FLAGS := -D$(VECT_BASE_ADDR)
GLOBAL_FLAGS += -DBOARD_$(BOARD)
GLOBAL_FLAGS += -DMCU_$(MCU)
GLOBAL_FLAGS += -DCONFIG_HAL_BOARD=$(HAL_BOARD)
GLOBAL_FLAGS += -DSTM32F4XX
GLOBAL_FLAGS += -DUSE_STDPERIPH_DRIVER
GLOBAL_FLAGS += -DARM_MATH_CM4
GLOBAL_FLAGS += -DUSE_OTG_FS_CORE
GLOBAL_FLAGS += -DUSE_USB_OTG_FS
GLOBAL_FLAGS += -DUSE_EMBEDDED_PHY
GLOBAL_FLAGS += -D__FPU_PRESENT
GLOBAL_FLAGS += -D__FPU_USED=1
GLOBAL_FLAGS += -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
GLOBAL_FLAGS += $(WARNFLAGS) $(DEPFLAGS) $(EXTRAFLAGS) $(OPTS)
#
GLOBAL_FLAGS += -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
GLOBAL_FLAGS += -ffunction-sections
GLOBAL_FLAGS += -fdata-sections
#Produce debugging information in the operating system's native format
GLOBAL_FLAGS += -ggdb
#GLOBAL_FLAGS += -v -save-temps # for GCC bugreport
# GLOBAL_CFLAGS -----------------------------------------------------------------------------------
GLOBAL_CFLAGS := $(cpu_flags)
#GLOBAL_CFLAGS += -nostdlib #Do not use the standard system startup files or libraries when linking
GLOBAL_CFLAGS += -Wall #This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros
GLOBAL_CFLAGS += $(GLOBAL_FLAGS) $(OPTFLAGS)
GLOBAL_CFLAGS += -include $(BOARDS_PATH)/$(BOARD)/board.h
# GLOBAL_CXXFLAGS ---------------------------------------------------------------------------------
GLOBAL_CXXFLAGS := -fno-rtti #Disable generation of information about every class with virtual functions for use by the C++ runtime type identification features
GLOBAL_CXXFLAGS += -fno-exceptions -fno-threadsafe-statics # not true C++
GLOBAL_CXXFLAGS += -fconserve-space -fno-enforce-eh-specs -fno-use-cxa-atexit
GLOBAL_CXXFLAGS += -std=gnu++11
# Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using "-fpermissive" will allow some nonconforming code to compile.
GLOBAL_CXXFLAGS += $(GLOBAL_CFLAGS)
# -fpermissive
# missing definitions
GLOBAL_CXXFLAGS += -c -include $(WIRISH_PATH)/defs.h
# GLOBAL_ASFLAGS ----------------------------------------------------------------------------------
GLOBAL_ASFLAGS := $(cpu_flags)
GLOBAL_ASFLAGS += -x assembler-with-cpp
GLOBAL_ASFLAGS += $(GLOBAL_FLAGS) $(OPTFLAGS)
# GLOBAL_LDFLAGS ----------------------------------------------------------------------------------
LDFLAGS := $(cpu_flags)
LDFLAGS += -static
LDFLAGS += -lm -lgcc
LDFLAGS += -Wall
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--cref
#LDFLAGS += -Wl,--print-gc-sections
LDFLAGS += -Wl,-Map -Wl,$(BUILD_PATH)/$(BOARD).map
LDFLAGS += -T$(LDDIR)/$(LDSCRIPT)
LDFLAGS += -L$(LDDIR)
LDFLAGS += -Wl,--warn-common
# -Wl,--verbose
#let's linker optimize whole program itself
LDFLAGS += -Wl,--relax
#LDFLAGS += -fwhole-program
##
# -fwhole-program
#--plugin=/usr/local/arm-none-eabi/lib/gcc/arm-none-eabi/5.2.1/liblto_plugin.so
# -flto -fuse-linker-plugin
# used to collect files from HAL folders tree
TGT_BIN :=
COREINCLUDES = -I$(HAL_HW_PATH) -I$(STM32_PATH) -I$(WIRISH_PATH) -I$(BOARDS_PATH)/$(BOARD) -I$(STM32USB_PATH) \
-I$(HARDWARE_PATH) \
-I$(STM32_PATH)/Libraries/STM32F4xx_StdPeriph_Driver/inc \
-I$(STM32_PATH)/Libraries/CMSIS/Include \
-I$(STM32_PATH)/Libraries/CMSIS/Device/ST/STM32F4xx/Include \
-I$(BUILDROOT)/libraries/GCS_MAVLink/ \
-I$(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/v2.0
TGT_ASFLAGS = $(COREINCLUDES)
##
## Build rules and useful templates
##
include $(MK_DIR)/find_tools.mk
# all subfolder's rules
include $(WIRISH_PATH)/rules.mk
include $(HARDWARE_PATH)/hal/rules.mk
include $(HARDWARE_PATH)/4way/rules.mk
include $(HARDWARE_PATH)/sd/rules.mk
include $(HARDWARE_PATH)/STM32_USB_Driver/rules.mk
include $(HARDWARE_PATH)/STM32F4xx_DSP_StdPeriph_Lib_V1.1.0/rules.mk
include $(MK_DIR)/build_rules.mk
LIBGCC := $(shell $(CC) $(GLOBAL_FLAGS) -print-libgcc-file-name)
CFLAGS = $(GLOBAL_CFLAGS) $(TGT_CFLAGS) $(COREINCLUDES) -I$(LIBRARIES_PATH) $(LIBRARY_INCLUDES)
CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TGT_CFLAGS) $(COREINCLUDES) -I$(LIBRARIES_PATH) $(LIBRARY_INCLUDES) $(GITFLAGS)
ASFLAGS = $(GLOBAL_ASFLAGS) $(TGT_ASFLAGS)
##
## Set all submodules here
##
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES)
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES)
################################################################################
# Built products
#
# Library object files
LIBOBJS := $(SKETCHLIBOBJS)
# The ELF file
SKETCHELF = $(BUILDROOT)/$(SKETCH).elf
BUILDELF = $(notdir $(SKETCHELF))
# HEX file
SKETCHHEX = $(BUILDROOT)/$(SKETCH).hex
# BIN file
SKETCHBIN = $(BUILDROOT)/$(SKETCH).bin
# EEP file
SKETCHEEP = $(BUILDROOT)/$(SKETCH).eep
# Map file
SKETCHMAP = $(BUILDROOT)/$(SKETCH).map
# All of the objects that may be built
ALLOBJS = $(SKETCHOBJS) $(LIBOBJS)
# All of the dependency files that may be generated
ALLDEPS = $(ALLOBJS:%.o=%.d)
CAT := cat
FIND := /usr/bin/find
################################################################################
# Targets
#
all: $(SKETCHELF) $(SKETCHEEP) $(BUILD_PATH)/$(BOARD).bin
print-%:
echo "$*=$($*)"
.PHONY: upload
#upload via maple bootloader
f4light-maple-upload: $(SKETCHBIN)
$(LIBMAPLE_PATH)/support/scripts/reset.py && sleep 1 && $(UPLOADER) -a1 -d $(USBID) -D $(SKETCHBIN) -R
#upload via BOOT0 hardware bootloader
f4light-upload: $(SKETCHBIN)
$(UPLOADER) -a 0 --dfuse-address $(FLASH_ADDRESS) -D $(SKETCHBIN) -R
# sorry byt I use ST_LINK and SWD, not JTAG - @NG
#f4light-debug:
# $(AVARICE) --mkII --capture --jtag usb :4242 & \
# gnome-terminal -x $(GDB) $(SKETCHELF) & \
# echo -e '\n\nat the gdb prompt type "target remote localhost:4242"'
## this allows you to flash your image via JTAG for when you
## have completely broken your USB
#f4light-jtag-program:
# $(AVARICE) --mkII --jtag usb --erase --program --file $(SKETCHELF)
f4light-debug:
$(STUTIL) -m -p 4242
## this allows you to flash your image via SWD for when you have completely broken your USB
f4light-program:
$(STFLASH) --reset write $(SKETCHBIN) $(FLASH_ADDRESS)
################################################################################
# Rules
#
# fetch dependency info from a previous build if any of it exists
-include $(ALLDEPS)
f4light-clean: clean
$(v) $(FIND) $(HAL_PATH) -type f -name "*.d" -delete
$(v) $(FIND) $(HAL_PATH) -type f -name "*.o" -delete
$(v) $(FIND) $(HAL_PATH) -type f -name "*.i" -delete
$(v) $(FIND) $(HAL_PATH) -type f -name "*.ii" -delete
$(v) $(FIND) $(HAL_PATH) -type f -name "*.d" -delete
# Link the final object. this line sets compilation order
$(SKETCHELF): $(LIBOBJS) $(TGT_BIN) $(BUILD_PATH)/main.o $(SKETCHOBJS)
$(RULEHDR)
# $(v)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o $(SKETCHOBJS) $(LIBOBJS) $(LIBS) $(LIBGCC) -Wl,-Map,$(BUILD_PATH)/$(BOARD).map
# $(v) $(LD) $(LDFLAGS) -Map $(BUILD_PATH)/$(BOARD).map -o $(TGT_BIN) --start-group $(BUILD_PATH)/main.o $(SKETCHOBJS) $(LIBOBJS) $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
#
$(v)cp $(SKETCHELF) .
@echo "Firmware is in $(BUILDELF)"
# Create the eep file
$(SKETCHEEP): $(SKETCHELF)
$(RULEHDR)
$(v)$(OBJCOPY) -O ihex -j.eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@
$(BUILD_PATH)/main.o: $(WIRISH_PATH)/main.cxx
$(SILENT_CXX) $(CXX) $(CXXFLAGS) $(LIBRARY_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/$(BOARD).bin: $(SKETCHELF)
$(SILENT_OBJCOPY) $(OBJCOPY) -v -Obinary $(SKETCHELF) --gap-fill 0xFF $@ 1>/dev/null
$(OBJCOPY) -v -Oihex $(SKETCHELF) $(BUILD_PATH)/$(BOARD).hex 1>/dev/null
$(SILENT_DISAS) $(DISAS) -S $(SKETCHELF) > $(BUILD_PATH)/$(BOARD).disas
@echo " "
$(TOOLS_PATH)/dfu-convert --ihex $(BUILD_PATH)/$(BOARD).hex $(BUILD_PATH)/$(BOARD).dfu
# python $(APJTOOL) --image $(BUILD_PATH)/$(BOARD).bin --prototype $(BUILDROOT)/apj.prototype > $(BUILD_PATH)/$(BOARD).apj
python $(APJTOOL) --image $(BUILD_PATH)/$(BOARD).bin --board_id $(BOARD_TYPE) --board_revision $(BOARD_REV) > $(BUILD_PATH)/$(BOARD).apj
dd if=/dev/zero ibs=1k count=64 | tr "\000" "\377" >$(BUILDROOT)/rom.bin
dd if=$(BOOTLOADERS)/$(BOOTLOADER).bin of=$(BUILDROOT)/rom.bin conv=notrunc
(printf '%02x %02x' "$(BOARD_TYPE)" "$(BOARD_REV)" ) | xxd -r -p - $(BUILDROOT)/board_id.bin
dd if=$(BUILDROOT)/board_id.bin of=$(BUILDROOT)/rom.bin obs=1 seek=16368 conv=notrunc
(cat $(BUILDROOT)/rom.bin; cat $(BUILD_PATH)/$(BOARD).bin) > $(BUILD_PATH)/$(BOARD)_bl.bin
$(TOOLS_PATH)/dfu-convert -b $(BL_ADDRESS):$(BUILDROOT)/rom.bin -b $(FLASH_ADDRESS):$(BUILD_PATH)/$(BOARD).bin $(BUILD_PATH)/$(BOARD)_bl.dfu
$(v)cp $(BUILD_PATH)/$(BOARD).hex .
$(v)cp $(BUILD_PATH)/$(BOARD).bin .
$(v)cp $(BUILD_PATH)/$(BOARD).dfu .
$(v)cp $(BUILD_PATH)/$(BOARD).apj .
$(v)cp $(BUILD_PATH)/$(BOARD)_bl.bin .
$(v)cp $(BUILD_PATH)/$(BOARD)_bl.dfu .
@echo "Object file sizes:"
@find $(BUILD_PATH) -iname "*.o" | xargs $(SIZE) -t > $(BUILD_PATH)/$(BOARD).sizes
cd $(HAL_PATH); find . -follow -iname "*.o" | xargs $(SIZE) -t >> $(BUILD_PATH)/$(BOARD).sizes
@cat $(BUILD_PATH)/$(BOARD).sizes
@echo " "
@echo "Final Size:"
@$(SIZE) $<
@echo $(MEMORY_TARGET) > $(BUILD_PATH)/build-type
#
# Build sketch objects
#

View File

@ -1,8 +0,0 @@
TOOLCHAIN = NATIVE
include $(MK_DIR)/find_tools.mk
# Linux build is just the same as SITL for now
LIBS = -lm -pthread -lrt
include $(MK_DIR)/board_native.mk
include $(MK_DIR)/upload_firmware.mk

View File

@ -1,146 +0,0 @@
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
#
DEFINES = -DF_CPU=$(F_CPU)
DEFINES += -DSKETCH=\"$(SKETCH)\" -DSKETCHNAME="\"$(SKETCH)\"" -DSKETCHBOOK="\"$(SKETCHBOOK)\"" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
DEFINES += $(EXTRAFLAGS)
DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) -DCONFIG_HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE)
WARNFLAGS = -Wall -Wextra -Wformat -Wshadow -Wpointer-arith -Wcast-align \
-Wlogical-op -Wwrite-strings -Wformat=2 -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs
WARNFLAGSCXX = \
-Wno-missing-field-initializers \
-Wno-reorder \
-Werror=format-security \
-Werror=array-bounds \
-Werror=unused-but-set-variable \
-Werror=uninitialized \
-Werror=init-self \
-Wfatal-errors \
-Wundef \
-Wno-unknown-warning-option \
-Wno-trigraphs
DEPFLAGS = -MD -MP -MT $@
CXXOPTS = -ffunction-sections -fdata-sections -fno-exceptions -fsigned-char
COPTS = -ffunction-sections -fdata-sections -fsigned-char
ASOPTS = -x assembler-with-cpp
# features: TODO detect dependecy and make them optional
HAVE_LTTNG_UST=
ifeq ($(HAVE_LTTNG_UST),1)
DEFINES += -DHAVE_LTTNG_UST=1
LIBS += -llttng-ust -ldl
endif
# disable as this breaks distcc
#ifneq ($(SYSTYPE),Darwin)
#LISTOPTS = -adhlns=$(@:.o=.lst)
#endif
CPUFLAGS = -D_GNU_SOURCE
CPULDFLAGS = -g
OPTFLAGS ?= -O3 -g
CXXFLAGS = -g $(CPUFLAGS) $(DEFINES) $(OPTFLAGS)
CXXFLAGS += -std=gnu++11 $(WARNFLAGS) $(WARNFLAGSCXX) $(DEPFLAGS) $(CXXOPTS)
CFLAGS = -g $(CPUFLAGS) $(DEFINES) -Wa,$(LISTOPTS) $(OPTFLAGS)
CFLAGS += $(WARNFLAGS) $(DEPFLAGS) $(COPTS)
ASFLAGS = -g $(CPUFLAGS) $(DEFINES) -Wa,$(LISTOPTS) $(DEPFLAGS)
ASFLAGS += $(ASOPTS)
LDFLAGS = -g $(CPUFLAGS) $(OPTFLAGS) $(WARNFLAGS)
ifneq ($(SYSTYPE),Darwin)
LDFLAGS += -Wl,--gc-sections -Wl,-Map -Wl,$(SKETCHMAP)
endif
LIBS ?= -lm -pthread
ifneq ($(SYSTYPE),Darwin)
LIBS += -lrt
endif
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
LIBS += -lwinmm
endif
ifeq ($(VERBOSE),)
v = @
else
v =
endif
# Library object files
LIBOBJS := $(SKETCHLIBOBJS)
################################################################################
# Built products
#
# The ELF file
SKETCHELF = $(BUILDROOT)/$(SKETCH).elf
BUILDELF = $(notdir $(SKETCHELF))
# HEX file
SKETCHHEX = $(BUILDROOT)/$(SKETCH).hex
# EEP file
SKETCHEEP = $(BUILDROOT)/$(SKETCH).eep
# Map file
SKETCHMAP = $(BUILDROOT)/$(SKETCH).map
# All of the objects that may be built
ALLOBJS = $(SKETCHOBJS) $(LIBOBJS)
# All of the dependency files that may be generated
ALLDEPS = $(ALLOBJS:%.o=%.d)
################################################################################
# Targets
#
all: $(SKETCHELF)
print-%:
echo "$*=$($*)"
################################################################################
# Rules
#
# fetch dependency info from a previous build if any of it exists
-include $(ALLDEPS)
# Link the final object
$(SKETCHELF): $(SKETCHOBJS) $(LIBOBJS)
@echo "Building $(SKETCHELF)"
$(RULEHDR)
$(v)$(LD) $(LDFLAGS) -o $@ $(SKETCHOBJS) $(LIBOBJS) $(LIBS)
$(v)cp $(SKETCHELF) .
@echo "Firmware is in $(BUILDELF)"
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

View File

@ -1,3 +0,0 @@
TOOLCHAIN = NATIVE
include $(MK_DIR)/find_tools.mk
include $(MK_DIR)/px4_targets.mk

View File

@ -1,3 +0,0 @@
TOOLCHAIN = NATIVE
include $(MK_DIR)/find_tools.mk
include $(MK_DIR)/vrbrain_targets.mk

View File

@ -1,36 +0,0 @@
#
# Build sketch objects
#
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
$(RULEHDR)
$(v)$(CCACHE) $(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
$(RULEHDR)
$(v)$(CCACHE) $(CXX) $(CXXFLAGS) -c -o $@ $*.cpp $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.c $(UAVCAN_HEADERS)
$(RULEHDR)
$(v)$(CCACHE) $(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
#
# Build library objects from sources in the sketchbook
#
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp $(GENERATE_TARGETS) $(MAVLINK_HEADERS) $(UAVCAN_HEADERS)
$(RULEHDR)
$(v)$(CCACHE) $(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.c
$(RULEHDR)
$(v)$(CCACHE) $(CC) $(CFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SLIB_INCLUDES)

View File

@ -1,2 +0,0 @@
configure:
@echo "make configure is no longer required"

View File

@ -1,163 +0,0 @@
# find key paths and system type
# Save the system type for later use.
#
SYSTYPE := $(shell uname)
GIT_VERSION ?= $(shell git rev-parse HEAD | cut -c1-8)
EXTRAFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\""
# Add missing parts from libc and libstdc++ for all boards
EXTRAFLAGS += -I$(SKETCHBOOK)/libraries/AP_Common/missing
# force LANG to C so awk works sanely on MacOS
export LANG=C
#
# Locate the sketch sources based on the initial Makefile's path
#
SRCROOT := $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
# Workaround a $(realpath ) bug on cygwin
ifeq ($(SRCROOT),)
SRCROOT := $(shell cygpath -m ${CURDIR})
$(warning your realpath function is not working)
$(warning > setting SRCROOT to $(SRCROOT))
endif
endif
#
# We need to know the location of the sketchbook. If it hasn't been overridden,
# try the parent of the current directory. If there is no libraries directory
# there, assume that we are in a library's examples directory and try backing up
# further.
#
ifeq ($(SKETCHBOOK),)
SKETCHBOOK := $(shell cd $(SRCROOT)/.. && pwd)
ifeq ($(wildcard $(SKETCHBOOK)/libraries),)
$(error ERROR: cannot determine sketchbook location - please specify on the commandline with SKETCHBOOK=<path>)
endif
else
ifeq ($(wildcard $(SKETCHBOOK)/libraries),)
$(warning WARNING: sketchbook directory $(SKETCHBOOK) contains no libraries)
endif
endif
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
# Convert cygwin path into a windows normal path
SKETCHBOOK := $(shell cygpath ${SKETCHBOOK})
endif
ifneq ($(wildcard $(SKETCHBOOK)/config.mk),)
$(info Reading $(SKETCHBOOK)/config.mk)
include $(SKETCHBOOK)/config.mk
endif
ifneq ($(wildcard $(SKETCHBOOK)/developer.mk),)
$(info Reading $(SKETCHBOOK)/developer.mk)
include $(SKETCHBOOK)/developer.mk
endif
#
# Work out the sketch name from the name of the source directory.
#
SKETCH := $(lastword $(subst /, ,$(SRCROOT)))
# Workaround a $(lastword ) bug on cygwin
ifeq ($(SKETCH),)
WORDLIST := $(subst /, ,$(SRCROOT))
SKETCH := $(word $(words $(WORDLIST)),$(WORDLIST))
endif
#
# Work out where we are going to be building things
#
TMPDIR ?= /tmp
ifneq ($(findstring px4, $(MAKECMDGOALS)),)
# when building px4 we need all sources to be inside the sketchbook directory
# as the NuttX build system relies on it
BUILDROOT := $(SKETCHBOOK)/Build.$(SKETCH)
endif
ifneq ($(findstring vrbrain, $(MAKECMDGOALS)),)
# when building vrbrain we need all sources to be inside the sketchbook directory
# as the NuttX build system relies on it
BUILDROOT := $(SKETCHBOOK)/Build.$(SKETCH)
endif
ifneq ($(findstring vrubrain, $(MAKECMDGOALS)),)
# when building vrbrain we need all sources to be inside the sketchbook directory
# as the NuttX build system relies on it
BUILDROOT := $(SKETCHBOOK)/Build.$(SKETCH)
endif
ifneq ($(findstring vrcore, $(MAKECMDGOALS)),)
# when building vrcore we need all sources to be inside the sketchbook directory
# as the NuttX build system relies on it
BUILDROOT := $(SKETCHBOOK)/Build.$(SKETCH)
endif
ifeq ($(BUILDROOT),)
BUILDROOT := $(abspath $(TMPDIR)/$(SKETCH).build)
endif
ifneq ($(findstring CYGWIN, $(SYSTYPE)),)
# Workaround a $(abspath ) bug on cygwin
ifeq ($(BUILDROOT),)
BUILDROOT := C:$(TMPDIR)/$(SKETCH).build
$(warning your abspath function is not working)
$(warning > setting BUILDROOT to $(BUILDROOT))
else
BUILDROOT := $(shell cygpath ${BUILDROOT})
endif
endif
ifneq ($(findstring mavlink1, $(MAKECMDGOALS)),)
EXTRAFLAGS += -DMAVLINK_PROTOCOL_VERSION=1
MAVLINK_SUBDIR=v1.0
MAVLINK_WIRE_PROTOCOL=1.0
else
EXTRAFLAGS += -DMAVLINK_PROTOCOL_VERSION=2
MAVLINK_SUBDIR=v2.0
MAVLINK_WIRE_PROTOCOL=2.0
endif
ifneq ($(APPDIR),)
# this is a recusive PX4 build
HAL_BOARD = HAL_BOARD_PX4
endif
# handle target based overrides for board type
ifneq ($(findstring px4, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_PX4
endif
ifneq ($(findstring sitl, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_SITL
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
ifneq ($(findstring vrbrain, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_VRBRAIN
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
ifneq ($(findstring vrubrain, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_VRBRAIN
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
ifneq ($(findstring vrcore, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_VRBRAIN
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
ifneq ($(findstring f4light, $(MAKECMDGOALS)),)
HAL_BOARD = HAL_BOARD_F4LIGHT
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif
# default to SITL
ifeq ($(HAL_BOARD),)
HAL_BOARD = HAL_BOARD_SITL
HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE
endif

View File

@ -1,68 +0,0 @@
################################################################################
# Tools
#
#
# Decide where we are going to look for tools
#
ifeq ($(SYSTYPE),Darwin)
# use the tools that come with Arduino
# use BWK awk
AWK = awk
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1),$(TOOLPATH))))
endif
ifeq ($(SYSTYPE),Linux)
# expect that tools are on the path
TOOLPATH := $(subst :, ,$(PATH))
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1),$(TOOLPATH))))
endif
ifeq ($(findstring CYGWIN, $(SYSTYPE)),CYGWIN)
TOOLPATH := $(subst :, ,$(PATH))
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1).exe,$(TOOLPATH))))
endif
ifeq ($(findstring MINGW, $(SYSTYPE)),MINGW)
# expect that tools are on the path
TOOLPATH := $(subst :, ,$(PATH))
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1).exe,$(TOOLPATH))))
endif
NATIVE_CXX := g++
NATIVE_CC := gcc
NATIVE_AS := gcc
NATIVE_AR := ar
NATIVE_LD := g++
NATIVE_GDB := gdb
NATIVE_OBJCOPY := objcopy
AVARICE := $(call FIND_TOOL,avarice)
# enable ccache if installed
CCACHE := $(call FIND_TOOL,ccache)
export CCACHE
# toolchain used for sitl-arm
RPI_CXX := arm-linux-gnueabihf-g++
RPI_CC := arm-linux-gnueabihf-gcc
RPI_AS := arm-linux-gnueabihf-gcc
RPI_AR := arm-linux-gnueabihf-ar
RPI_LD := arm-linux-gnueabihf-g++
RPI_GDB := arm-linux-gnueabihf-gdb
RPI_OBJCOPY := arm-linux-gnueabihf-obj
CXX = $(CCACHE) $($(TOOLCHAIN)_CXX)
CC = $(CCACHE) $($(TOOLCHAIN)_CC)
AS = $($(TOOLCHAIN)_AS)
AR = $($(TOOLCHAIN)_AR)
LD = $($(TOOLCHAIN)_LD)
GDB = $($(TOOLCHAIN)_GDB)
OBJCOPY = $($(TOOLCHAIN)_OBJCOPY)
ifeq ($(CXX),)
$(error ERROR: cannot find the compiler tools for $(TOOLCHAIN) anywhere on the path $(TOOLPATH))
endif
# Find awk
AWK ?= gawk
ifeq ($(shell which $(AWK)),)
$(error ERROR: cannot find $(AWK) - you may need to install GNU awk)
endif

View File

@ -1,32 +0,0 @@
help:
@echo ""
@echo " ArduPilot Building"
@echo " =================="
@echo ""
@echo " The following web page has detailed information on building the code"
@echo " http://dev.ardupilot.org/wiki/building-the-code/"
@echo ""
@echo " Linux boards should use waf build system"
@echo ""
@echo " Before building a target you need to be in the target vehicle type directory"
@echo " e.g. ArduPlane, ArduCopter, APMrover2, AntennaTracker"
@echo ""
@echo " Most targets support a \"-upload\" extension to upload the firmware"
@echo " to a connected board. e.g. \"make px4-v2-upload\""
@echo ""
@echo " Some targets support a \"-debug\" extension to enable a debug build"
@echo " (with debug symbols, and without optimisation)"
@echo ""
@echo " Note that the px4 builds are NOT parallel safe, NO -j flag"
@echo ""
@echo ""
@echo " Targets"
@echo " -------"
@echo ""
@echo " px4-v1 - the PX4v1 board"
@echo " px4-v2 - the Pixhawk"
@echo " px4-v3 - the Pixhawk with 2M flash"
@echo " px4-v4 - the XRacer"
@echo " vrbrain - the VRBrain boards"
@echo " sitl - the SITL Software In The Loop simulation"
@echo " f4light - the OpenPilot Revolution, Revolution Mini, AirbotF4 and similar boards"

View File

@ -1,12 +0,0 @@
# mavlink header generation
MAVLINK_DIR := $(SKETCHBOOK)/modules/mavlink/
MESSAGE_DEFINITIONS := $(SKETCHBOOK)/modules/mavlink/message_definitions/v1.0
MAVLINK_HEADERS := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/ardupilotmega/mavlink.h $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/,*.h) $(wildcard $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)/ardupilotmega,*.h)
MAVLINK_OUTPUT_DIR := $(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink/$(MAVLINK_SUBDIR)
$(MAVLINK_HEADERS): $(MESSAGE_DEFINITIONS)/ardupilotmega.xml $(MESSAGE_DEFINITIONS)/common.xml
echo "Generating MAVLink headers..."
#goto mavlink module directory and run the most recent generator script
echo "Generating C code using mavgen.py located at" $(SKETCHBOOK)/modules/mavlink/
PYTHONPATH=$(MAVLINK_DIR) python $(MAVLINK_DIR)/pymavlink/tools/mavgen.py --lang=C --wire-protocol=$(MAVLINK_WIRE_PROTOCOL) --output=$(MAVLINK_OUTPUT_DIR) $(MESSAGE_DEFINITIONS)/ardupilotmega.xml; if [ $$? -le 0 -o $$? -gt 128 ]; then echo "mavgen: success"; exit 0; else echo "mavgen: failed"; exit 1; fi

View File

@ -1,28 +0,0 @@
# git submodule support
define echowarning
@echo "WARNING: $1" >&2
endef
define echoallwarnings
$(call echowarning)
$(call echowarning)
$(call echowarning,make build system is deprecated for Linux boards)
$(call echowarning,new features are not going to be added anymore)
$(call echowarning,See README-WAF.md: https://github.com/ArduPilot/ardupilot/blob/master/README-WAF.md)
$(call echowarning)
$(call echowarning,The make build system will soon be removed)
$(call echowarning)
$(call echowarning)
endef
CHECK_MODULES:
$(if $(BUILDSYS_DEPRECATED),$(call echoallwarnings))
$(v)$(MK_DIR)/check_modules.sh
.PHONY: CHECK_MODULES
all: CHECK_MODULES
module-update:
git submodule update

View File

@ -1,254 +0,0 @@
# PX4 build is via external build system
ifneq ($(PX4_ROOT),)
$(error PX4_ROOT found in config.mk - Please see http://dev.ardupilot.org/wiki/git-submodules/)
endif
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
# these can be overridden in developer.mk
PX4FIRMWARE_DIRECTORY ?= $(SKETCHBOOK)/modules/PX4Firmware
PX4NUTTX_DIRECTORY ?= $(SKETCHBOOK)/modules/PX4NuttX
UAVCAN_DIRECTORY ?= $(SKETCHBOOK)/modules/uavcan
PX4_ROOT := $(shell cd $(PX4FIRMWARE_DIRECTORY) && pwd)
NUTTX_ROOT := $(shell cd $(PX4NUTTX_DIRECTORY) && pwd)
NUTTX_SRC := $(NUTTX_ROOT)/nuttx/
UAVCAN_DIR=$(shell cd $(UAVCAN_DIRECTORY) && pwd)/
NUTTX_GIT_VERSION ?= $(shell cd $(NUTTX_SRC) && git rev-parse HEAD | cut -c1-8)
PX4_GIT_VERSION ?= $(shell cd $(PX4_ROOT) && git rev-parse HEAD | cut -c1-8)
EXTRAFLAGS += -DNUTTX_GIT_VERSION="\"$(NUTTX_GIT_VERSION)\""
EXTRAFLAGS += -DPX4_GIT_VERSION="\"$(PX4_GIT_VERSION)\""
EXTRAFLAGS += -DUAVCAN=1
EXTRAFLAGS += -D__STDC_FORMAT_MACROS
# Add missing parts from libc and libstdc++
EXTRAFLAGS += -DHAVE_STD_NULLPTR_T=0
EXTRAFLAGS += -DHAVE_ENDIAN_H=0
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
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
PX4_V4PRO_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v4pro_APM.mk
# 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-attributes -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 -Wno-trigraphs
OPTFLAGS = -fsingle-precision-constant
# avoid PX4 submodules
export GIT_SUBMODULES_ARE_EVIL = 1
PYTHONPATH=$(SKETCHBOOK)/mk/PX4/Tools/genmsg/src:$(SKETCHBOOK)/mk/PX4/Tools/gencpp/src
export PYTHONPATH
PX4_MAKE = $(v)+ GIT_SUBMODULES_ARE_EVIL=1 ARDUPILOT_BUILD=1 $(MAKE) -C $(SKETCHBOOK) -f $(PX4_ROOT)/Makefile.make EXTRADEFINES="$(SKETCHFLAGS) $(WARNFLAGS) $(OPTFLAGS) "'$(EXTRAFLAGS)' APM_MODULE_DIR=$(SKETCHBOOK) SKETCHBOOK=$(SKETCHBOOK) CCACHE=$(CCACHE) PX4_ROOT=$(PX4_ROOT) NUTTX_SRC=$(NUTTX_SRC) MAXOPTIMIZATION="-Os" UAVCAN_DIR=$(UAVCAN_DIR)
PX4_MAKE_ARCHIVES = $(MAKE) -C $(PX4_ROOT) -f $(PX4_ROOT)/Makefile.make NUTTX_SRC=$(NUTTX_SRC) CCACHE=$(CCACHE) archives MAXOPTIMIZATION="-Os"
HASHADDER_FLAGS += --ardupilot "$(SKETCHBOOK)"
ifneq ($(wildcard $(PX4_ROOT)),)
HASHADDER_FLAGS += --px4 "$(PX4_ROOT)"
endif
ifneq ($(wildcard $(NUTTX_SRC)/..),)
HASHADDER_FLAGS += --nuttx "$(NUTTX_SRC)/.."
endif
HASHADDER_FLAGS += --uavcan "$(UAVCAN_DIR)"
.PHONY: module_mk
module_mk:
$(v) echo "Building $(SKETCHBOOK)/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) $(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) $(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/
$(v) $(PX4_MAKE) px4fmu-v1_APM
$(v) arm-none-eabi-size $(PX4_ROOT)/Build/px4fmu-v1_APM.build/firmware.elf
$(v) cp $(PX4_ROOT)/Images/px4fmu-v1_APM.px4 $(SKETCH)-v1.px4
$(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) $(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/
$(PX4_MAKE) px4fmu-v2_APM
$(v) arm-none-eabi-size $(PX4_ROOT)/Build/px4fmu-v2_APM.build/firmware.elf
$(v) cp $(PX4_ROOT)/Images/px4fmu-v2_APM.px4 $(SKETCH)-v2.px4
$(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) $(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/
$(PX4_MAKE) px4fmu-v3_APM
$(v) arm-none-eabi-size $(PX4_ROOT)/Build/px4fmu-v3_APM.build/firmware.elf
$(v) cp $(PX4_ROOT)/Images/px4fmu-v3_APM.px4 $(SKETCH)-v3.px4
$(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) $(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/
$(PX4_MAKE) px4fmu-v4_APM
$(v) arm-none-eabi-size $(PX4_ROOT)/Build/px4fmu-v4_APM.build/firmware.elf
$(v) cp $(PX4_ROOT)/Images/px4fmu-v4_APM.px4 $(SKETCH)-v4.px4
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/bootloader/
$(v) cp $(SKETCHBOOK)/Tools/bootloaders/px4fmuv4_bl.bin $(MK_DIR)/PX4/ROMFS/bootloader/fmu_bl.bin
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v4.px4" "$(SKETCH)-v4.px4"
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v4.px4"
px4-v4pro: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(PX4_ROOT)/Archives/px4fmu-v4pro.export $(SKETCHCPP) module_mk px4-io-v2
$(v) echo Building px4-v4pro
$(RULEHDR)
$(v) cp $(PX4_V4PRO_CONFIG_FILE) $(PX4_ROOT)/makefiles/nuttx/
$(PX4_MAKE) px4fmu-v4pro_APM
$(v) arm-none-eabi-size $(PX4_ROOT)/Build/px4fmu-v4pro_APM.build/firmware.elf
$(v) cp $(PX4_ROOT)/Images/px4fmu-v4pro_APM.px4 $(SKETCH)-v4pro.px4
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-v4pro.px4" "$(SKETCH)-v4pro.px4"
$(v) echo "PX4 $(SKETCH) Firmware is in $(SKETCH)-v4pro.px4"
# force the 3 build types to not run in parallel. We got bad binaries with incorrect parameter handling
# when these were allowed to happen in parallel
px4:
$(MAKE) px4-v1
$(MAKE) px4-v2
$(MAKE) px4-v3
$(MAKE) px4-v4
$(MAKE) px4-v4pro
px4-clean: clean CHECK_MODULES px4-archives-clean px4-cleandep
$(v) /bin/rm -rf $(PX4_ROOT)/makefiles/build $(PX4_ROOT)/Build $(PX4_ROOT)/Images/*.px4 $(PX4_ROOT)/Images/*.bin
$(v) /bin/rm -rf $(PX4_ROOT)/src/modules/uORB/topics $(PX4_ROOT)/src/platforms/nuttx/px4_messages
$(v) /bin/rm -rf $(SKETCHBOOK)/modules/uavcan/libuavcan/include/dsdlc_generated
$(v) /bin/rm -f $(SRCROOT)/*.o
px4-cleandep: clean
$(v) mkdir -p $(PX4_ROOT)/Build
$(v) find $(PX4_ROOT)/Build -type f -name '*.d' | xargs rm -f
$(v) find $(UAVCAN_DIRECTORY) -type f -name '*.d' | xargs rm -f
$(v) find $(SKETCHBOOK)/$(SKETCH) -type f -name '*.d' | xargs rm -f
$(v) /bin/rm -rf $(SKETCHBOOK)/modules/uavcan/libuavcan/include/dsdlc_generated
px4-v2-upload-solo: px4-v2
scp $(SKETCH)-v2.px4 root@10.1.1.10:/tmp/
ssh root@10.1.1.10 PYTHONUNBUFFERED=1 loadPixhawk.py /tmp/ArduCopter-v2.px4
ssh root@10.1.1.10 rm /tmp/ArduCopter-v2.px4;
px4-v1-upload: px4-v1
$(RULEHDR)
$(v) $(PX4_MAKE) px4fmu-v1_APM upload
px4-v2-upload: px4-v2
$(RULEHDR)
$(v) $(PX4_MAKE) px4fmu-v2_APM upload
px4-v3-upload: px4-v3
$(RULEHDR)
$(v) $(PX4_MAKE) px4fmu-v3_APM upload
px4-v4-upload: px4-v4
$(RULEHDR)
$(v) $(PX4_MAKE) px4fmu-v4_APM upload
px4-v4pro-upload: px4-v4pro
$(RULEHDR)
$(v) $(PX4_MAKE) px4fmu-v4pro_APM upload
px4-upload: px4-v1-upload
px4-archives-clean:
$(v) /bin/rm -rf $(PX4_ROOT)/Archives
px4-io-v1: $(PX4_ROOT)/Archives/px4io-v1.export
$(v)+ $(MAKE) -C $(PX4_ROOT) -f $(PX4_ROOT)/Makefile.make px4io-v1_default EXTRADEFINES="-DARDUPILOT_BUILD"
$(v) cp $(PX4_ROOT)/Images/px4io-v1_default.bin px4io-v1.bin
$(v) cp $(PX4_ROOT)/Build/px4io-v1_default.build/firmware.elf px4io-v1.elf
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/px4io/
$(v) cp px4io-v1.bin $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/bootloader/
$(v) cp $(SKETCHBOOK)/Tools/bootloaders/px4fmu_bl.bin $(MK_DIR)/PX4/ROMFS/bootloader/fmu_bl.bin
$(v) echo "PX4IOv1 Firmware is in px4io-v1.bin"
px4-io-v2: $(PX4_ROOT)/Archives/px4io-v2.export
$(v)+ $(MAKE) -C $(PX4_ROOT) -f $(PX4_ROOT)/Makefile.make px4io-v2_default EXTRADEFINES="-DARDUPILOT_BUILD"
$(v) cp $(PX4_ROOT)/Images/px4io-v2_default.bin px4io-v2.bin
$(v) cp $(PX4_ROOT)/Build/px4io-v2_default.build/firmware.elf px4io-v2.elf
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/px4io/
$(v) cp px4io-v2.bin $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/bootloader/
$(v) cp $(SKETCHBOOK)/Tools/bootloaders/px4fmuv2_bl.bin $(MK_DIR)/PX4/ROMFS/bootloader/fmu_bl.bin
$(v) echo "PX4IOv2 Firmware is in px4io-v2.bin"
px4-io: px4-io-v1 px4-io-v2
# These targets can't run in parallel because they all need to generate a tool
# to generate the config.h inside them. This could trigger races if done in
# parallel, trying to generate the tool and replacing it while the header is already
# being generated
#
# We could serialize inside PX4Firmware, but it's easier to serialize here
# while maintaining the rest of the build parallelized
.NOTPARALLEL: \
$(PX4_ROOT)/Archives/px4fmu-v1.export \
$(PX4_ROOT)/Archives/px4fmu-v2.export \
$(PX4_ROOT)/Archives/px4fmu-v3.export \
$(PX4_ROOT)/Archives/px4fmu-v4.export \
$(PX4_ROOT)/Archives/px4fmu-v4pro.export \
$(PX4_ROOT)/Archives/px4io-v1.export \
$(PX4_ROOT)/Archives/px4io-v2.export
$(PX4_ROOT)/Archives/px4fmu-v1.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4fmu-v1"
$(PX4_ROOT)/Archives/px4fmu-v2.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4fmu-v2"
$(PX4_ROOT)/Archives/px4fmu-v3.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4fmu-v3"
$(PX4_ROOT)/Archives/px4fmu-v4.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4fmu-v4"
$(PX4_ROOT)/Archives/px4fmu-v4pro.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4fmu-v4pro"
$(PX4_ROOT)/Archives/px4io-v1.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4io-v1"
$(PX4_ROOT)/Archives/px4io-v2.export:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4io-v2"
px4-archives:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="px4io-v1 px4io-v2 px4fmu-v1 px4fmu-v2 px4fmu-v3 px4fmu-v4 px4fmu-v4pro"

View File

@ -1,105 +0,0 @@
################################################################################
# Sketch
#
SRCSUFFIXES = *.cpp
MAKE_INC=$(wildcard $(SRCROOT)/make.inc)
ifeq (,$(MAKE_INC))
$(error You must have a make.inc file to list library dependencies)
endif
GLOBAL_MAKE_INC=$(wildcard $(SKETCHBOOK)/mk/make.inc)
ifeq (,$(GLOBAL_MAKE_INC))
$(error You must have a make.inc in mk/ directory)
endif
# Sketch source files
SKETCHSRCS := $(wildcard $(addprefix $(SRCROOT)/,$(SRCSUFFIXES)))
SKETCHCPP := $(SRCROOT)/$(SKETCH).cpp
# Sketch object files
SKETCHOBJS := $(subst $(SRCROOT),$(BUILDROOT),$(SKETCHSRCS))
SKETCHOBJS := $(addsuffix .o,$(basename $(SKETCHOBJS)))
# get list of libraries from make.inc
include $(MAKE_INC)
include $(GLOBAL_MAKE_INC)
LIBTOKENS := $(LIBRARIES)
# HAL and board specific libraries are included here.
LIBTOKENS += \
AP_HAL \
AP_HAL_Empty
ifeq ($(HAL_BOARD),HAL_BOARD_APM1)
LIBTOKENS += \
AP_HAL_APM
endif
ifeq ($(HAL_BOARD),HAL_BOARD_APM2)
LIBTOKENS += \
AP_HAL_APM
endif
ifeq ($(HAL_BOARD),HAL_BOARD_SITL)
LIBTOKENS += \
AP_HAL_SITL \
SITL
endif
ifeq ($(HAL_BOARD),HAL_BOARD_LINUX)
LIBTOKENS += \
AP_HAL_Linux
endif
ifeq ($(HAL_BOARD),HAL_BOARD_PX4)
LIBTOKENS += \
AP_HAL_PX4
endif
ifeq ($(HAL_BOARD),HAL_BOARD_VRBRAIN)
LIBTOKENS += \
AP_HAL_VRBRAIN
endif
ifeq ($(HAL_BOARD),HAL_BOARD_F4LIGHT)
LIBTOKENS += \
AP_HAL_F4Light
endif
#
# Find sketchbook libraries referenced by the sketch.
#
# Include paths for sketch libraries
#
SKETCHLIBS := $(wildcard $(addprefix $(SKETCHBOOK)/libraries/,$(LIBTOKENS)))
SKETCHLIBNAMES := $(notdir $(SKETCHLIBS))
SKETCHLIBSRCDIRS := $(SKETCHLIBS) $(addsuffix /utility,$(SKETCHLIBS))
SKETCHLIBSRCS := $(wildcard $(foreach suffix,$(SRCSUFFIXES),$(addsuffix /$(suffix),$(SKETCHLIBSRCDIRS))))
SKETCHLIBOBJS := $(addsuffix .o,$(basename $(subst $(SKETCHBOOK),$(BUILDROOT),$(SKETCHLIBSRCS))))
SKETCHLIBINCLUDES := -I$(SKETCHBOOK)/libraries/ -I$(BUILDROOT)/libraries/ -I$(BUILDROOT)/libraries/GCS_MAVLink/
SKETCHLIBSRCSRELATIVE := $(subst $(SKETCHBOOK)/,,$(SKETCHLIBSRCS))
ifeq ($(VERBOSE),)
v = @
else
v =
endif
FORCE:
$(BUILDROOT)/make.flags: FORCE
@mkdir -p $(BUILDROOT)
@echo "// BUILDROOT=$(BUILDROOT) HAL_BOARD=$(HAL_BOARD) HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE) TOOLCHAIN=$(TOOLCHAIN) EXTRAFLAGS=$(EXTRAFLAGS)" > $(BUILDROOT)/make.flags.new
@cmp $(BUILDROOT)/make.flags $(BUILDROOT)/make.flags.new > /dev/null 2>&1 || rm -f $(SRCROOT)/*.o
@cmp $(BUILDROOT)/make.flags $(BUILDROOT)/make.flags.new > /dev/null 2>&1 || mv $(BUILDROOT)/make.flags.new $(BUILDROOT)/make.flags
@rm -f $(BUILDROOT)/make.flags.new
@cat $(BUILDROOT)/make.flags
# common header for rules, prints what is being built
define RULEHDR
@echo %% $(subst $(BUILDROOT)/,,$@)
@mkdir -p $(dir $@)
endef

View File

@ -1,86 +0,0 @@
default: help
# convenient targets for our supported boards
sitl: HAL_BOARD = HAL_BOARD_SITL
sitl: TOOLCHAIN = NATIVE
sitl: all
sitl-arm: HAL_BOARD = HAL_BOARD_SITL
sitl-arm: TOOLCHAIN = RPI
sitl-arm: all
apm1 apm1-1280 apm2 apm2beta:
$(error $@ is deprecated on master branch; use master-AVR)
flymaple flymaple-hil:
$(error $@ is deprecated on master branch; use master-AVR)
f4light: HAL_BOARD = HAL_BOARD_F4LIGHT
f4light: TOOLCHAIN = ARM
f4light: all
# cope with HIL targets
%-hil: EXTRAFLAGS += "-DHIL_MODE=HIL_MODE_SENSORS "
%-hilsensors: EXTRAFLAGS += "-DHIL_MODE=HIL_MODE_SENSORS "
# cope with OBC targets
%-obc: EXTRAFLAGS += "-DOBC_FAILSAFE=ENABLED "
# support debug build
%-debug: OPTFLAGS = -g -O0
# support address sanitiser
%-asan: OPTFLAGS = -g -O0 -fsanitize=address -fno-omit-frame-pointer
%-asan: LDFLAGS += -fsanitize=address
# cope with copter and hil targets
FRAMES = heli
BOARDS = apm1 apm2 apm2beta apm1-1280 px4-v1 px4-v2 px4-v3 px4-v4 px4-v4pro sitl flymaple
BOARDS += vrbrain
BOARDS += vrbrain-v51 vrbrain-v52 vrbrain-v52E vrbrain-v54
BOARDS += vrcore-v10
BOARDS += vrubrain-v51 vrubrain-v52
define frame_template
$(1)-$(2) : EXTRAFLAGS += "-DFRAME_CONFIG=$(shell echo $(2) | tr a-z A-Z | sed s/-/_/g)_FRAME "
$(1)-$(2) : $(1)
$(1)-$(2)-hil : $(1)-$(2)
$(1)-$(2)-debug : $(1)-$(2)
$(1)-$(2)-mavlink1 : $(1)-$(2)
$(1)-$(2)-debug-mavlink1 : $(1)-$(2)
$(1)-$(2)-hilsensors : $(1)-$(2)
$(1)-$(2)-upload : $(1)-$(2)
$(1)-$(2)-upload : $(1)-upload
endef
define board_template
$(1)-hil : $(1)
$(1)-debug : $(1)
$(1)-mavlink1 : $(1)
$(1)-debug-mavlink1 : $(1)-debug
$(1)-asan : $(1)
$(1)-hilsensors : $(1)
endef
USED_BOARDS := $(foreach board,$(BOARDS), $(findstring $(board), $(MAKECMDGOALS)))
USED_FRAMES := $(foreach frame,$(FRAMES), $(findstring $(frame), $(MAKECMDGOALS)))
# generate targets of the form BOARD-FRAME and BOARD-FRAME-HIL
$(foreach board,$(USED_BOARDS),$(eval $(call board_template,$(board))))
$(foreach board,$(USED_BOARDS),$(foreach frame,$(USED_FRAMES),$(eval $(call frame_template,$(board),$(frame)))))
sitl-mount: EXTRAFLAGS += "-DMOUNT=ENABLED"
sitl-mount: sitl
.PHONY: etags
etags:
cd .. && etags -f ArduCopter/TAGS --lang=c++ $$(git ls-files ArduCopter libraries)
cd .. && etags -f ArduPlane/TAGS --lang=c++ $$(git ls-files ArduPlane libraries)
cd .. && etags -f APMrover2/TAGS --lang=c++ $$(git ls-files APMrover2 libraries)
clean:
@rm -fr $(BUILDROOT)
include $(MK_DIR)/modules.mk
include $(MK_DIR)/uavcangen.mk
include $(MK_DIR)/mavgen.mk

View File

@ -1,21 +0,0 @@
#
#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)"

View File

@ -1,11 +0,0 @@
ifneq ($(BOARD_LINUX_HOST),)
upload: $(SKETCHELF).timestamp-upload
$(SKETCHELF).timestamp-upload: $(SKETCHELF)
scp $(SKETCHELF) $(BOARD_LINUX_HOST):
touch $@
else
upload:
@echo Check your config.mk: BOARD_LINUX_HOST should be defined to upload firmware
exit 1
endif

View File

@ -1,319 +0,0 @@
# VRBRAIN build is via external build system
ifneq ($(VRBRAIN_ROOT),)
$(error VRBRAIN_ROOT found in config.mk - Please see http://dev.ardupilot.org/wiki/git-submodules/)
endif
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
# these can be overridden in developer.mk
VRBRAINFIRMWARE_DIRECTORY ?= $(SKETCHBOOK)/modules/PX4Firmware
VRBRAINNUTTX_DIRECTORY ?= $(SKETCHBOOK)/modules/PX4NuttX
UAVCAN_DIRECTORY ?= $(SKETCHBOOK)/modules/uavcan
VRBRAIN_ROOT := $(shell cd $(VRBRAINFIRMWARE_DIRECTORY) && pwd)
NUTTX_ROOT := $(shell cd $(VRBRAINNUTTX_DIRECTORY) && pwd)
NUTTX_SRC := $(NUTTX_ROOT)/nuttx/
UAVCAN_DIR=$(shell cd $(UAVCAN_DIRECTORY) && pwd)/
NUTTX_GIT_VERSION ?= $(shell cd $(NUTTX_SRC) && git rev-parse HEAD | cut -c1-8)
PX4_GIT_VERSION ?= $(shell cd $(VRBRAIN_ROOT) && git rev-parse HEAD | cut -c1-8)
EXTRAFLAGS += -DNUTTX_GIT_VERSION="\"$(NUTTX_GIT_VERSION)\""
EXTRAFLAGS += -DPX4_GIT_VERSION="\"$(PX4_GIT_VERSION)\""
EXTRAFLAGS += -DUAVCAN=1
EXTRAFLAGS += -D__STDC_FORMAT_MACROS
# Add missing parts from libc and libstdc++
EXTRAFLAGS += -DHAVE_STD_NULLPTR_T=0
EXTRAFLAGS += -DHAVE_ENDIAN_H=0
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
VRBRAIN_MK_DIR=$(MK_DIR)/VRBRAIN
# we have different config files for vrbrain-v51, vrbrain-v52, vrbrain-v54, vrcore-v10, vrubrain-v51, vrubrain-v52
VRBRAIN_V51_CONFIG_FILE=config_vrbrain-v51_APM.mk
VRBRAIN_V52_CONFIG_FILE=config_vrbrain-v52_APM.mk
VRBRAIN_V52E_CONFIG_FILE=config_vrbrain-v52E_APM.mk
VRBRAIN_V54_CONFIG_FILE=config_vrbrain-v54_APM.mk
VRCORE_V10_CONFIG_FILE=config_vrcore-v10_APM.mk
VRUBRAIN_V51_CONFIG_FILE=config_vrubrain-v51_APM.mk
VRUBRAIN_V52_CONFIG_FILE=config_vrubrain-v52_APM.mk
# 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_VRBRAIN -DSKETCHNAME="\\\"$(SKETCH)\\\"" -DSKETCH_MAIN=ArduPilot_main -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH)
WARNFLAGS = -Wall -Wextra -Wlogical-op -Werror -Wno-attributes -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 -Wno-trigraphs
OPTFLAGS = -fsingle-precision-constant
# avoid VRBRAIN submodules
export GIT_SUBMODULES_ARE_EVIL = 1
PYTHONPATH=$(VRBRAIN_ROOT)/Tools/genmsg/src:$(VRBRAIN_ROOT)/Tools/gencpp/src
export PYTHONPATH
VRBRAIN_MAKE = $(v)+ GIT_SUBMODULES_ARE_EVIL=1 ARDUPILOT_BUILD=1 $(MAKE) -C $(SKETCHBOOK) -f $(VRBRAIN_ROOT)/Makefile.make EXTRADEFINES="$(SKETCHFLAGS) $(WARNFLAGS) $(OPTFLAGS) "'$(EXTRAFLAGS)' APM_MODULE_DIR=$(SKETCHBOOK) SKETCHBOOK=$(SKETCHBOOK) CCACHE=$(CCACHE) VRBRAIN_ROOT=$(VRBRAIN_ROOT) NUTTX_SRC=$(NUTTX_SRC) MAXOPTIMIZATION="-Os" UAVCAN_DIR=$(UAVCAN_DIR)
VRBRAIN_MAKE_ARCHIVES = $(MAKE) -C $(VRBRAIN_ROOT) -f $(VRBRAIN_ROOT)/Makefile.make NUTTX_SRC=$(NUTTX_SRC) CCACHE=$(CCACHE) archives MAXOPTIMIZATION="-Os"
HASHADDER_FLAGS += --ardupilot "$(SKETCHBOOK)"
ifneq ($(wildcard $(VRBRAIN_ROOT)),)
HASHADDER_FLAGS += --px4 "$(VRBRAIN_ROOT)"
endif
ifneq ($(wildcard $(NUTTX_SRC)/..),)
HASHADDER_FLAGS += --nuttx "$(NUTTX_SRC)/.."
endif
HASHADDER_FLAGS += --uavcan "$(UAVCAN_DIR)"
.PHONY: module_mk
module_mk:
$(v) echo "Building $(SKETCHBOOK)/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 = $(subst $(SKETCHBOOK)/,,$(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
vrbrain-v51: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v51.export $(SKETCHCPP) module_mk
$(v) echo Building vrbrain-v51
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V51_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRBRAIN_V51_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrbrain-v51_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V51_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrbrain-v51.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrbrain-v51_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v51_APM.px4 $(SKETCH)-vrbrain-v51.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrbrain-v51.vrx" "$(SKETCH)-vrbrain-v51.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v51.vrx"
vrbrain-v52: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v52.export $(SKETCHCPP) module_mk
$(v) echo Building vrbrain-v52
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V52_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRBRAIN_V52_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrbrain-v52_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V52_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrbrain-v52.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrbrain-v52_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v52_APM.px4 $(SKETCH)-vrbrain-v52.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrbrain-v52.vrx" "$(SKETCH)-vrbrain-v52.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v52.vrx"
vrbrain-v52E: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v52E.export $(SKETCHCPP) module_mk
$(v) echo Building vrbrain-v52E
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V52E_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRBRAIN_V52E_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrbrain-v52E_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V52E_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrbrain-v52E.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrbrain-v52E_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v52E_APM.px4 $(SKETCH)-vrbrain-v52E.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrbrain-v52E.vrx" "$(SKETCH)-vrbrain-v52E.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v52E.vrx"
vrbrain-v54: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v54.export $(SKETCHCPP) module_mk
$(v) echo Building vrbrain-v54
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V54_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRBRAIN_V54_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrbrain-v54_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRBRAIN_V54_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrbrain-v54.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrbrain-v54_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v54_APM.px4 $(SKETCH)-vrbrain-v54.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrbrain-v54.vrx" "$(SKETCH)-vrbrain-v54.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v54.vrx"
vrcore-v10: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrcore-v10.export $(SKETCHCPP) module_mk
$(v) echo Building vrcore-v10
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRCORE_V10_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRCORE_V10_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrcore-v10_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRCORE_V10_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrcore-v10.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrcore-v10_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrcore-v10_APM.px4 $(SKETCH)-vrcore-v10.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrcore-v10.vrx" "$(SKETCH)-vrcore-v10.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrcore-v10.vrx"
vrubrain-v51: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrubrain-v51.export $(SKETCHCPP) module_mk
$(v) echo Building vrubrain-v51
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRUBRAIN_V51_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRUBRAIN_V51_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrubrain-v51_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRUBRAIN_V51_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrubrain-v51.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrubrain-v51_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrubrain-v51_APM.px4 $(SKETCH)-vrubrain-v51.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrubrain-v51.vrx" "$(SKETCH)-vrubrain-v51.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrubrain-v51.vrx"
vrubrain-v52: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(UAVCAN_HEADERS) $(VRBRAIN_ROOT)/Archives/vrubrain-v52.export $(SKETCHCPP) module_mk
$(v) echo Building vrubrain-v52
$(RULEHDR)
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRUBRAIN_V52_CONFIG_FILE)
$(v) cp $(VRBRAIN_MK_DIR)/$(VRUBRAIN_V52_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/nuttx/
$(v) $(VRBRAIN_MAKE) vrubrain-v52_APM
$(v) rm -f $(VRBRAIN_ROOT)/makefiles/nuttx/$(VRUBRAIN_V52_CONFIG_FILE)
$(v) rm -f $(SKETCH)-vrubrain-v52.vrx
$(v) arm-none-eabi-size $(VRBRAIN_ROOT)/Build/vrubrain-v52_APM.build/firmware.elf
$(v) cp $(VRBRAIN_ROOT)/Images/vrubrain-v52_APM.px4 $(SKETCH)-vrubrain-v52.vrx
$(v) $(SKETCHBOOK)/Tools/scripts/add_git_hashes.py $(HASHADDER_FLAGS) "$(SKETCH)-vrubrain-v52.vrx" "$(SKETCH)-vrubrain-v52.vrx"
$(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrubrain-v52.vrx"
# force the 3 build types to not run in parallel. We got bad binaries with incorrect parameter handling
# when these were allowed to happen in parallel
vrbrainStd:
$(MAKE) vrbrain-v51
$(MAKE) vrbrain-v52
$(MAKE) vrbrain-v52E
$(MAKE) vrbrain-v54
$(MAKE) vrcore-v10
$(MAKE) vrubrain-v51
vrbrainStdP:
vrbrainPro:
vrbrainProP:
vrbrain: vrbrainStd vrbrainStdP vrbrainPro vrbrainProP
vrbrain-clean: clean CHECK_MODULES vrbrain-archives-clean vrbrain-cleandep
$(v) /bin/rm -rf $(VRBRAIN_ROOT)/makefiles/build $(VRBRAIN_ROOT)/Build $(VRBRAIN_ROOT)/Images/*.px4 $(VRBRAIN_ROOT)/Images/*.bin
$(v) /bin/rm -rf $(VRBRAIN_ROOT)/src/modules/uORB/topics $(VRBRAIN_ROOT)/src/platforms/nuttx/px4_messages
$(v) /bin/rm -f $(SRCROOT)/*.o
vrbrain-cleandep: clean
$(v) mkdir -p $(VRBRAIN_ROOT)/Build
$(v) find $(VRBRAIN_ROOT)/Build -type f -name '*.d' | xargs rm -f
$(v) find $(UAVCAN_DIRECTORY) -type f -name '*.d' | xargs rm -f
$(v) find $(SKETCHBOOK)/$(SKETCH) -type f -name '*.d' | xargs rm -f
vrbrain-archives-clean:
$(v) /bin/rm -rf $(VRBRAIN_ROOT)/Archives
# These targets can't run in parallel because they all need to generate a tool
# to generate the config.h inside them. This could trigger races if done in
# parallel, trying to generate the tool and replacing it while the header is already
# being generated
#
# We could serialize inside PX4Firmware, but it's easier to serialize here
# while maintaining the rest of the build parallelized
.NOTPARALLEL: \
$(VRBRAIN_ROOT)/Archives/vrbrain-v51.export \
$(VRBRAIN_ROOT)/Archives/vrbrain-v52.export \
$(VRBRAIN_ROOT)/Archives/vrbrain-v52E.export \
$(VRBRAIN_ROOT)/Archives/vrbrain-v54.export \
$(VRBRAIN_ROOT)/Archives/vrcore-v10.export \
$(VRBRAIN_ROOT)/Archives/vrubrain-v51.export \
$(VRBRAIN_ROOT)/Archives/vrubrain-v52.export
$(VRBRAIN_ROOT)/Archives/vrbrain-v51.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrbrain-v51"
$(VRBRAIN_ROOT)/Archives/vrbrain-v52.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrbrain-v52"
$(VRBRAIN_ROOT)/Archives/vrbrain-v52E.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrbrain-v52E"
$(VRBRAIN_ROOT)/Archives/vrbrain-v54.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrbrain-v54"
$(VRBRAIN_ROOT)/Archives/vrcore-v10.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrcore-v10"
$(VRBRAIN_ROOT)/Archives/vrubrain-v51.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrubrain-v51"
$(VRBRAIN_ROOT)/Archives/vrubrain-v52.export:
$(v) $(VRBRAIN_MAKE_ARCHIVES) BOARDS="vrubrain-v52"
vrbrain-archives:
$(v) $(PX4_MAKE_ARCHIVES) BOARDS="vrbrain-v51 vrbrain-v52 vrbrain-v52E vrbrain-v54 vrcore-v10 vrubrain-v51 vrubrain-v52"
vrbrain-info: module_mk
@echo "BUILDROOT $(BUILDROOT)"
@echo "VRBRAINFIRMWARE_DIRECTORY $(VRBRAINFIRMWARE_DIRECTORY)"
@echo "VRBRAINNUTTX_DIRECTORY $(VRBRAINNUTTX_DIRECTORY)"
@echo "NUTTX_ROOT $(NUTTX_ROOT)"
@echo "VRBRAIN_ROOT $(VRBRAIN_ROOT)"
@echo "NUTTX_SRC $(NUTTX_SRC)"
@echo "SKETCHLIBS $(SKETCHLIBS)"
@echo "SKETCHLIBNAMES $(SKETCHLIBNAMES)"
@echo "SKETCHLIBSRCDIRS $(SKETCHLIBSRCDIRS)"
@echo "SKETCHLIBSRCS $(SKETCHLIBSRCS)"
@echo "SKETCHLIBOBJS $(SKETCHLIBOBJS)"
@echo "SKETCHLIBINCLUDES $(SKETCHLIBINCLUDES)"
@echo "SKETCHLIBSRCSRELATIVE $(SKETCHLIBSRCSRELATIVE)"
@echo "SRCS $(subst $(SKETCHBOOK)/,,$(wildcard $(SRCROOT)/*.cpp))"
@echo "SRCS $(wildcard $(SRCROOT)/*.cpp)"
@echo "HASHADDER_FLAGS $(HASHADDER_FLAGS)"