VRBRAIN / mk: correct some style

This commit is contained in:
LukeMike 2018-02-02 18:10:12 +01:00 committed by Andrew Tridgell
parent d6104bc697
commit 416fa31ce1
11 changed files with 668 additions and 668 deletions

View File

@ -1,107 +1,107 @@
#!nsh
# APM startup script for NuttX on VRBRAIN
# To disable APM startup add a /fs/microsd/APM/nostart file
# check for an old file called APM, caused by
# a bug in an earlier firmware release
if [ -f /fs/microsd/APM ]
then
echo "APM file found - renaming"
mv /fs/microsd/APM /fs/microsd/APM.old
fi
if [ -f /fs/microsd/APM/nostart ]
then
echo "APM/nostart found - skipping APM startup"
sh /etc/init.d/rc.error
fi
# mount binfs so we can find the built-in apps
if [ -f /bin/reboot ]
then
echo "binfs already mounted"
else
echo "Mounting binfs"
if mount -t binfs /dev/null /bin
then
echo "binfs mounted OK"
else
sh /etc/init.d/rc.error
fi
fi
set sketch NONE
if rm /fs/microsd/APM/boot.log
then
echo "removed old boot.log"
fi
set logfile /fs/microsd/APM/BOOT.LOG
if [ ! -f /bin/ArduPilot ]
then
echo "/bin/ardupilot not found"
sh /etc/init.d/rc.error
fi
if mkdir /fs/microsd/APM > /dev/null
then
echo "Created APM directory"
fi
echo "Starting uORB"
if uorb start
then
echo "uorb started OK"
else
sh /etc/init.d/rc.error
fi
echo "Starting ADC"
if adc start
then
echo "ADC started OK"
else
sh /etc/init.d/rc.error
fi
echo "Starting MTD driver"
if mtd start /fs/mtd
then
echo "MTD driver started OK"
else
echo "MTD driver start failed"
sh /etc/init.d/rc.error
fi
echo "MTD driver read test"
if mtd readtest /fs/mtd
then
echo "MTD driver readtest OK"
else
echo "MTD driver failed to read"
sh /etc/init.d/rc.error
fi
echo "FMU mode PWM"
if fmu mode_pwm
then
echo "Set FMU mode_pwm"
fi
echo "Starting ArduPilot"
if ArduPilot start
then
echo "ArduPilot started OK"
else
echo "ArduPilot start failed"
sh /etc/init.d/rc.error
fi
echo "Exiting from nsh shell"
exit
echo "rc.APM finished"
#!nsh
# APM startup script for NuttX on VRBRAIN
# To disable APM startup add a /fs/microsd/APM/nostart file
# check for an old file called APM, caused by
# a bug in an earlier firmware release
if [ -f /fs/microsd/APM ]
then
echo "APM file found - renaming"
mv /fs/microsd/APM /fs/microsd/APM.old
fi
if [ -f /fs/microsd/APM/nostart ]
then
echo "APM/nostart found - skipping APM startup"
sh /etc/init.d/rc.error
fi
# mount binfs so we can find the built-in apps
if [ -f /bin/reboot ]
then
echo "binfs already mounted"
else
echo "Mounting binfs"
if mount -t binfs /dev/null /bin
then
echo "binfs mounted OK"
else
sh /etc/init.d/rc.error
fi
fi
set sketch NONE
if rm /fs/microsd/APM/boot.log
then
echo "removed old boot.log"
fi
set logfile /fs/microsd/APM/BOOT.LOG
if [ ! -f /bin/ArduPilot ]
then
echo "/bin/ardupilot not found"
sh /etc/init.d/rc.error
fi
if mkdir /fs/microsd/APM > /dev/null
then
echo "Created APM directory"
fi
echo "Starting uORB"
if uorb start
then
echo "uorb started OK"
else
sh /etc/init.d/rc.error
fi
echo "Starting ADC"
if adc start
then
echo "ADC started OK"
else
sh /etc/init.d/rc.error
fi
echo "Starting MTD driver"
if mtd start /fs/mtd
then
echo "MTD driver started OK"
else
echo "MTD driver start failed"
sh /etc/init.d/rc.error
fi
echo "MTD driver read test"
if mtd readtest /fs/mtd
then
echo "MTD driver readtest OK"
else
echo "MTD driver failed to read"
sh /etc/init.d/rc.error
fi
echo "FMU mode PWM"
if fmu mode_pwm
then
echo "Set FMU mode_pwm"
fi
echo "Starting ArduPilot"
if ArduPilot start
then
echo "ArduPilot started OK"
else
echo "ArduPilot start failed"
sh /etc/init.d/rc.error
fi
echo "Exiting from nsh shell"
exit
echo "rc.APM finished"

