From bbe036260060b0b8f4ce1275f821f718f4b4d3ca Mon Sep 17 00:00:00 2001 From: Emile Castelnuovo Date: Mon, 31 Mar 2014 19:42:59 +0200 Subject: [PATCH] mk: new make files for VRBRAIN --- mk/VRBRAIN/config_vrbrain-v4_APM.mk | 162 ++++++++++++++++++++++++++++ mk/VRBRAIN/config_vrbrain-v5_APM.mk | 162 ++++++++++++++++++++++++++++ mk/board_vrbrain.mk | 3 + mk/vrbrain_targets.mk | 132 +++++++++++++++++++++++ 4 files changed, 459 insertions(+) create mode 100644 mk/VRBRAIN/config_vrbrain-v4_APM.mk create mode 100644 mk/VRBRAIN/config_vrbrain-v5_APM.mk create mode 100644 mk/board_vrbrain.mk create mode 100644 mk/vrbrain_targets.mk diff --git a/mk/VRBRAIN/config_vrbrain-v4_APM.mk b/mk/VRBRAIN/config_vrbrain-v4_APM.mk new file mode 100644 index 0000000000..fce3173781 --- /dev/null +++ b/mk/VRBRAIN/config_vrbrain-v4_APM.mk @@ -0,0 +1,162 @@ +# +# Makefile for the vrbrain-v4_APM configuration +# + +# +# Use the configuration's ROMFS. +# +ROMFS_ROOT = $(SKETCHBOOK)/mk/VRBRAIN/ROMFS + +MODULES += $(APM_MODULE_DIR) + +# +# Board support modules +# +MODULES += drivers/device +MODULES += drivers/stm32 +MODULES += drivers/stm32/adc +MODULES += drivers/stm32/tone_alarm +MODULES += drivers/led + +MODULES += drivers/px4fmu +MODULES += drivers/boards/vrbrain-v4 + + + +MODULES += drivers/mpu6000 +MODULES += drivers/hmc5883 +MODULES += drivers/ms5611 + + + + + + + + + + + + + + +# +# System commands +# +MODULES += systemcmds/mtd + + + + + + + + + + + +MODULES += systemcmds/tests + +MODULES += systemcmds/nshterm + +# +# General system control +# + + + + + + +# +# Estimation modules (EKF/ SO3 / other filters) +# + + + + + + +# +# Vehicle Control +# + + + + + + + + +# +# Logging +# + + +# +# Unit tests +# + + + +# +# Library modules +# +MODULES += modules/systemlib + + +MODULES += modules/uORB + +# +# Libraries +# + + +MODULES += lib/mathlib/math/filter + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# +# Transitional support - add commands from the NuttX export archive. +# +# In general, these should move to modules over time. +# +# Each entry here is ... but we use a helper macro +# to make the table a bit more readable. +# +define _B + $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) +endef + +# command priority stack entrypoint +BUILTIN_COMMANDS := \ + $(call _B, sercon, , 2048, sercon_main ) \ + $(call _B, serdis, , 2048, serdis_main ) \ + $(call _B, msconn, , 2048, msconn_main ) \ + $(call _B, msdis, , 2048, msdis_main ) \ + $(call _B, sysinfo, , 2048, sysinfo_main ) diff --git a/mk/VRBRAIN/config_vrbrain-v5_APM.mk b/mk/VRBRAIN/config_vrbrain-v5_APM.mk new file mode 100644 index 0000000000..ad538aef0b --- /dev/null +++ b/mk/VRBRAIN/config_vrbrain-v5_APM.mk @@ -0,0 +1,162 @@ +# +# Makefile for the vrbrain-v5_APM configuration +# + +# +# Use the configuration's ROMFS. +# +ROMFS_ROOT = $(SKETCHBOOK)/mk/VRBRAIN/ROMFS + +MODULES += $(APM_MODULE_DIR) + +# +# Board support modules +# +MODULES += drivers/device +MODULES += drivers/stm32 +MODULES += drivers/stm32/adc +MODULES += drivers/stm32/tone_alarm +MODULES += drivers/led + +MODULES += drivers/px4fmu +MODULES += drivers/boards/vrbrain-v5 + + + +MODULES += drivers/mpu6000 +MODULES += drivers/hmc5883 +MODULES += drivers/ms5611 + + + + + + + + + + + + + + +# +# System commands +# +MODULES += systemcmds/mtd + + + + + + + + + + + +MODULES += systemcmds/tests + +MODULES += systemcmds/nshterm + +# +# General system control +# + + + + + + +# +# Estimation modules (EKF/ SO3 / other filters) +# + + + + + + +# +# Vehicle Control +# + + + + + + + + +# +# Logging +# + + +# +# Unit tests +# + + + +# +# Library modules +# +MODULES += modules/systemlib + + +MODULES += modules/uORB + +# +# Libraries +# + + +MODULES += lib/mathlib/math/filter + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# +# Transitional support - add commands from the NuttX export archive. +# +# In general, these should move to modules over time. +# +# Each entry here is ... but we use a helper macro +# to make the table a bit more readable. +# +define _B + $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) +endef + +# command priority stack entrypoint +BUILTIN_COMMANDS := \ + $(call _B, sercon, , 2048, sercon_main ) \ + $(call _B, serdis, , 2048, serdis_main ) \ + $(call _B, msconn, , 2048, msconn_main ) \ + $(call _B, msdis, , 2048, msdis_main ) \ + $(call _B, sysinfo, , 2048, sysinfo_main ) diff --git a/mk/board_vrbrain.mk b/mk/board_vrbrain.mk new file mode 100644 index 0000000000..31890d4f15 --- /dev/null +++ b/mk/board_vrbrain.mk @@ -0,0 +1,3 @@ +TOOLCHAIN = NATIVE +include $(MK_DIR)/find_tools.mk +include $(MK_DIR)/vrbrain_targets.mk diff --git a/mk/vrbrain_targets.mk b/mk/vrbrain_targets.mk new file mode 100644 index 0000000000..0480b29499 --- /dev/null +++ b/mk/vrbrain_targets.mk @@ -0,0 +1,132 @@ +# VRBRAIN build is via external build system + +ifneq ($(VRBRAIN_ROOT),) + +# cope with relative paths +ifeq ($(wildcard $(VRBRAIN_ROOT)/nuttx-configs),) +VRBRAIN_ROOT := $(shell cd $(SKETCHBOOK)/$(VRBRAIN_ROOT) && pwd) +endif + +# check it is a valid VRBRAIN Firmware tree +ifeq ($(wildcard $(VRBRAIN_ROOT)/nuttx-configs),) +$(error ERROR: VRBRAIN_ROOT not set correctly - no nuttx-configs directory found) +endif + +# default to VRBRAIN NuttX above the VRBRAIN Firmware tree +ifeq ($(VRBRAIN_NUTTX_SRC),) +VRBRAIN_NUTTX_SRC := $(shell cd $(VRBRAIN_ROOT)/NuttX/nuttx && pwd)/ +endif + +# cope with relative paths for VRBRAIN_NUTTX_SRC +ifeq ($(wildcard $(VRBRAIN_NUTTX_SRC)/configs),) +VRBRAIN_NUTTX_SRC := $(shell cd $(SKETCHBOOK)/$(VRBRAIN_NUTTX_SRC) && pwd)/ +endif + +ifeq ($(wildcard $(VRBRAIN_NUTTX_SRC)configs),) +$(error ERROR: VRBRAIN_NUTTX_SRC not set correctly - no configs directory found) +endif + + + + + + + +# we have different config files for vrbrain_v4, vrbrain_v5 and vrhero_v1 +VRBRAIN_VB4_CONFIG_FILE=$(MK_DIR)/VRBRAIN/config_vrbrain-v4_APM.mk +VRBRAIN_VB5_CONFIG_FILE=$(MK_DIR)/VRBRAIN/config_vrbrain-v5_APM.mk +VRBRAIN_VH1_CONFIG_FILE=$(MK_DIR)/VRBRAIN/config_vrhero-v1_APM.mk + +SKETCHFLAGS=$(SKETCHLIBINCLUDES) -I$(PWD) -DARDUPILOT_BUILD -DCONFIG_HAL_BOARD=HAL_BOARD_VRBRAIN -DSKETCHNAME="\\\"$(SKETCH)\\\"" -DSKETCH_MAIN=ArduPilot_main -DAPM_BUILD_DIRECTORY=APM_BUILD_$(SKETCH) + +WARNFLAGS = -Wno-psabi -Wno-packed + +VRBRAIN_MAKE = $(v) make -C $(SKETCHBOOK) -f $(VRBRAIN_ROOT)/Makefile EXTRADEFINES="$(SKETCHFLAGS) $(WARNFLAGS) "'$(EXTRAFLAGS)' APM_MODULE_DIR=$(SKETCHBOOK) SKETCHBOOK=$(SKETCHBOOK) VRBRAIN_ROOT=$(VRBRAIN_ROOT) VRBRAIN_NUTTX_SRC=$(VRBRAIN_NUTTX_SRC) MAXOPTIMIZATION="-Os" +VRBRAIN_MAKE_ARCHIVES = make -C $(VRBRAIN_ROOT) VRBRAIN_NUTTX_SRC=$(VRBRAIN_NUTTX_SRC) archives MAXOPTIMIZATION="-Os" + +.PHONY: module_mk +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 = Build.$(SKETCH)/$(SKETCH).cpp $(SKETCHLIBSRCSRELATIVE)" >> $(SKETCHBOOK)/module.mk.new + $(v) echo "MODULE_STACKSIZE = 4096" >> $(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-v4: showflags $(VRBRAIN_ROOT)/Archives/vrbrain-v4.export $(SKETCHCPP) module_mk + $(RULEHDR) + $(v) rm -f $(VRBRAIN_ROOT)/makefiles/$(VRBRAIN_VB4_CONFIG_FILE) + $(v) cp $(SRCROOT)/$(VRBRAIN_VB4_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/ + $(v) $(VRBRAIN_MAKE) vrbrain-v4_APM + $(v) /bin/rm -f $(SKETCH)-vrbrain-v4.vrbrain + $(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v4_APM.vrbrain $(SKETCH)-vrbrain-v4.vbrain + $(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v4.vbrain" + +vrbrain-v5: showflags $(VRBRAIN_ROOT)/Archives/vrbrain-v5.export $(SKETCHCPP) module_mk + $(RULEHDR) + $(v) rm -f $(VRBRAIN_ROOT)/makefiles/$(VRBRAIN_VB5_CONFIG_FILE) + $(v) cp $(SRCROOT)/$(VRBRAIN_VB5_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/ + $(v) $(VRBRAIN_MAKE) vrbrain-v5_APM + $(v) /bin/rm -f $(SKETCH)-vrbrain-v5.vrbrain + $(v) cp $(VRBRAIN_ROOT)/Images/vrbrain-v5_APM.vrbrain $(SKETCH)-vrbrain-v5.vbrain + $(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrbrain-v5.vbrain" + +vrhero-v1: showflags $(VRBRAIN_ROOT)/Archives/vrhero-v1.export $(SKETCHCPP) module_mk + $(RULEHDR) + $(v) rm -f $(VRBRAIN_ROOT)/makefiles/$(VRBRAIN_VH1_CONFIG_FILE) + $(v) cp $(SRCROOT)/$(VRBRAIN_VH1_CONFIG_FILE) $(VRBRAIN_ROOT)/makefiles/ + $(v) $(VRBRAIN_MAKE) vrhero-v1_APM + $(v) /bin/rm -f $(SKETCH)-vrhero-v1.vrbrain + $(v) cp $(VRBRAIN_ROOT)/Images/vrhero-v1_APM.vrbrain $(SKETCH)-vrhero-v1.vbrain + $(v) echo "VRBRAIN $(SKETCH) Firmware is in $(SKETCH)-vrhero-v1.vbrain" + +#vrbrain: vrbrain-v4 vrbrain-v5 vrhero-v1 +vrbrain: vrbrain-v4 vrbrain-v5 +#vrbrain: vrbrain-v4 + +vrbrain-clean: clean vrbrain-archives-clean + $(v) /bin/rm -rf $(VRBRAIN_ROOT)/makefiles/build $(VRBRAIN_ROOT)/Build + +vrbrain-cleandep: clean + $(v) find $(VRBRAIN_ROOT)/Build -type f -name '*.d' | xargs rm -f + +vrbrain-v4-upload: vrbrain-v4 + $(RULEHDR) + $(v) $(VRBRAIN_MAKE) vrbrain-v4_APM upload + +vrbrain-v5-upload: vrbrain-v5 + $(RULEHDR) + $(v) $(VRBRAIN_MAKE) vrbrain-v5_APM upload + +vrhero-v1-upload: vrhero-v1 + $(RULEHDR) + $(v) $(VRBRAIN_MAKE) vrhero-v1_APM upload + +vrbrain-upload: vrbrain-v4-upload + +vrbrain-archives-clean: + $(v) /bin/rm -rf $(VRBRAIN_ROOT)/Archives + +$(VRBRAIN_ROOT)/Archives/vrbrain-v4.export: + $(v) $(VRBRAIN_MAKE_ARCHIVES) + +$(VRBRAIN_ROOT)/Archives/vrbrain-v5.export: + $(v) $(VRBRAIN_MAKE_ARCHIVES) + +$(VRBRAIN_ROOT)/Archives/vrhero-v1.export: + $(v) $(VRBRAIN_MAKE_ARCHIVES) + +vrbrain-archives: + $(v) $(VRBRAIN_MAKE_ARCHIVES) + +else + +vrbrain_nx: + $(error ERROR: You need to add VRBRAIN_ROOT to your config.mk) + +vrbrain-clean: vrbrain + +vrbrain-upload: vrbrain + +endif