diff --git a/mk/apm.mk b/mk/apm.mk index 065314f98b..532a4c9aee 100644 --- a/mk/apm.mk +++ b/mk/apm.mk @@ -17,11 +17,8 @@ include $(MK_DIR)/configure.mk else # short-circuit build for the help target -ifeq ($(MAKECMDGOALS),help) include $(MK_DIR)/help.mk -else - # common makefile components include $(MK_DIR)/targets.mk include $(MK_DIR)/sketch_sources.mk @@ -59,5 +56,3 @@ endif endif endif - -endif diff --git a/mk/board_avr.mk b/mk/board_avr.mk index e3cba572d6..9b01552603 100644 --- a/mk/board_avr.mk +++ b/mk/board_avr.mk @@ -8,7 +8,7 @@ include $(MK_DIR)/find_tools.mk # DEFINES = -DF_CPU=$(F_CPU) DEFINES += -DSKETCH=\"$(SKETCH)\" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH) -DEFINES += $(EXTRAFLAGS) # from user config.mk +DEFINES += $(EXTRAFLAGS) DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align WARNFLAGS += -Wwrite-strings -Wformat=2 -Wno-unused-parameter -Wno-missing-field-initializers @@ -65,6 +65,9 @@ endif # Library object files LIBOBJS := $(SKETCHLIBOBJS) +HARDWARE ?= arduino +BOARD ?= mega2560 + # Find the hardware directory to use HARDWARE_DIR := $(firstword $(wildcard $(SKETCHBOOK)/hardware/$(HARDWARE) \ $(ARDUINO)/hardware/$(HARDWARE))) diff --git a/mk/board_flymaple.mk b/mk/board_flymaple.mk index 2eb068e2a6..b3850c6fe2 100644 --- a/mk/board_flymaple.mk +++ b/mk/board_flymaple.mk @@ -14,7 +14,6 @@ endif TOOLCHAIN = ARM -#include $(MK_DIR)/find_arduino.mk include $(MK_DIR)/find_tools.mk HARDWARE := leaflabs @@ -33,7 +32,7 @@ LD_MEM_DIR := sram_64k_flash_512k # DEFINES = -DF_CPU=$(F_CPU) -DMCU_$(MCU) -DBOARD_$(BOARD) -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=5 -DVECT_TAB_FLASH DEFINES += -DSKETCH=\"$(SKETCH)\" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH) -DEFINES += $(EXTRAFLAGS) # from user config.mk +DEFINES += $(EXTRAFLAGS) DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wno-psabi WARNFLAGS += -Wwrite-strings -Wformat=2 diff --git a/mk/board_native.mk b/mk/board_native.mk index 453e0f173a..10d9e1bc01 100644 --- a/mk/board_native.mk +++ b/mk/board_native.mk @@ -7,7 +7,7 @@ include $(MK_DIR)/find_tools.mk # DEFINES = -DF_CPU=$(F_CPU) DEFINES += -DSKETCH=\"$(SKETCH)\" -DSKETCHNAME="\"$(SKETCH)\"" -DSKETCHBOOK="\"$(SKETCHBOOK)\"" -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH) -DEFINES += $(EXTRAFLAGS) # from user config.mk +DEFINES += $(EXTRAFLAGS) DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) -DCONFIG_HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE) WARNFLAGS = -Wformat -Wall -Wshadow -Wpointer-arith -Wcast-align -Wno-unused-parameter -Wno-missing-field-initializers WARNFLAGS += -Wwrite-strings -Wformat=2 diff --git a/mk/configure.mk b/mk/configure.mk index c9ff7fda69..1c265d0481 100644 --- a/mk/configure.mk +++ b/mk/configure.mk @@ -1,34 +1,2 @@ configure: - $(warning WARNING - A $(SKETCHBOOK)/config.mk file has been written) - $(warning Please edit the file to match your system configuration, if you use a different board or port) - @echo > $(SKETCHBOOK)/config.mk - @echo \# Select \'mega\' for the 1280 APM1, \'mega2560\' otherwise >> $(SKETCHBOOK)/config.mk - @echo BOARD = mega2560 >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk - @echo \# HAL_BOARD determines default HAL target. >> $(SKETCHBOOK)/config.mk - @echo HAL_BOARD ?= HAL_BOARD_APM2 >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk - @echo \# The communication port used to communicate with the APM. >> $(SKETCHBOOK)/config.mk -ifneq ($(findstring CYGWIN, $(SYSTYPE)),) - @echo PORT = COM3 >> $(SKETCHBOOK)/config.mk -else - @echo PORT = /dev/ttyACM0 >> $(SKETCHBOOK)/config.mk -endif - @echo >> $(SKETCHBOOK)/config.mk - @echo \# uncomment and fill in the path to Arduino if installed in an exotic location >> $(SKETCHBOOK)/config.mk - @echo \# ARDUINO = /path/to/Arduino >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk -######################## PX4 #################################### - @echo \# PX4Firmware tree: fill in the path to PX4Firmware repository from github.com/diydrones: >> $(SKETCHBOOK)/config.mk - @echo PX4_ROOT=../PX4Firmware >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk - @echo \# PX4NuttX tree: fill in the path to PX4NuttX repository from github.com/diydrones: >> $(SKETCHBOOK)/config.mk - @echo NUTTX_SRC=../PX4NuttX/nuttx >> $(SKETCHBOOK)/config.mk -###################### VRBRAIN ################################## - @echo \# VRBRAIN Firmware tree: >> $(SKETCHBOOK)/config.mk - @echo VRBRAIN_ROOT=../VRNuttX >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk - @echo \# VRBRAIN NuttX tree: >> $(SKETCHBOOK)/config.mk - @echo VRBRAIN_NUTTX_SRC=../VRNuttX/NuttX/nuttx >> $(SKETCHBOOK)/config.mk - @echo >> $(SKETCHBOOK)/config.mk - \ No newline at end of file + @echo "make configure is no longer required" diff --git a/mk/environ.mk b/mk/environ.mk index 6aafc51e0b..d508562dfb 100644 --- a/mk/environ.mk +++ b/mk/environ.mk @@ -107,19 +107,6 @@ ifneq ($(findstring CYGWIN, $(SYSTYPE)),) endif endif -# Jump over the next makefile sections when runing a "make configure" -ifneq ($(MAKECMDGOALS),configure) - -################################################################################ -# Config options -# -# The Makefile calling us must specify BOARD -# -include $(SKETCHBOOK)/config.mk -ifeq ($(PORT),) -$(error ERROR: could not locate $(SKETCHBOOK)/config.mk, please run 'make configure' first and edit config.mk) -endif - ifneq ($(APPDIR),) # this is a recusive PX4 build HAL_BOARD = HAL_BOARD_PX4 @@ -194,20 +181,9 @@ ifneq ($(findstring flymaple, $(MAKECMDGOALS)),) HAL_BOARD = HAL_BOARD_FLYMAPLE endif -# default to APM2 +# default to SITL ifeq ($(HAL_BOARD),) -#$(warning No HAL_BOARD in config.mk - defaulting to HAL_BOARD_APM2) -HAL_BOARD = HAL_BOARD_APM2 -HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_AVR_APM2 +HAL_BOARD = HAL_BOARD_SITL +HAL_BOARD_SUBTYPE = HAL_BOARD_SUBTYPE_NONE endif -HARDWARE ?= arduino -ifeq ($(BOARD),) -BOARD = mega2560 -endif - -ifneq ($(findstring apm1-1280, $(MAKECMDGOALS)),) -BOARD = mega -endif - -endif diff --git a/mk/help.mk b/mk/help.mk index 41a63d99a0..0a328d1e36 100644 --- a/mk/help.mk +++ b/mk/help.mk @@ -8,20 +8,18 @@ help: @echo "" @echo " Before building a target you need to be in the target vehicle type directory" @echo " e.g. ArduPlane, ArduCopter, APMrover2, AntennaTracker" - @echo " and run \"make configure\"" @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 " Targets" @echo " -------" @echo "" - @echo " configure - Set up build for vehicle type" - @echo "" - @echo " all - Build all targets" - @echo "" @echo " apm1 - the APM1 board" @echo " apm2 - the APM2 board" @echo " px4-v1 - the PX4v1 board" diff --git a/mk/px4_targets.mk b/mk/px4_targets.mk index 563c6d8716..99e127bd1b 100644 --- a/mk/px4_targets.mk +++ b/mk/px4_targets.mk @@ -1,6 +1,6 @@ # PX4 build is via external build system -ifneq ($(PX4_ROOT),) +PX4_ROOT=../PX4Firmware # cope with relative paths ifeq ($(wildcard $(PX4_ROOT)/nuttx-configs),) @@ -171,13 +171,3 @@ $(PX4_ROOT)/Archives/px4io-v2.export: px4-archives: $(v) $(PX4_MAKE_ARCHIVES) -else - -px4: - $(error ERROR: You need to add PX4_ROOT to your config.mk) - -px4-clean: px4 - -px4-upload: px4 - -endif diff --git a/mk/targets.mk b/mk/targets.mk index 28d601bd91..2bb7e6db04 100644 --- a/mk/targets.mk +++ b/mk/targets.mk @@ -1,4 +1,4 @@ -default: all +default: help # convenient targets for our supported boards sitl: HAL_BOARD = HAL_BOARD_SITL @@ -16,6 +16,7 @@ apm1: all apm1-1280: HAL_BOARD = HAL_BOARD_APM1 apm1-1280: TOOLCHAIN = AVR apm1-1280: all +apm1-1280: BOARD = mega apm2: HAL_BOARD = HAL_BOARD_APM2 apm2: TOOLCHAIN = AVR