View File

@ -1,14 +1,14 @@
echo "Error in startup"
tone_alarm MNCC
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
nshterm /dev/ttyACM0 &
sleep 1
nshterm /dev/ttyS0 &
sleep 1
exit
echo "Error in startup"
tone_alarm MNCC
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
nshterm /dev/ttyACM0 &
sleep 1
nshterm /dev/ttyS0 &
sleep 1
exit

View File

@ -1,140 +1,140 @@
#!nsh
#
# VRBRAIN startup script.
#
# This script is responsible for:
#
# - mounting the microSD card (if present)
# - running the user startup script from the microSD card (if present)
# - detecting the configuration of the system and picking a suitable
# startup script to continue with
#
# Note: DO NOT add configuration-specific commands to this script;
# add them to the per-configuration scripts instead.
#
#
# Default to auto-start mode. An init script on the microSD card
# can change this to prevent automatic startup of the flight script.
#
set MODE autostart
set USB autoconnect
#
#
if rgbled start
then
set HAVE_RGBLED 1
# show startup white
rgbled rgb 16 16 16
else
set HAVE_RGBLED 0
fi
#
# Try to mount the microSD card.
#
echo "[init] looking for microSD..."
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "[init] card mounted at /fs/microsd"
set HAVE_MICROSD 1
# Start playing the startup tune
if [ -f /etc/tones/startup ]
then
tone_alarm /etc/tones/startup
else
tone_alarm 1
fi
else
set HAVE_MICROSD 0
echo "Trying format of microSD"
tone_alarm MBAGP
if mkfatfs /dev/mmcsd0
then
echo "microSD card formatted"
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "format succeeded"
set HAVE_MICROSD 1
if [ -f /etc/tones/startup ]
then
tone_alarm /etc/tones/startup
else
tone_alarm 1
fi
else
echo "mount failed"
tone_alarm MNBG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
else
echo "format failed"
tone_alarm MNBGG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
fi
#
# Look for an init script on the microSD card.
#
# To prevent automatic startup in the current flight mode,
# the script should set MODE to some other value.
#
if [ -f /fs/microsd/etc/rc ]
then
echo "[init] reading /fs/microsd/etc/rc"
sh /fs/microsd/etc/rc
fi
# Also consider rc.txt files
if [ -f /fs/microsd/etc/rc.txt ]
then
echo "[init] reading /fs/microsd/etc/rc.txt"
sh /fs/microsd/etc/rc.txt
fi
#
# Check for USB host
#
if [ $USB != autoconnect ]
then
echo "[init] not connecting USB"
else
if sercon
then
echo "[init] USB interface connected"
else
echo "[init] No USB connected"
fi
fi
if [ $HAVE_MICROSD == 0 ]
then
if usb_connected
then
echo "Opening USB nsh"
else
echo "booting with no microSD"
set HAVE_MICROSD 1
fi
fi
# if this is an APM build then there will be a rc.APM script
# from an EXTERNAL_SCRIPTS build option
if [ -f /etc/init.d/rc.APM -a $HAVE_MICROSD == 1 -a ! -f /fs/microsd/APM/nostart ]
then
echo Running rc.APM
# if APM startup is successful then nsh will exit
sh /etc/init.d/rc.APM
else
nshterm /dev/ttyACM0 &
fi
#!nsh
#
# VRBRAIN startup script.
#
# This script is responsible for:
#
# - mounting the microSD card (if present)
# - running the user startup script from the microSD card (if present)
# - detecting the configuration of the system and picking a suitable
# startup script to continue with
#
# Note: DO NOT add configuration-specific commands to this script;
# add them to the per-configuration scripts instead.
#
#
# Default to auto-start mode. An init script on the microSD card
# can change this to prevent automatic startup of the flight script.
#
set MODE autostart
set USB autoconnect
#
#
if rgbled start
then
set HAVE_RGBLED 1
# show startup white
rgbled rgb 16 16 16
else
set HAVE_RGBLED 0
fi
#
# Try to mount the microSD card.
#
echo "[init] looking for microSD..."
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "[init] card mounted at /fs/microsd"
set HAVE_MICROSD 1
# Start playing the startup tune
if [ -f /etc/tones/startup ]
then
tone_alarm /etc/tones/startup
else
tone_alarm 1
fi
else
set HAVE_MICROSD 0
echo "Trying format of microSD"
tone_alarm MBAGP
if mkfatfs /dev/mmcsd0
then
echo "microSD card formatted"
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
echo "format succeeded"
set HAVE_MICROSD 1
if [ -f /etc/tones/startup ]
then
tone_alarm /etc/tones/startup
else
tone_alarm 1
fi
else
echo "mount failed"
tone_alarm MNBG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
else
echo "format failed"
tone_alarm MNBGG
if [ $HAVE_RGBLED == 1 ]
then
rgbled rgb 16 0 0
fi
fi
fi
#
# Look for an init script on the microSD card.
#
# To prevent automatic startup in the current flight mode,
# the script should set MODE to some other value.
#
if [ -f /fs/microsd/etc/rc ]
then
echo "[init] reading /fs/microsd/etc/rc"
sh /fs/microsd/etc/rc
fi
# Also consider rc.txt files
if [ -f /fs/microsd/etc/rc.txt ]
then
echo "[init] reading /fs/microsd/etc/rc.txt"
sh /fs/microsd/etc/rc.txt
fi
#
# Check for USB host
#
if [ $USB != autoconnect ]
then
echo "[init] not connecting USB"
else
if sercon
then
echo "[init] USB interface connected"
else
echo "[init] No USB connected"
fi
fi
if [ $HAVE_MICROSD == 0 ]
then
if usb_connected
then
echo "Opening USB nsh"
else
echo "booting with no microSD"
set HAVE_MICROSD 1
fi
fi
# if this is an APM build then there will be a rc.APM script
# from an EXTERNAL_SCRIPTS build option
if [ -f /etc/init.d/rc.APM -a $HAVE_MICROSD == 1 -a ! -f /fs/microsd/APM/nostart ]
then
echo Running rc.APM
# if APM startup is successful then nsh will exit
sh /etc/init.d/rc.APM
else
nshterm /dev/ttyACM0 &
fi

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRBRAIN 5.1 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v51
#
# Makefile for the VRBRAIN 5.1 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v51

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRBRAIN 5.2 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v52
#
# Makefile for the VRBRAIN 5.2 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v52

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRBRAIN 5.4 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v54
#
# Makefile for the VRBRAIN 5.4 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrbrain-v54

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRCORE 1.0 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
#MODULES += drivers/mpu6000
MODULES += drivers/mpu9250
MODULES += drivers/boards/vrcore-v10
#
# Makefile for the VRCORE 1.0 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
#MODULES += drivers/mpu6000
MODULES += drivers/mpu9250
MODULES += drivers/boards/vrcore-v10

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRUBRAIN 5.1 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrubrain-v51
#
# Makefile for the VRUBRAIN 5.1 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrubrain-v51

