From 935546d80d312c06a3293b619749141a0af7e1e3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Aug 2013 13:32:23 +1000 Subject: [PATCH] PX4: setup build layout to assume PX4Firmware and PX4NuttX trees both in directory above ardupilot --- Tools/scripts/build_autotest.sh | 8 ++++++-- mk/configure.mk | 7 +++++-- mk/px4_targets.mk | 25 +++++++++++++++---------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Tools/scripts/build_autotest.sh b/Tools/scripts/build_autotest.sh index bbfc405429..04169fbb9e 100755 --- a/Tools/scripts/build_autotest.sh +++ b/Tools/scripts/build_autotest.sh @@ -3,7 +3,6 @@ export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_6-2012q2/bin:$PATH export PYTHONUNBUFFERED=1 export PYTHONPATH=$HOME/APM -export PX4_ROOT=$HOME/APM/px4/PX4Firmware cd $HOME/APM || exit 1 @@ -83,7 +82,12 @@ popd rsync -a APM/Tools/autotest/web-firmware/ buildlogs/binaries/ -pushd px4/PX4Firmware +pushd PX4Firmware +git fetch origin +git reset --hard origin/master +popd + +pushd PX4NuttX git fetch origin git reset --hard origin/master popd diff --git a/mk/configure.mk b/mk/configure.mk index 6875558e81..ad00713b42 100644 --- a/mk/configure.mk +++ b/mk/configure.mk @@ -18,5 +18,8 @@ endif @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 - @echo \# PX4 app build: fill in the path to PX4Firmware repository from github.com/diydrones: >> $(SKETCHBOOK)/config.mk - @echo PX4_ROOT = ../PX4Firmware >> $(SKETCHBOOK)/config.mk + @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 diff --git a/mk/px4_targets.mk b/mk/px4_targets.mk index 67d2e7049b..f62dfb8ae1 100644 --- a/mk/px4_targets.mk +++ b/mk/px4_targets.mk @@ -2,23 +2,28 @@ ifneq ($(PX4_ROOT),) -# try to cope with relative paths +# cope with relative paths ifeq ($(wildcard $(PX4_ROOT)/nuttx-configs),) PX4_ROOT := $(shell cd $(SKETCHBOOK)/$(PX4_ROOT) && pwd) endif + +# check it is a valid PX4Firmware tree ifeq ($(wildcard $(PX4_ROOT)/nuttx-configs),) $(error ERROR: PX4_ROOT not set correctly - no nuttx-configs directory found) endif -# allow user to have NuttX git tree in directory above Firmware tree. This -# makes life simpler for git usage -ifeq ($(wildcard $(PX4_ROOT)/NuttX),) - ifeq ($(wildcard $(PX4_ROOT)/../NuttX),) - $(error ERROR: NuttX git tree not found) - endif -NUTTX_SRC := $(shell cd $(PX4_ROOT)/../NuttX/nuttx && pwd)/ -else -NUTTX_SRC := $(shell cd $(PX4_ROOT)/NuttX/nuttx && pwd)/ +# default to PX4NuttX above the PX4Firmware tree +ifeq ($(NUTTX_SRC),) +NUTTX_SRC := $(shell cd $(PX4_ROOT)/../PX4NuttX/nuttx && pwd)/ +endif + +# cope with relative paths for NUTTX_SRC +ifeq ($(wildcard $(NUTTX_SRC)/configs),) +NUTTX_SRC := $(shell cd $(SKETCHBOOK)/$(NUTTX_SRC) && pwd)/ +endif + +ifeq ($(wildcard $(NUTTX_SRC)configs),) +$(error ERROR: NUTTX_SRC not set correctly - no configs directory found) endif # we have different config files for V1 and V2