View File

@ -1,8 +1,8 @@
#
# Makefile for the VRUBRAIN 5.2 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrubrain-v52
#
# Makefile for the VRUBRAIN 5.2 APM configuration
#
include $(SKETCHBOOK)/mk/VRBRAIN/vrbrain_common.mk
MODULES += drivers/mpu6000
#MODULES += drivers/mpu9250
MODULES += drivers/boards/vrubrain-v52

View File

@ -1,95 +1,95 @@
#
# common makefile elements for all PX4 boards
#
#
# 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/hmc5883
MODULES += drivers/ms5611
MODULES += drivers/mb12xx
MODULES += drivers/ll40ls
MODULES += drivers/trone
#MODULES += drivers/gps
#MODULES += drivers/hil
#MODULES += drivers/hott_telemetry
#MODULES += drivers/blinkm
#MODULES += modules/sensors
MODULES += drivers/mkblctrl
MODULES += drivers/batt_smbus
MODULES += drivers/pwm_input
MODULES += drivers/px4flow
#
# System commands
#
MODULES += systemcmds/bl_update
MODULES += systemcmds/mixer
MODULES += systemcmds/perf
MODULES += systemcmds/pwm
MODULES += systemcmds/reboot
MODULES += systemcmds/top
#MODULES += systemcmds/tests
MODULES += systemcmds/nshterm
MODULES += systemcmds/mtd
MODULES += systemcmds/ver
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/reflect),)
MODULES += systemcmds/reflect
endif
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/motor_test),)
MODULES += systemcmds/motor_test
endif
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/usb_connected),)
MODULES += systemcmds/usb_connected
endif
#
# Library modules
#
MODULES += modules/systemlib
MODULES += modules/systemlib/mixer
MODULES += modules/uORB
MODULES += lib/mathlib/math/filter
MODULES += lib/mathlib
#MODULES += modules/uavcan
# Note: auth disabled to keep us under 1MB flash because of STM32 bug
#ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/auth),)
#MODULES += systemcmds/auth
#endif
#ifneq ($(wildcard $(PX4_ROOT)/src/modules/libtomfastmath),)
#MODULES += modules/libtomfastmath
#MODULES += modules/libtomcrypt
#endif
MODULES += lib/conversion
#
# Transitional support - add commands from the NuttX export archive.
#
# In general, these should move to modules over time.
#
# Each entry here is <command>.<priority>.<stacksize>.<entrypoint> 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 )
#
# common makefile elements for all PX4 boards
#
#
# 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/hmc5883
MODULES += drivers/ms5611
MODULES += drivers/mb12xx
MODULES += drivers/ll40ls
MODULES += drivers/trone
#MODULES += drivers/gps
#MODULES += drivers/hil
#MODULES += drivers/hott_telemetry
#MODULES += drivers/blinkm
#MODULES += modules/sensors
MODULES += drivers/mkblctrl
MODULES += drivers/batt_smbus
MODULES += drivers/pwm_input
MODULES += drivers/px4flow
#
# System commands
#
MODULES += systemcmds/bl_update
MODULES += systemcmds/mixer
MODULES += systemcmds/perf
MODULES += systemcmds/pwm
MODULES += systemcmds/reboot
MODULES += systemcmds/top
#MODULES += systemcmds/tests
MODULES += systemcmds/nshterm
MODULES += systemcmds/mtd
MODULES += systemcmds/ver
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/reflect),)
MODULES += systemcmds/reflect
endif
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/motor_test),)
MODULES += systemcmds/motor_test
endif
ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/usb_connected),)
MODULES += systemcmds/usb_connected
endif
#
# Library modules
#
MODULES += modules/systemlib
MODULES += modules/systemlib/mixer
MODULES += modules/uORB
MODULES += lib/mathlib/math/filter
MODULES += lib/mathlib
#MODULES += modules/uavcan
# Note: auth disabled to keep us under 1MB flash because of STM32 bug
#ifneq ($(wildcard $(PX4_ROOT)/src/systemcmds/auth),)
#MODULES += systemcmds/auth
#endif
#ifneq ($(wildcard $(PX4_ROOT)/src/modules/libtomfastmath),)
#MODULES += modules/libtomfastmath
#MODULES += modules/libtomcrypt
#endif
MODULES += lib/conversion
#
# Transitional support - add commands from the NuttX export archive.
#
# In general, these should move to modules over time.
#
# Each entry here is <command>.<priority>.<stacksize>.<entrypoint> 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 )

View File

@ -1,266 +1,266 @@
# 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)/
# warn if user has old PX4Firmware or PX4NuttX trees
ifneq ($(wildcard $(SKETCHBOOK)/../PX4Firmware),)
$(warning *** You have an old PX4Firmware tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
ifneq ($(wildcard $(SKETCHBOOK)/../PX4NuttX),)
$(warning *** You have an old PX4NuttX tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
ifneq ($(wildcard $(SKETCHBOOK)/../uavcan),)
$(warning *** You have an old uavcan tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
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
# Add missing parts from libc and libstdc++
EXTRAFLAGS += -DHAVE_STD_NULLPTR_T=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)/
# warn if user has old PX4Firmware or PX4NuttX trees
ifneq ($(wildcard $(SKETCHBOOK)/../PX4Firmware),)
$(warning *** You have an old PX4Firmware tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
ifneq ($(wildcard $(SKETCHBOOK)/../PX4NuttX),)
$(warning *** You have an old PX4NuttX tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
ifneq ($(wildcard $(SKETCHBOOK)/../uavcan),)
$(warning *** You have an old uavcan tree - see http://dev.ardupilot.com/wiki/git-submodules/)
endif
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
# Add missing parts from libc and libstdc++
EXTRAFLAGS += -DHAVE_STD_NULLPTR_T=0
EXTRAFLAGS += -DHAVE_OCLOEXEC=0
EXTRAFLAGS += -I$(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink
# we have different config files for vrbrain_v52, vrbrain_v54
VRBRAIN_MK_DIR=$(MK_DIR)/VRBRAIN
VRBRAIN_V51_CONFIG_FILE=config_vrbrain-v51_APM.mk
VRBRAIN_V52_CONFIG_FILE=config_vrbrain-v52_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
SKETCHFLAGS=$(SKETCHLIBINCLUDES) -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-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=$(SKETCHBOOK)/mk/VRBRAIN/Tools/genmsg/src:$(SKETCHBOOK)/mk/VRBRAIN/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)" >> $(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) $(VRBRAIN_ROOT)/Archives/vrbrain-v51.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrbrain-v52.export $(SKETCHCPP) module_mk
$(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-v54: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v54.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrcore-v10.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrubrain-v51.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrubrain-v52.export $(SKETCHCPP) module_mk
$(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"
vrbrainStd: vrbrain-v51 vrbrain-v52 vrbrain-v54 vrcore-v10 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
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-v51-upload: vrbrain-v51
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v51_APM upload
vrbrain-v52-upload: vrbrain-v52
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v52_APM upload
vrbrain-v54-upload: vrbrain-v54
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v54_APM upload
vrcore-v10-upload: vrcore-v10
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrcore-v10_APM upload
vrubrain-v51-upload: vrubrain-v51
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrubrain-v51_APM upload
vrubrain-v52-upload: vrubrain-v52
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrubrain-v52_APM upload
vrbrain-upload: vrbrain-v52-upload
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-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-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-v54 vrcore-v10 vrubrain-v51 vrubrain-v52"
vrbrain-info: module_mk
@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))"
EXTRAFLAGS += -I$(BUILDROOT)/libraries/GCS_MAVLink/include/mavlink
# we have different config files for vrbrain_v52, vrbrain_v54
VRBRAIN_MK_DIR=$(MK_DIR)/VRBRAIN
VRBRAIN_V51_CONFIG_FILE=config_vrbrain-v51_APM.mk
VRBRAIN_V52_CONFIG_FILE=config_vrbrain-v52_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
SKETCHFLAGS=$(SKETCHLIBINCLUDES) -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-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=$(SKETCHBOOK)/mk/VRBRAIN/Tools/genmsg/src:$(SKETCHBOOK)/mk/VRBRAIN/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)" >> $(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) $(VRBRAIN_ROOT)/Archives/vrbrain-v51.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrbrain-v52.export $(SKETCHCPP) module_mk
$(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-v54: $(BUILDROOT)/make.flags CHECK_MODULES $(MAVLINK_HEADERS) $(VRBRAIN_ROOT)/Archives/vrbrain-v54.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrcore-v10.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrubrain-v51.export $(SKETCHCPP) module_mk
$(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) $(VRBRAIN_ROOT)/Archives/vrubrain-v52.export $(SKETCHCPP) module_mk
$(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"
vrbrainStd: vrbrain-v51 vrbrain-v52 vrbrain-v54 vrcore-v10 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
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-v51-upload: vrbrain-v51
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v51_APM upload
vrbrain-v52-upload: vrbrain-v52
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v52_APM upload
vrbrain-v54-upload: vrbrain-v54
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrbrain-v54_APM upload
vrcore-v10-upload: vrcore-v10
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrcore-v10_APM upload
vrubrain-v51-upload: vrubrain-v51
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrubrain-v51_APM upload
vrubrain-v52-upload: vrubrain-v52
$(RULEHDR)
$(v) $(VRBRAIN_MAKE) vrubrain-v52_APM upload
vrbrain-upload: vrbrain-v52-upload
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-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-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-v54 vrcore-v10 vrubrain-v51 vrubrain-v52"
vrbrain-info: module_mk
@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 "HASHADDER_FLAGS $(HASHADDER_FLAGS)"