From c45bf1ab810a255d3c66390e7ac285c1a6b0db52 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 5 Jan 2013 14:06:01 -0800 Subject: [PATCH 001/129] Fix a couple of things that break 'make export'. --- nuttx/configs/px4io/common/Make.defs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nuttx/configs/px4io/common/Make.defs b/nuttx/configs/px4io/common/Make.defs index 4958f70926..7f782b5b22 100644 --- a/nuttx/configs/px4io/common/Make.defs +++ b/nuttx/configs/px4io/common/Make.defs @@ -112,7 +112,6 @@ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") ARCHOPTIMIZATION += -g -ARCHSCRIPT += -g endif ARCHCFLAGS = -std=gnu99 @@ -145,7 +144,7 @@ ARCHDEFINES = ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 # this seems to be the only way to add linker flags -ARCHSCRIPT += --warn-common \ +EXTRA_LIBS += --warn-common \ --gc-sections CFLAGS = $(ARCHCFLAGS) $(ARCHCWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(INSTRUMENTATIONDEFINES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -fno-common From 085d08ce6c55d3fb979aa9847aea584fb7eb4f7c Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 5 Jan 2013 21:45:26 -0800 Subject: [PATCH 002/129] It seems to be safe to build these for any config. --- apps/systemlib/Makefile | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/systemlib/Makefile b/apps/systemlib/Makefile index 8240dbe432..b2e233a920 100644 --- a/apps/systemlib/Makefile +++ b/apps/systemlib/Makefile @@ -44,17 +44,9 @@ CSRCS = err.c \ cpuload.c \ getopt_long.c \ up_cxxinitialize.c \ + pid/pid.c \ + geo/geo.c \ + systemlib.c \ airspeed.c -# ppm_decode.c \ - -# -# XXX this really should be a CONFIG_* test -# -ifeq ($(TARGET),px4fmu) -CSRCS += systemlib.c \ - pid/pid.c \ - geo/geo.c -endif - include $(APPDIR)/mk/app.mk From b80575fcff926fb819adeb1760632586c19cf719 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 5 Jan 2013 21:46:50 -0800 Subject: [PATCH 003/129] Break up the firmware build into a 'make export' phase for NuttX on a per-board basis, and then a separate per-config phase that allows us to avoid re-building NuttX all the time, and ship more than one firmware config for a given board. This is a first cut; it builds one firmware for each of FMU and IO. --- makefiles/firmware.mk | 71 +++++++++++++++ makefiles/gnu-arm-eabi.mk | 177 ++++++++++++++++++++++++++++++++++++ makefiles/px4fmu.mk | 10 ++ makefiles/px4fmu_default.mk | 7 ++ makefiles/px4io.mk | 10 ++ makefiles/px4io_default.mk | 7 ++ platforms/empty.c | 3 + 7 files changed, 285 insertions(+) create mode 100644 makefiles/firmware.mk create mode 100644 makefiles/gnu-arm-eabi.mk create mode 100644 makefiles/px4fmu.mk create mode 100644 makefiles/px4fmu_default.mk create mode 100644 makefiles/px4io.mk create mode 100644 makefiles/px4io_default.mk create mode 100644 platforms/empty.c diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk new file mode 100644 index 0000000000..34741e79ed --- /dev/null +++ b/makefiles/firmware.mk @@ -0,0 +1,71 @@ +# +# Generic Makefile for PX4 firmware. +# +# Currently this assumes that we're just compiling SRCS +# and then linking the whole thing together. +# + +# +# Work out where this file is, so we can find other makefiles in the +# same directory. +# +export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST))) + +# +# Use the linker script from the NuttX export +# +LDSCRIPT = $(WORK_DIR)/nuttx-export/build/ld.script + +# +# Add directories from the NuttX export to the relevant search paths +# +INCLUDE_DIRS += $(WORK_DIR)/nuttx-export/include +LIB_DIRS += $(WORK_DIR)/nuttx-export/libs +LIBS += -lapps -lnuttx + +# +# Things that, if they change, might affect everything +# +GLOBAL_DEPS += $(MAKEFILE_LIST) + +# +# Include the platform configuration +# +include $(PX4_MK_INCLUDE)/$(PLATFORM).mk + +# +# What we're going to build +# +PRODUCT_BIN = $(WORK_DIR)/firmware.bin +PRODUCT_SYM = $(WORK_DIR)/firmware.sym +PRODUCTS = $(PRODUCT_BIN) $(PRODUCT_SYM) + +.PHONY: all +all: $(PRODUCTS) + +# +# Rules for building objects +# +OBJS = $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) + +$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c + @echo compile $< + @mkdir -p $(dir $@) + $(call COMPILE,$<,$@) + +$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)/%.cpp.o: %.cpp + @mkdir -p $(dir $@) + $(call COMPILEXX,$<,$@) + +$(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S + @mkdir -p $(dir $@) + $(call ASSEMBLE,$<,$@) + +-include $(DEP_INCLUDES) + +$(PRODUCT_BIN): $(PRODUCT_SYM) + $(call SYM_TO_BIN,$<,$@) + +$(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) + $(call LINK,$@,$(OBJS)) + diff --git a/makefiles/gnu-arm-eabi.mk b/makefiles/gnu-arm-eabi.mk new file mode 100644 index 0000000000..4dc337c9f1 --- /dev/null +++ b/makefiles/gnu-arm-eabi.mk @@ -0,0 +1,177 @@ +# +# Definitions for a generic GNU ARM-EABI toolchain +# + +CROSSDEV = arm-none-eabi- + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup + +MAXOPTIMIZATION = -O3 + +# base CPU flags +ARCHCPUFLAGS_CORTEXM4F = -mcpu=cortex-m4 \ + -mthumb \ + -march=armv7e-m \ + -mfpu=fpv4-sp-d16 \ + -mfloat-abi=hard + +ARCHCPUFLAGS_CORTEXM4 = -mcpu=cortex-m4 \ + -mthumb \ + -march=armv7e-m \ + -mfloat-abi=soft + +ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ + -mthumb \ + -march=armv6-m \ + -mfloat-abi=soft + +ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) + +# optimisation flags +ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ + -fno-strict-aliasing \ + -fno-strength-reduce \ + -fomit-frame-pointer \ + -funsafe-math-optimizations \ + -fno-builtin-printf \ + -ffunction-sections \ + -fdata-sections +ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") +ARCHOPTIMIZATION += -g +endif + +# enable precise stack overflow tracking +# note - requires corresponding support in NuttX +INSTRUMENTATIONDEFINES = -finstrument-functions \ + -ffixed-r10 + +ARCHCFLAGS = -std=gnu99 +ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x +ARCHWARNINGS = -Wall \ + -Wextra \ + -Wdouble-promotion \ + -Wshadow \ + -Wfloat-equal \ + -Wframe-larger-than=1024 \ + -Wpointer-arith \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wpacked \ + -Wno-unused-parameter +# -Wcast-qual - generates spurious noreturn attribute warnings, try again later +# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code +# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives + +ARCHCWARNINGS = $(ARCHWARNINGS) \ + -Wbad-function-cast \ + -Wstrict-prototypes \ + -Wold-style-declaration \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wunsuffixed-float-constants +ARCHWARNINGSXX = $(ARCHWARNINGS) + +# pull in *just* libm from the toolchain ... this is grody +LIBM = $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) +EXTRA_LIBS += $(LIBM) + +CFLAGS = $(ARCHCFLAGS) \ + $(ARCHCWARNINGS) \ + $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) \ + $(ARCHINCLUDES) \ + $(INSTRUMENTATIONDEFINES) \ + $(ARCHDEFINES) \ + $(EXTRADEFINES) \ + -fno-common + +CXXFLAGS = $(ARCHCXXFLAGS) \ + $(ARCHWARNINGSXX) \ + $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) \ + $(ARCHXXINCLUDES) \ + $(INSTRUMENTATIONDEFINES) \ + $(ARCHDEFINES) \ + $(EXTRADEFINES) + +CPPFLAGS = $(ARCHINCLUDES) \ + $(INSTRUMENTATIONDEFINES) \ + $(ARCHDEFINES) \ + $(EXTRADEFINES) + +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +LDFLAGS += --warn-common \ + --gc-sections \ + -T $(LDSCRIPT) \ + $(addprefix -L,$(LIB_DIRS)) + +LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) + + +# files that the final link depends on +# XXX add libraries that we know about here... +LINK_DEPS += $(LDSCRIPT) + +# files to include to get automated dependencies +DEP_INCLUDES = $(subst .o,.d,$(OBJS)) + +ifeq ($(V),) +Q = @ +else +Q = +endif + +# compile C source $1 to object $2 +# as a side-effect, generate a dependency file +define COMPILE + @echo "CC: $1" + $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 +endef + +# compile C++ source $1 to $2 +# as a side-effect, generate a dependency file +define COMPILEXX + @echo "CXX: $1" + $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 +endef + +# assemble $1 into $2 +define ASSEMBLE + @echo "AS: $1" + $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 +endef + +# produce partially-linked $1 from files in $2 +define PRELINK + @echo "PRELINK: $1" + $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 +endef + +# update the archive $1 with the files in $2 +define ARCHIVE + @echo "AR: $2" + $(Q) $(AR) $1 $2 +endef + +# Link the objects in $2 into the binary $1 +define LINK + @echo "LINK: $1" + $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group +endef + +# convert $1 from a linked object to a raw binary +define SYM_TO_BIN + @echo "BIN: $2" + $(Q) $(OBJCOPY) -O binary $1 $2 +endef diff --git a/makefiles/px4fmu.mk b/makefiles/px4fmu.mk new file mode 100644 index 0000000000..75833de9fd --- /dev/null +++ b/makefiles/px4fmu.mk @@ -0,0 +1,10 @@ +# +# Platform-specific definitions for the PX4FMU +# + +# +# Configure the toolchain +# +CONFIG_ARCH = CORTEXM4F + +include $(PX4_MK_INCLUDE)/gnu-arm-eabi.mk diff --git a/makefiles/px4fmu_default.mk b/makefiles/px4fmu_default.mk new file mode 100644 index 0000000000..6e78126ff0 --- /dev/null +++ b/makefiles/px4fmu_default.mk @@ -0,0 +1,7 @@ +# +# Makefile for the px4fmu_default configuration +# + +SRCS = $(PX4BASE)/platforms/empty.c + +include $(PX4BASE)/makefiles/firmware.mk diff --git a/makefiles/px4io.mk b/makefiles/px4io.mk new file mode 100644 index 0000000000..8ea9582cbf --- /dev/null +++ b/makefiles/px4io.mk @@ -0,0 +1,10 @@ +# +# Platform-specific definitions for the PX4IO +# + +# +# Configure the toolchain +# +CONFIG_ARCH = CORTEXM3 + +include $(PX4_MK_INCLUDE)/gnu-arm-eabi.mk diff --git a/makefiles/px4io_default.mk b/makefiles/px4io_default.mk new file mode 100644 index 0000000000..da480af095 --- /dev/null +++ b/makefiles/px4io_default.mk @@ -0,0 +1,7 @@ +# +# Makefile for the px4io_default configuration +# + +SRCS = $(PX4BASE)/platforms/empty.c + +include $(PX4BASE)/makefiles/firmware.mk diff --git a/platforms/empty.c b/platforms/empty.c new file mode 100644 index 0000000000..1395313542 --- /dev/null +++ b/platforms/empty.c @@ -0,0 +1,3 @@ +/* + * This is an empty C source file, used when building default firmware configurations. + */ From 2ebcd0fdcc4b743c3a8a32bae0852e9536bf3a6b Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 13:32:18 -0800 Subject: [PATCH 004/129] Switch to optimising some things for size rather than speed. --- apps/examples/nsh/Makefile | 2 ++ apps/nshlib/Makefile | 2 ++ apps/px4/tests/Makefile | 2 ++ apps/system/i2c/Makefile | 3 ++- apps/systemcmds/bl_update/Makefile | 2 ++ apps/systemcmds/boardinfo/Makefile | 2 ++ apps/systemcmds/calibration/Makefile | 2 ++ apps/systemcmds/delay_test/Makefile | 2 ++ apps/systemcmds/eeprom/Makefile | 3 +++ apps/systemcmds/mixer/Makefile | 2 ++ apps/systemcmds/param/Makefile | 2 ++ apps/systemcmds/perf/Makefile | 2 ++ apps/systemcmds/preflight_check/Makefile | 2 ++ apps/systemcmds/reboot/Makefile | 2 ++ apps/systemcmds/top/Makefile | 2 ++ 15 files changed, 31 insertions(+), 1 deletion(-) diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index c7d212fc2c..ad687958f6 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -64,6 +64,8 @@ ROOTDEPPATH = --dep-path . VPATH = +MAXOPTIMIZATION = -Os + all: .built .PHONY: clean depend distclean diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 76cdac40d5..4256a10918 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -107,6 +107,8 @@ endif ROOTDEPPATH = --dep-path . VPATH = +MAXOPTIMIZATION = -Os + # Build targets all: .built diff --git a/apps/px4/tests/Makefile b/apps/px4/tests/Makefile index cb1c3c6185..e27222b9de 100644 --- a/apps/px4/tests/Makefile +++ b/apps/px4/tests/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 12000 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os \ No newline at end of file diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index 1ed7a2faef..7f0e6005b5 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -64,8 +64,9 @@ VPATH = APPNAME = i2c PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 +MAXOPTIMIZATION = -Os -# Build targets +# Build Targets all: .built .PHONY: context .depend depend clean distclean diff --git a/apps/systemcmds/bl_update/Makefile b/apps/systemcmds/bl_update/Makefile index 9d0e156f60..d05493577a 100644 --- a/apps/systemcmds/bl_update/Makefile +++ b/apps/systemcmds/bl_update/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 4096 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/boardinfo/Makefile b/apps/systemcmds/boardinfo/Makefile index 753a6843e5..6f1be149c6 100644 --- a/apps/systemcmds/boardinfo/Makefile +++ b/apps/systemcmds/boardinfo/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/calibration/Makefile b/apps/systemcmds/calibration/Makefile index aa1aa77610..a1735962e1 100644 --- a/apps/systemcmds/calibration/Makefile +++ b/apps/systemcmds/calibration/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_MAX - 1 STACKSIZE = 4096 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/delay_test/Makefile b/apps/systemcmds/delay_test/Makefile index d30fcba27b..e54cf2f4e4 100644 --- a/apps/systemcmds/delay_test/Makefile +++ b/apps/systemcmds/delay_test/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/eeprom/Makefile b/apps/systemcmds/eeprom/Makefile index 2f3db0fdce..58c8cb5ec7 100644 --- a/apps/systemcmds/eeprom/Makefile +++ b/apps/systemcmds/eeprom/Makefile @@ -38,5 +38,8 @@ APPNAME = eeprom PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 4096 +MAXOPTIMIZATION = -Os include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/mixer/Makefile b/apps/systemcmds/mixer/Makefile index b016ddc578..3d8ac38cb7 100644 --- a/apps/systemcmds/mixer/Makefile +++ b/apps/systemcmds/mixer/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 4096 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/param/Makefile b/apps/systemcmds/param/Makefile index 603746a206..f19cadbb60 100644 --- a/apps/systemcmds/param/Makefile +++ b/apps/systemcmds/param/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 4096 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/perf/Makefile b/apps/systemcmds/perf/Makefile index 0134c9948b..f8bab41b65 100644 --- a/apps/systemcmds/perf/Makefile +++ b/apps/systemcmds/perf/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/preflight_check/Makefile b/apps/systemcmds/preflight_check/Makefile index f138e2640b..98aadaa86f 100644 --- a/apps/systemcmds/preflight_check/Makefile +++ b/apps/systemcmds/preflight_check/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/reboot/Makefile b/apps/systemcmds/reboot/Makefile index 9609a24fd0..15dd199829 100644 --- a/apps/systemcmds/reboot/Makefile +++ b/apps/systemcmds/reboot/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/top/Makefile b/apps/systemcmds/top/Makefile index c45775f4be..f58f9212e7 100644 --- a/apps/systemcmds/top/Makefile +++ b/apps/systemcmds/top/Makefile @@ -40,3 +40,5 @@ PRIORITY = SCHED_PRIORITY_DEFAULT - 10 STACKSIZE = 3000 include $(APPDIR)/mk/app.mk + +MAXOPTIMIZATION = -Os From d2d9800c2e7021a09175e964a41f43b71e94d996 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 18:23:49 -0800 Subject: [PATCH 005/129] Recover commits lost in the previous merge. Syllableise PX4_BASE like its peers. --- Makefile | 209 ++++++++++++++++++++++-------------- makefiles/firmware.mk | 6 ++ makefiles/px4fmu_default.mk | 4 +- makefiles/px4io_default.mk | 4 +- 4 files changed, 137 insertions(+), 86 deletions(-) diff --git a/Makefile b/Makefile index f91e75d0b6..7376d5221c 100644 --- a/Makefile +++ b/Makefile @@ -1,110 +1,150 @@ # # Top-level Makefile for building PX4 firmware images. # -# -# Note that this is a transitional process; the eventual goal is for this -# project to slim down and simply generate PX4 link kits via the NuttX -# 'make export' mechanism. -# -# + # # Some useful paths. # -export PX4BASE = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export NUTTX_SRC = $(PX4BASE)/nuttx -export NUTTX_APPS = $(PX4BASE)/apps -export MAVLINK_SRC = $(PX4BASE)/mavlink -export ROMFS_SRC = $(PX4BASE)/ROMFS -export IMAGE_DIR = $(PX4BASE)/Images +export PX4_BASE = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) +export NUTTX_SRC = $(PX4_BASE)/nuttx +export NUTTX_APPS = $(PX4_BASE)/apps +export MAVLINK_SRC = $(PX4_BASE)/mavlink +export ROMFS_SRC = $(PX4_BASE)/ROMFS +export IMAGE_DIR = $(PX4_BASE)/Images +export BUILD_DIR = $(PX4_BASE)/Build +export ARCHIVE_DIR = $(PX4_BASE)/Archives # # Tools # -MKFW = $(PX4BASE)/Tools/px_mkfw.py -UPLOADER = $(PX4BASE)/Tools/px_uploader.py +MKFW = $(PX4_BASE)/Tools/px_mkfw.py +UPLOADER = $(PX4_BASE)/Tools/px_uploader.py +COPY = cp +REMOVE = rm -f +RMDIR = rm -rf # -# What are we currently configured for? +# Canned firmware configurations that we build. # -CONFIGURED = $(PX4BASE)/.configured -ifneq ($(wildcard $(CONFIGURED)),) -export TARGET := $(shell cat $(CONFIGURED)) +CONFIGS ?= px4fmu_default px4io_default + +# +# If the user has listed a config as a target, strip it out and override CONFIGS +# +EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) +ifneq ($(EXPLICIT_CONFIGS),) +CONFIGS := $(EXPLICIT_CONFIGS) +.PHONY: $(EXPLICIT_CONFIGS) +$(EXPLICIT_CONFIGS): all endif # -# What we will build +# Platforms (boards) that we build prelink kits for. # -FIRMWARE_BUNDLE = $(IMAGE_DIR)/$(TARGET).px4 -FIRMWARE_BINARY = $(IMAGE_DIR)/$(TARGET).bin -FIRMWARE_PROTOTYPE = $(IMAGE_DIR)/$(TARGET).prototype +PLATFORMS = px4fmu px4io + +# +# Some handy macros +# +PLATFORM_FROM_CONFIG = $(word 1,$(subst _, ,$1)) + +# +# Built products +# +FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) +BINARIES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.bin) # # Debugging # MQUIET = --no-print-directory #MQUIET = --print-directory - -all: $(FIRMWARE_BUNDLE) - -# -# Generate a wrapped .px4 file from the built binary -# -$(FIRMWARE_BUNDLE): $(FIRMWARE_BINARY) $(MKFW) $(FIRMWARE_PROTOTYPE) - @echo Generating $@ - @$(MKFW) --prototype $(FIRMWARE_PROTOTYPE) \ - --git_identity $(PX4BASE) \ - --image $(FIRMWARE_BINARY) > $@ - -# -# Build the firmware binary. -# -.PHONY: $(FIRMWARE_BINARY) -$(FIRMWARE_BINARY): setup_$(TARGET) configure-check - @echo Building $@ for $(TARGET) - @make -C $(NUTTX_SRC) -r $(MQUIET) all - @cp $(NUTTX_SRC)/nuttx.bin $@ - -# -# The 'configure' targets select one particular firmware configuration -# and makes it current. -# -configure_px4fmu: - @echo Configuring for px4fmu - @make -C $(PX4BASE) distclean - @cd $(NUTTX_SRC)/tools && /bin/sh configure.sh px4fmu/nsh - @echo px4fmu > $(CONFIGURED) - -configure_px4io: - @echo Configuring for px4io - @make -C $(PX4BASE) distclean - @cd $(NUTTX_SRC)/tools && /bin/sh configure.sh px4io/io - @echo px4io > $(CONFIGURED) - -configure-check: -ifeq ($(wildcard $(CONFIGURED)),) - @echo - @echo "Not configured - use 'make configure_px4fmu' or 'make configure_px4io' first" - @echo - @exit 1 +ifeq ($(V),) +Q = @ +else +Q = endif +all: $(FIRMWARES) +#all: $(SYMBOLS) + # -# Per-configuration additional targets +# Generate FIRMWARES from BINARIES # -.PHONY: px4fmu_setup -setup_px4fmu: - @echo Generating ROMFS - @make -C $(ROMFS_SRC) all +$(IMAGE_DIR)/%.px4: basepath = $(basename $(@)) +$(IMAGE_DIR)/%.px4: config = $(notdir $(basepath)) +$(IMAGE_DIR)/%.px4: platform = $(call PLATFORM_FROM_CONFIG,$(config)) +$(FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.bin + @echo %% Generating $@ for $(config) + $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(platform).prototype \ + --git_identity $(PX4_BASE) \ + --image $< > $@ + +# +# Generate the firmware executable +# +# XXX pick the right build tool for the host OS - force it on the generation side too. +# +$(BUILD_DIR)/%.build/firmware.bin: config = $(patsubst $(BUILD_DIR)/%.build/firmware.bin,%,$@) +$(BUILD_DIR)/%.build/firmware.bin: work_dir = $(BUILD_DIR)/$(config).build +$(BINARIES): $(BUILD_DIR)/%.build/firmware.bin: $(BUILD_DIR)/$(word 1,$(subst _, ,%)).build + @echo %% Building $(config) in $(work_dir) + $(Q) make -C $(work_dir) \ + -f $(PX4_BASE)/makefiles/$(config).mk \ + CONFIG=$(config) \ + PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \ + WORK_DIR=$(work_dir) + +# +# Generate the config build directory. +# +BUILDAREAS = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build) +.PHONY: buildareas +buildareas: $(BUILDAREAS) + +$(BUILD_DIR)/%.build: config = $(notdir $(basename $@)) +$(BUILD_DIR)/%.build: platform = $(call PLATFORM_FROM_CONFIG,$(config)) +$(BUILDAREAS): $(BUILD_DIR)/%.build: + @echo %% Setting up build environment for $(config) + $(Q) mkdir -p $@ + $(Q) (cd $@ && $(RMDIR) nuttx-export && unzip -q $(ARCHIVE_DIR)/$(platform).export) + +# +# Build the NuttX export archives. +# +# Note that there are no explicit dependencies extended from these +# archives. If NuttX is updated, the user is expected to rebuild the +# archives/build area manually. +# +# XXX Should support fetching/unpacking from a separate directory to permit +# downloads of the prebuilt archives as well... +# +# XXX PX4IO config name is bad - we should just call them all "px4" +# +NUTTX_ARCHIVES = $(foreach platform,$(PLATFORMS),$(ARCHIVE_DIR)/$(platform).export) +.PHONY: archives +archives: $(NUTTX_ARCHIVES) + +$(ARCHIVE_DIR)/%.export: platform = $(notdir $(basename $@)) +$(ARCHIVE_DIR)/%.export: config = $(if $(filter $(platform),px4io),io,nsh) +$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) + @echo %% Configuring NuttX for $(platform) + $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) + $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean + $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(config)) + @echo Generating ROMFS for $(platform) XXX move this! + $(Q) make -C $(ROMFS_SRC) all + @echo %% Exporting NuttX for $(platform) + $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export + $(Q) mkdir -p $(dir $@) + $(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@ setup_px4io: -# fake target to make configure-check happy if TARGET is not set -setup_: - # -# Firmware uploading. +# Firmware upload. # # serial port defaults by operating system. @@ -129,10 +169,12 @@ ifeq ($(JTAGCONFIG),) JTAGCONFIG=interface/olimex-jtag-tiny.cfg endif -upload-jtag-px4fmu: +.PHONY: upload-jtag-px4fmu +upload-jtag-px4fmu: all @echo Attempting to flash PX4FMU board via JTAG @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown +.PHONY: upload-jtag-px4io upload-jtag-px4io: all @echo Attempting to flash PX4IO board via JTAG @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown @@ -151,14 +193,17 @@ endif # a complete re-compilation, 'distclean' should remove everything # that's generated leaving only files that are in source control. # -.PHONY: clean upload-jtag-px4fmu +.PHONY: clean clean: - @make -C $(NUTTX_SRC) -r $(MQUIET) distclean - @make -C $(ROMFS_SRC) -r $(MQUIET) clean + $(Q) $(RMDIR) $(BUILD_DIR)/*.build + $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.bin + $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.sym + $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.px4 + $(Q) make -C $(ROMFS_SRC) -r $(MQUIET) clean .PHONY: distclean -distclean: - @rm -f $(CONFIGURED) - @make -C $(NUTTX_SRC) -r $(MQUIET) distclean - @make -C $(ROMFS_SRC) -r $(MQUIET) distclean +distclean: clean + $(Q) $(REMOVE) -f $(ARCHIVE_DIR)/*.export + $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean + $(Q) make -C $(ROMFS_SRC) -r $(MQUIET) distclean diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 34741e79ed..3f41ec6521 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -9,7 +9,12 @@ # Work out where this file is, so we can find other makefiles in the # same directory. # +# If PX4_BASE wasn't set previously, set it here now. +# export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST))) +ifeq ($(PX4_BASE),) +export PX4_BASE := $(abspath $(PX4_MK_INCLUDE)/..) +endif # # Use the linker script from the NuttX export @@ -36,6 +41,7 @@ include $(PX4_MK_INCLUDE)/$(PLATFORM).mk # # What we're going to build # +PRODUCT_BUNDLE = $(WORK_DIR)/firmware.px4 PRODUCT_BIN = $(WORK_DIR)/firmware.bin PRODUCT_SYM = $(WORK_DIR)/firmware.sym PRODUCTS = $(PRODUCT_BIN) $(PRODUCT_SYM) diff --git a/makefiles/px4fmu_default.mk b/makefiles/px4fmu_default.mk index 6e78126ff0..1dd3e6ab49 100644 --- a/makefiles/px4fmu_default.mk +++ b/makefiles/px4fmu_default.mk @@ -2,6 +2,6 @@ # Makefile for the px4fmu_default configuration # -SRCS = $(PX4BASE)/platforms/empty.c +SRCS = $(PX4_BASE)/platforms/empty.c -include $(PX4BASE)/makefiles/firmware.mk +include $(PX_4BASE)/makefiles/firmware.mk diff --git a/makefiles/px4io_default.mk b/makefiles/px4io_default.mk index da480af095..2d96fa2fba 100644 --- a/makefiles/px4io_default.mk +++ b/makefiles/px4io_default.mk @@ -2,6 +2,6 @@ # Makefile for the px4io_default configuration # -SRCS = $(PX4BASE)/platforms/empty.c +SRCS = $(PX4_BASE)/platforms/empty.c -include $(PX4BASE)/makefiles/firmware.mk +include $(PX4_BASE)/makefiles/firmware.mk From 0140457d03dbf80c95f60df53b8b99248640df22 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 21:02:09 -0800 Subject: [PATCH 006/129] Minor fixes to the toolchain definitions. --- makefiles/gnu-arm-eabi.mk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/makefiles/gnu-arm-eabi.mk b/makefiles/gnu-arm-eabi.mk index 4dc337c9f1..73ac30669a 100644 --- a/makefiles/gnu-arm-eabi.mk +++ b/makefiles/gnu-arm-eabi.mk @@ -2,6 +2,8 @@ # Definitions for a generic GNU ARM-EABI toolchain # +$(info %% Toolchain: gnu-arm-eabi) + CROSSDEV = arm-none-eabi- CC = $(CROSSDEV)gcc @@ -31,13 +33,17 @@ ARCHCPUFLAGS_CORTEXM4 = -mcpu=cortex-m4 \ ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ -mthumb \ - -march=armv6-m \ + -march=armv7-m \ -mfloat-abi=soft ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) +ifeq ($(ARCHCPUFLAGS),) +$(error Must set CONFIG_ARCH to one of CORTEXM4F, CORTEXM4 or CORTEXM3) +endif # optimisation flags ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ + -g \ -fno-strict-aliasing \ -fno-strength-reduce \ -fomit-frame-pointer \ @@ -45,9 +51,6 @@ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ -fno-builtin-printf \ -ffunction-sections \ -fdata-sections -ifeq ("${CONFIG_DEBUG_SYMBOLS}","y") -ARCHOPTIMIZATION += -g -endif # enable precise stack overflow tracking # note - requires corresponding support in NuttX @@ -82,7 +85,7 @@ ARCHCWARNINGS = $(ARCHWARNINGS) \ ARCHWARNINGSXX = $(ARCHWARNINGS) # pull in *just* libm from the toolchain ... this is grody -LIBM = $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) +LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) EXTRA_LIBS += $(LIBM) CFLAGS = $(ARCHCFLAGS) \ @@ -118,7 +121,6 @@ LDFLAGS += --warn-common \ LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) - # files that the final link depends on # XXX add libraries that we know about here... LINK_DEPS += $(LDSCRIPT) From e692ccc44ec017f79c74a9bab619019007e27cfe Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 21:03:27 -0800 Subject: [PATCH 007/129] Move more functionality into firmware.mk. Now we build the px4 bundles in a way that will let external builders generate them too. Pass the platform define into the firmware builder. --- Makefile | 65 ++++++------- makefiles/firmware.mk | 179 ++++++++++++++++++++++++++++++++---- makefiles/px4fmu_default.mk | 3 +- makefiles/px4io_default.mk | 1 + 4 files changed, 189 insertions(+), 59 deletions(-) diff --git a/Makefile b/Makefile index 7376d5221c..5a6ee0faec 100644 --- a/Makefile +++ b/Makefile @@ -52,45 +52,33 @@ PLATFORM_FROM_CONFIG = $(word 1,$(subst _, ,$1)) # # Built products # -FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) -BINARIES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.bin) +STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) +FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.px4) # # Debugging # MQUIET = --no-print-directory #MQUIET = --print-directory -ifeq ($(V),) -Q = @ -else -Q = -endif - -all: $(FIRMWARES) -#all: $(SYMBOLS) +Q := $(if $(V),,@) +all: $(STAGED_FIRMWARES) # -# Generate FIRMWARES from BINARIES +# Copy FIRMWARES into the image directory. # -$(IMAGE_DIR)/%.px4: basepath = $(basename $(@)) -$(IMAGE_DIR)/%.px4: config = $(notdir $(basepath)) -$(IMAGE_DIR)/%.px4: platform = $(call PLATFORM_FROM_CONFIG,$(config)) -$(FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.bin - @echo %% Generating $@ for $(config) - $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(platform).prototype \ - --git_identity $(PX4_BASE) \ - --image $< > $@ +$(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 + @echo %% Copying $@ + $(Q) $(COPY) $< $@ # -# Generate the firmware executable +# Generate FIRMWARES # -# XXX pick the right build tool for the host OS - force it on the generation side too. -# -$(BUILD_DIR)/%.build/firmware.bin: config = $(patsubst $(BUILD_DIR)/%.build/firmware.bin,%,$@) -$(BUILD_DIR)/%.build/firmware.bin: work_dir = $(BUILD_DIR)/$(config).build -$(BINARIES): $(BUILD_DIR)/%.build/firmware.bin: $(BUILD_DIR)/$(word 1,$(subst _, ,%)).build - @echo %% Building $(config) in $(work_dir) +$(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@) +$(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build +$(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: + @echo %%%% Building $(config) in $(work_dir) + $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ -f $(PX4_BASE)/makefiles/$(config).mk \ CONFIG=$(config) \ @@ -100,23 +88,24 @@ $(BINARIES): $(BUILD_DIR)/%.build/firmware.bin: $(BUILD_DIR)/$(word 1,$(subst _, # # Generate the config build directory. # -BUILDAREAS = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build) -.PHONY: buildareas -buildareas: $(BUILDAREAS) - -$(BUILD_DIR)/%.build: config = $(notdir $(basename $@)) -$(BUILD_DIR)/%.build: platform = $(call PLATFORM_FROM_CONFIG,$(config)) -$(BUILDAREAS): $(BUILD_DIR)/%.build: - @echo %% Setting up build environment for $(config) - $(Q) mkdir -p $@ - $(Q) (cd $@ && $(RMDIR) nuttx-export && unzip -q $(ARCHIVE_DIR)/$(platform).export) +#BUILDAREAS = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build) +#.PHONY: buildareas +#buildareas: $(BUILDAREAS) +# +#$(BUILD_DIR)/%.build: config = $(notdir $(basename $@)) +#$(BUILD_DIR)/%.build: platform = $(call PLATFORM_FROM_CONFIG,$(config)) +#$(BUILDAREAS): $(BUILD_DIR)/%.build: +# @echo %% Setting up build environment for $(config) +# $(Q) mkdir -p $@ +# $(Q) (cd $@ && $(RMDIR) nuttx-export && unzip -q $(ARCHIVE_DIR)/$(platform).export) # # Build the NuttX export archives. # # Note that there are no explicit dependencies extended from these # archives. If NuttX is updated, the user is expected to rebuild the -# archives/build area manually. +# archives/build area manually. Likewise, when the 'archives' target is +# invoked, all archives are always rebuilt. # # XXX Should support fetching/unpacking from a separate directory to permit # downloads of the prebuilt archives as well... @@ -196,8 +185,6 @@ endif .PHONY: clean clean: $(Q) $(RMDIR) $(BUILD_DIR)/*.build - $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.bin - $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.sym $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.px4 $(Q) make -C $(ROMFS_SRC) -r $(MQUIET) clean diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 3f41ec6521..1ecc7da95f 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -4,70 +4,198 @@ # Currently this assumes that we're just compiling SRCS # and then linking the whole thing together. # +# Requires: +# +# PLATFORM +# Must be set to a platform name known to the PX4 distribution. +# +# Optional: +# +# PX4_BASE: +# Points to a PX4 distribution. Normally determined based on the +# path to this file. +# +# CONFIG: +# Used to set the output filename; defaults to 'firmware'. +# +# WORK_DIR: +# Sets the directory in which the firmware will be built. Defaults +# to the directory 'build' under the directory containing the +# parent Makefile. +# + +################################################################################ +# Paths and configuration +################################################################################ # # Work out where this file is, so we can find other makefiles in the # same directory. # -# If PX4_BASE wasn't set previously, set it here now. +# If PX4_BASE wasn't set previously, work out what it should be +# and set it here now. # export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(PX4_MK_INCLUDE)/..) endif +$(info %% PX4_BASE $(PX4_BASE)) + +# +# If WORK_DIR is not set, create a 'build' directory next to the +# parent Makefile. +# +PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +ifeq ($(WORK_DIR),) +export WORK_DIR := $(dir $(PARENT_MAKEFILE))/build +endif +$(info %% WORK_DIR $(WORK_DIR)) + +# +# Paths +# +export NUTTX_SRC = $(PX4_BASE)/nuttx +export NUTTX_APPS = $(PX4_BASE)/apps +export MAVLINK_SRC = $(PX4_BASE)/mavlink +export ROMFS_SRC = $(PX4_BASE)/ROMFS +export IMAGE_DIR = $(PX4_BASE)/Images +export BUILD_DIR = $(PX4_BASE)/Build +export ARCHIVE_DIR = $(PX4_BASE)/Archives + +# +# Extra tools. +# +# XXX should be in a common toolchain config somewhere. +# +MKFW = $(PX4_BASE)/Tools/px_mkfw.py +UPLOADER = $(PX4_BASE)/Tools/px_uploader.py +COPY = cp +REMOVE = rm -f +RMDIR = rm -rf + +# +# Sanity-check the PLATFORM variable and then get the platform config. +# +# The platform config in turn will fetch the toolchain configuration. +# +ifeq ($(PLATFORM),) +$(error The PLATFORM variable must be set before including firmware.mk) +endif +include $(PX4_MK_INCLUDE)/$(PLATFORM).mk + +# +# Makefile debugging. +# +Q := $(if $(V),,@) + +# +# Host-specific paths, hacks and fixups +# +SYSTYPE := $(shell uname -s) + +ifeq ($(SYSTYPE),Darwin) +# Eclipse may not have the toolchain on its path. +export PATH := $(PATH):/usr/local/bin +endif + +# +# Serial port defaults. +# +# XXX The uploader should be smarter than this. +# +ifeq ($(SYSTYPE),Darwin) +SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" +endif +ifeq ($(SYSTYPE),Linux) +SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" +endif +ifeq ($(SERIAL_PORTS),) +SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +endif + +################################################################################ +# NuttX libraries and paths +################################################################################ + +# +# Check that the NuttX archive for the selected platform is available. +# +NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(PLATFORM).export) +ifeq ($(NUTTX_ARCHIVE),) +$(error The NuttX export archive for $(PLATFORM) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) +endif + +# +# The NuttX config header should always be present in the NuttX archive, and +# if it changes, everything should be rebuilt. So, use it as the trigger to +# unpack the NuttX archive. +# +NUTTX_EXPORT_DIR = $(WORK_DIR)/nuttx-export +NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)/include/nuttx/config.h # # Use the linker script from the NuttX export # -LDSCRIPT = $(WORK_DIR)/nuttx-export/build/ld.script +LDSCRIPT = $(NUTTX_EXPORT_DIR)/build/ld.script # # Add directories from the NuttX export to the relevant search paths # -INCLUDE_DIRS += $(WORK_DIR)/nuttx-export/include -LIB_DIRS += $(WORK_DIR)/nuttx-export/libs +INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)/include +LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs LIBS += -lapps -lnuttx +LINK_DEPS += $(wildcard $(addsuffix /*.a,$(LIB_DIRS))) + +################################################################################ +# Build rules +################################################################################ # # Things that, if they change, might affect everything # -GLOBAL_DEPS += $(MAKEFILE_LIST) +GLOBAL_DEPS += $(MAKEFILE_LIST) $(NUTTX_CONFIG_HEADER) # -# Include the platform configuration -# -include $(PX4_MK_INCLUDE)/$(PLATFORM).mk - -# -# What we're going to build +# What we're going to build. # PRODUCT_BUNDLE = $(WORK_DIR)/firmware.px4 PRODUCT_BIN = $(WORK_DIR)/firmware.bin PRODUCT_SYM = $(WORK_DIR)/firmware.sym -PRODUCTS = $(PRODUCT_BIN) $(PRODUCT_SYM) .PHONY: all -all: $(PRODUCTS) +all: $(PRODUCT_BUNDLE) # -# Rules for building objects +# Object files we will generate from sources # OBJS = $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) -$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c - @echo compile $< +# +# Rules +# + +$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call COMPILE,$<,$@) -$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)/%.cpp.o: %.cpp +$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)/%.cpp.o: %.cpp $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call COMPILEXX,$<,$@) -$(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S +$(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call ASSEMBLE,$<,$@) --include $(DEP_INCLUDES) +$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) + @echo %% Unpacking $(NUTTX_ARCHIVE) + $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) touch $@ + +$(PRODUCT_BUNDLE): $(PRODUCT_BIN) + @echo %% Generating $@ + $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(PLATFORM).prototype \ + --git_identity $(PX4_BASE) \ + --image $< > $@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(call SYM_TO_BIN,$<,$@) @@ -75,3 +203,16 @@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(call LINK,$@,$(OBJS)) +upload: $(PRODUCT_BUNDLE) $(UPLOADER) + @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE) + +clean: + @echo %% cleaning + $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) + $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) + $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) + +# +# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS) +# +-include $(DEP_INCLUDES) diff --git a/makefiles/px4fmu_default.mk b/makefiles/px4fmu_default.mk index 1dd3e6ab49..9bb5e09a46 100644 --- a/makefiles/px4fmu_default.mk +++ b/makefiles/px4fmu_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4fmu_default configuration # +PLATFORM = px4fmu SRCS = $(PX4_BASE)/platforms/empty.c -include $(PX_4BASE)/makefiles/firmware.mk +include $(PX4_BASE)/makefiles/firmware.mk diff --git a/makefiles/px4io_default.mk b/makefiles/px4io_default.mk index 2d96fa2fba..e961e46f70 100644 --- a/makefiles/px4io_default.mk +++ b/makefiles/px4io_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4io_default configuration # +PLATFORM = px4io SRCS = $(PX4_BASE)/platforms/empty.c include $(PX4_BASE)/makefiles/firmware.mk From 06951351054df9799b966b04efd8f5aae6e3a062 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 21:11:48 -0800 Subject: [PATCH 008/129] Ignore NuttX export archives and anything in the Build directory. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8e9075ba49..69edb0dce7 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,5 @@ mavlink/include/mavlink/v0.9/ core .gdbinit mkdeps +Archives +Build From e9f2197bfa40522d6a58e01888dada4531d9dbcf Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 21:12:15 -0800 Subject: [PATCH 009/129] Move upload functionality out into a separate makefile. --- Makefile | 61 ------------------------------------------- makefiles/firmware.mk | 24 +++++------------ makefiles/upload.mk | 41 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 79 deletions(-) create mode 100644 makefiles/upload.mk diff --git a/Makefile b/Makefile index 5a6ee0faec..bcbe6b7908 100644 --- a/Makefile +++ b/Makefile @@ -85,20 +85,6 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \ WORK_DIR=$(work_dir) -# -# Generate the config build directory. -# -#BUILDAREAS = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build) -#.PHONY: buildareas -#buildareas: $(BUILDAREAS) -# -#$(BUILD_DIR)/%.build: config = $(notdir $(basename $@)) -#$(BUILD_DIR)/%.build: platform = $(call PLATFORM_FROM_CONFIG,$(config)) -#$(BUILDAREAS): $(BUILD_DIR)/%.build: -# @echo %% Setting up build environment for $(config) -# $(Q) mkdir -p $@ -# $(Q) (cd $@ && $(RMDIR) nuttx-export && unzip -q $(ARCHIVE_DIR)/$(platform).export) - # # Build the NuttX export archives. # @@ -130,53 +116,6 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) $(Q) mkdir -p $(dir $@) $(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@ -setup_px4io: - -# -# Firmware upload. -# - -# serial port defaults by operating system. -SYSTYPE = $(shell uname) -ifeq ($(SYSTYPE),Darwin) -SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" -endif -ifeq ($(SYSTYPE),Linux) -SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" -endif -ifeq ($(SERIAL_PORTS),) -SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" -endif - -upload: $(FIRMWARE_BUNDLE) $(UPLOADER) - @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(FIRMWARE_BUNDLE) - -# -# JTAG firmware uploading with OpenOCD -# -ifeq ($(JTAGCONFIG),) -JTAGCONFIG=interface/olimex-jtag-tiny.cfg -endif - -.PHONY: upload-jtag-px4fmu -upload-jtag-px4fmu: all - @echo Attempting to flash PX4FMU board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown - -.PHONY: upload-jtag-px4io -upload-jtag-px4io: all - @echo Attempting to flash PX4IO board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown - -# -# Hacks and fixups -# - -ifeq ($(SYSTYPE),Darwin) -# PATH inherited by Eclipse may not include toolchain install location -export PATH := $(PATH):/usr/local/bin -endif - # # Cleanup targets. 'clean' should remove all built products and force # a complete re-compilation, 'distclean' should remove everything diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 1ecc7da95f..c85c5c919d 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -68,7 +68,6 @@ export ARCHIVE_DIR = $(PX4_BASE)/Archives # XXX should be in a common toolchain config somewhere. # MKFW = $(PX4_BASE)/Tools/px_mkfw.py -UPLOADER = $(PX4_BASE)/Tools/px_uploader.py COPY = cp REMOVE = rm -f RMDIR = rm -rf @@ -98,21 +97,6 @@ ifeq ($(SYSTYPE),Darwin) export PATH := $(PATH):/usr/local/bin endif -# -# Serial port defaults. -# -# XXX The uploader should be smarter than this. -# -ifeq ($(SYSTYPE),Darwin) -SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" -endif -ifeq ($(SYSTYPE),Linux) -SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" -endif -ifeq ($(SERIAL_PORTS),) -SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" -endif - ################################################################################ # NuttX libraries and paths ################################################################################ @@ -203,8 +187,12 @@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(call LINK,$@,$(OBJS)) -upload: $(PRODUCT_BUNDLE) $(UPLOADER) - @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE) +upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) + $(Q) make -f $(PX4_MK_INCLUDE)/upload.mk \ + METHOD=serial \ + PRODUCT=$(PRODUCT) \ + BUNDLE=$(PRODUCT_BUNDLE) \ + BIN=$(PRODUCT_BIN) clean: @echo %% cleaning diff --git a/makefiles/upload.mk b/makefiles/upload.mk new file mode 100644 index 0000000000..15e0e240aa --- /dev/null +++ b/makefiles/upload.mk @@ -0,0 +1,41 @@ +# +# Rules and tools for uploading firmware. +# + +UPLOADER = $(PX4_BASE)/Tools/px_uploader.py + +SYSTYPE := $(shell uname -s) + +# +# Serial port defaults. +# +# XXX The uploader should be smarter than this. +# +ifeq ($(SYSTYPE),Darwin) +SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" +endif +ifeq ($(SYSTYPE),Linux) +SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" +endif +ifeq ($(SERIAL_PORTS),) +SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +endif + +.PHONY: all upload-$(METHOD)-$(PRODUCT) +all: upload-$(METHOD)-$(PRODUCT) + +upload-serial-px4fmu: $(BUNDLE) $(UPLOADER) + @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE) + +# +# JTAG firmware uploading with OpenOCD +# +JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg + +upload-jtag-px4fmu: all + @echo Attempting to flash PX4FMU board via JTAG + @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown + +upload-jtag-px4io: all + @echo Attempting to flash PX4IO board via JTAG + @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown From 8440e4f70907e87661e295f1585208620d68b84e Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 22:38:47 -0800 Subject: [PATCH 010/129] Simplify the PLATFORM/CONFIG handling a little. --- Makefile | 19 ++++++------------- makefiles/firmware.mk | 6 +++++- makefiles/px4fmu_default.mk | 1 + makefiles/px4io_default.mk | 1 + 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index bcbe6b7908..20a23b3f12 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,11 @@ RMDIR = rm -rf # CONFIGS ?= px4fmu_default px4io_default +# +# Platforms (boards) that we build NuttX export kits for. +# +PLATFORMS = px4fmu px4io + # # If the user has listed a config as a target, strip it out and override CONFIGS # @@ -39,16 +44,6 @@ CONFIGS := $(EXPLICIT_CONFIGS) $(EXPLICIT_CONFIGS): all endif -# -# Platforms (boards) that we build prelink kits for. -# -PLATFORMS = px4fmu px4io - -# -# Some handy macros -# -PLATFORM_FROM_CONFIG = $(word 1,$(subst _, ,$1)) - # # Built products # @@ -72,7 +67,7 @@ $(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 $(Q) $(COPY) $< $@ # -# Generate FIRMWARES +# Generate FIRMWARES. # $(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@) $(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build @@ -81,8 +76,6 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ -f $(PX4_BASE)/makefiles/$(config).mk \ - CONFIG=$(config) \ - PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \ WORK_DIR=$(work_dir) # diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index c85c5c919d..cde6460369 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -74,11 +74,15 @@ RMDIR = rm -rf # # Sanity-check the PLATFORM variable and then get the platform config. +# If PLATFORM is not set, but CONFIG is, use that. # # The platform config in turn will fetch the toolchain configuration. # ifeq ($(PLATFORM),) -$(error The PLATFORM variable must be set before including firmware.mk) +ifeq ($(CONFIG),) +$(error At least one of the PLATFORM or CONFIG variables must be set before including firmware.mk) +endif +PLATFORM := $(firstword $(subst _, ,$(CONFIG))) endif include $(PX4_MK_INCLUDE)/$(PLATFORM).mk diff --git a/makefiles/px4fmu_default.mk b/makefiles/px4fmu_default.mk index 9bb5e09a46..6f7eaa41d0 100644 --- a/makefiles/px4fmu_default.mk +++ b/makefiles/px4fmu_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4fmu_default configuration # +CONFIG = px4fmu_default PLATFORM = px4fmu SRCS = $(PX4_BASE)/platforms/empty.c diff --git a/makefiles/px4io_default.mk b/makefiles/px4io_default.mk index e961e46f70..d4f43d7014 100644 --- a/makefiles/px4io_default.mk +++ b/makefiles/px4io_default.mk @@ -2,6 +2,7 @@ # Makefile for the px4io_default configuration # +CONFIG = px4io_default PLATFORM = px4io SRCS = $(PX4_BASE)/platforms/empty.c From 963621c1f34ce3ed7fd43c9943a0841404431d89 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 22:44:27 -0800 Subject: [PATCH 011/129] Rename makefiles to help categorise them. --- Makefile | 9 +++++---- .../{px4fmu_default.mk => config_px4fmu_default.mk} | 1 - makefiles/{px4io_default.mk => config_px4io_default.mk} | 1 - makefiles/firmware.mk | 2 +- makefiles/{px4fmu.mk => platform_px4fmu.mk} | 2 +- makefiles/{px4io.mk => platform_px4io.mk} | 2 +- makefiles/{gnu-arm-eabi.mk => toolchain_gnu-arm-eabi.mk} | 0 7 files changed, 8 insertions(+), 9 deletions(-) rename makefiles/{px4fmu_default.mk => config_px4fmu_default.mk} (89%) rename makefiles/{px4io_default.mk => config_px4io_default.mk} (89%) rename makefiles/{px4fmu.mk => platform_px4fmu.mk} (67%) rename makefiles/{px4io.mk => platform_px4io.mk} (67%) rename makefiles/{gnu-arm-eabi.mk => toolchain_gnu-arm-eabi.mk} (100%) diff --git a/Makefile b/Makefile index 20a23b3f12..4d42831f4f 100644 --- a/Makefile +++ b/Makefile @@ -69,13 +69,14 @@ $(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 # # Generate FIRMWARES. # +.PHONY: $(FIRMWARES) $(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@) $(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: @echo %%%% Building $(config) in $(work_dir) $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ - -f $(PX4_BASE)/makefiles/$(config).mk \ + -f $(PX4_BASE)/makefiles/config_$(config).mk \ WORK_DIR=$(work_dir) # @@ -89,19 +90,19 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: # XXX Should support fetching/unpacking from a separate directory to permit # downloads of the prebuilt archives as well... # -# XXX PX4IO config name is bad - we should just call them all "px4" +# XXX PX4IO configuration name is bad - NuttX configs should probably all be "px4" # NUTTX_ARCHIVES = $(foreach platform,$(PLATFORMS),$(ARCHIVE_DIR)/$(platform).export) .PHONY: archives archives: $(NUTTX_ARCHIVES) $(ARCHIVE_DIR)/%.export: platform = $(notdir $(basename $@)) -$(ARCHIVE_DIR)/%.export: config = $(if $(filter $(platform),px4io),io,nsh) +$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(platform),px4io),io,nsh) $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) @echo %% Configuring NuttX for $(platform) $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(config)) + $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(configuration)) @echo Generating ROMFS for $(platform) XXX move this! $(Q) make -C $(ROMFS_SRC) all @echo %% Exporting NuttX for $(platform) diff --git a/makefiles/px4fmu_default.mk b/makefiles/config_px4fmu_default.mk similarity index 89% rename from makefiles/px4fmu_default.mk rename to makefiles/config_px4fmu_default.mk index 6f7eaa41d0..45b1170ff0 100644 --- a/makefiles/px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -3,7 +3,6 @@ # CONFIG = px4fmu_default -PLATFORM = px4fmu SRCS = $(PX4_BASE)/platforms/empty.c include $(PX4_BASE)/makefiles/firmware.mk diff --git a/makefiles/px4io_default.mk b/makefiles/config_px4io_default.mk similarity index 89% rename from makefiles/px4io_default.mk rename to makefiles/config_px4io_default.mk index d4f43d7014..f47e7968b5 100644 --- a/makefiles/px4io_default.mk +++ b/makefiles/config_px4io_default.mk @@ -3,7 +3,6 @@ # CONFIG = px4io_default -PLATFORM = px4io SRCS = $(PX4_BASE)/platforms/empty.c include $(PX4_BASE)/makefiles/firmware.mk diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index cde6460369..338bda8d3f 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -84,7 +84,7 @@ $(error At least one of the PLATFORM or CONFIG variables must be set before incl endif PLATFORM := $(firstword $(subst _, ,$(CONFIG))) endif -include $(PX4_MK_INCLUDE)/$(PLATFORM).mk +include $(PX4_MK_INCLUDE)/platform_$(PLATFORM).mk # # Makefile debugging. diff --git a/makefiles/px4fmu.mk b/makefiles/platform_px4fmu.mk similarity index 67% rename from makefiles/px4fmu.mk rename to makefiles/platform_px4fmu.mk index 75833de9fd..a9e103cc8a 100644 --- a/makefiles/px4fmu.mk +++ b/makefiles/platform_px4fmu.mk @@ -7,4 +7,4 @@ # CONFIG_ARCH = CORTEXM4F -include $(PX4_MK_INCLUDE)/gnu-arm-eabi.mk +include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/px4io.mk b/makefiles/platform_px4io.mk similarity index 67% rename from makefiles/px4io.mk rename to makefiles/platform_px4io.mk index 8ea9582cbf..7de24a60bd 100644 --- a/makefiles/px4io.mk +++ b/makefiles/platform_px4io.mk @@ -7,4 +7,4 @@ # CONFIG_ARCH = CORTEXM3 -include $(PX4_MK_INCLUDE)/gnu-arm-eabi.mk +include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk similarity index 100% rename from makefiles/gnu-arm-eabi.mk rename to makefiles/toolchain_gnu-arm-eabi.mk From a7a1cc4625ea4097761a9aef88f9f0b4608944a4 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 16 Jan 2013 23:40:40 -0800 Subject: [PATCH 012/129] Add support for per-config ROMFS generation. --- Makefile | 2 - ROMFS/.gitignore | 1 - ROMFS/Makefile | 120 ------------------ ROMFS/{ => px4fmu_default}/logging/logconv.m | 0 .../{ => px4fmu_default}/mixers/FMU_AERT.mix | 0 ROMFS/{ => px4fmu_default}/mixers/FMU_AET.mix | 0 ROMFS/{ => px4fmu_default}/mixers/FMU_Q.mix | 0 ROMFS/{ => px4fmu_default}/mixers/FMU_RET.mix | 0 ROMFS/{ => px4fmu_default}/mixers/FMU_X5.mix | 0 ROMFS/px4fmu_default/mixers/FMU_delta.mix | 50 ++++++++ .../{ => px4fmu_default}/mixers/FMU_hex_+.mix | 0 .../{ => px4fmu_default}/mixers/FMU_hex_x.mix | 0 .../mixers/FMU_octo_+.mix | 0 .../mixers/FMU_octo_x.mix | 0 .../{ => px4fmu_default}/mixers/FMU_pass.mix | 0 .../mixers/FMU_quad_+.mix | 0 .../mixers/FMU_quad_x.mix | 0 ROMFS/{ => px4fmu_default}/mixers/README | 0 ROMFS/scripts/rc.FMU_quad_x | 67 ---------- ROMFS/scripts/rc.PX4IO | 80 ------------ ROMFS/scripts/rc.PX4IOAR | 98 -------------- ROMFS/scripts/rc.boarddetect | 66 ---------- ROMFS/scripts/rc.jig | 10 -- ROMFS/scripts/rc.logging | 9 -- ROMFS/scripts/rc.sensors | 34 ----- ROMFS/scripts/rc.standalone | 13 -- ROMFS/scripts/rcS | 79 ------------ makefiles/config_px4fmu_default.mk | 1 + makefiles/firmware.mk | 58 ++++++++- makefiles/upload.mk | 2 +- 30 files changed, 109 insertions(+), 581 deletions(-) delete mode 100644 ROMFS/.gitignore delete mode 100644 ROMFS/Makefile rename ROMFS/{ => px4fmu_default}/logging/logconv.m (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_AERT.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_AET.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_Q.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_RET.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_X5.mix (100%) create mode 100644 ROMFS/px4fmu_default/mixers/FMU_delta.mix rename ROMFS/{ => px4fmu_default}/mixers/FMU_hex_+.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_hex_x.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_octo_+.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_octo_x.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_pass.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_quad_+.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/FMU_quad_x.mix (100%) rename ROMFS/{ => px4fmu_default}/mixers/README (100%) delete mode 100644 ROMFS/scripts/rc.FMU_quad_x delete mode 100644 ROMFS/scripts/rc.PX4IO delete mode 100644 ROMFS/scripts/rc.PX4IOAR delete mode 100644 ROMFS/scripts/rc.boarddetect delete mode 100644 ROMFS/scripts/rc.jig delete mode 100644 ROMFS/scripts/rc.logging delete mode 100644 ROMFS/scripts/rc.sensors delete mode 100644 ROMFS/scripts/rc.standalone delete mode 100755 ROMFS/scripts/rcS diff --git a/Makefile b/Makefile index 4d42831f4f..b5a66e59a2 100644 --- a/Makefile +++ b/Makefile @@ -103,8 +103,6 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(configuration)) - @echo Generating ROMFS for $(platform) XXX move this! - $(Q) make -C $(ROMFS_SRC) all @echo %% Exporting NuttX for $(platform) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export $(Q) mkdir -p $(dir $@) diff --git a/ROMFS/.gitignore b/ROMFS/.gitignore deleted file mode 100644 index 30d3d7fe50..0000000000 --- a/ROMFS/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/img diff --git a/ROMFS/Makefile b/ROMFS/Makefile deleted file mode 100644 index d827fa4915..0000000000 --- a/ROMFS/Makefile +++ /dev/null @@ -1,120 +0,0 @@ -# -# Makefile to generate a PX4FMU ROMFS image. -# -# In normal use, 'make install' will generate a new ROMFS header and place it -# into the px4fmu configuration in the appropriate location. -# - -# -# Directories of interest -# -SRCROOT ?= $(dir $(lastword $(MAKEFILE_LIST))) -BUILDROOT ?= $(SRCROOT)/img -ROMFS_HEADER ?= $(SRCROOT)/../nuttx/configs/px4fmu/include/nsh_romfsimg.h - -# -# List of files to install in the ROMFS, specified as ~ -# -ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ - $(SRCROOT)/scripts/rc.sensors~init.d/rc.sensors \ - $(SRCROOT)/scripts/rc.logging~init.d/rc.logging \ - $(SRCROOT)/scripts/rc.standalone~init.d/rc.standalone \ - $(SRCROOT)/scripts/rc.PX4IO~init.d/rc.PX4IO \ - $(SRCROOT)/scripts/rc.PX4IOAR~init.d/rc.PX4IOAR \ - $(SRCROOT)/scripts/rc.FMU_quad_x~init.d/rc.FMU_quad_x \ - $(SRCROOT)/mixers/FMU_pass.mix~mixers/FMU_pass.mix \ - $(SRCROOT)/mixers/FMU_Q.mix~mixers/FMU_Q.mix \ - $(SRCROOT)/mixers/FMU_X5.mix~mixers/FMU_X5.mix \ - $(SRCROOT)/mixers/FMU_AERT.mix~mixers/FMU_AERT.mix \ - $(SRCROOT)/mixers/FMU_AET.mix~mixers/FMU_AET.mix \ - $(SRCROOT)/mixers/FMU_RET.mix~mixers/FMU_ERT.mix \ - $(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \ - $(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \ - $(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \ - $(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \ - $(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \ - $(SRCROOT)/mixers/FMU_octo_+.mix~mixers/FMU_octo_+.mix \ - $(SRCROOT)/logging/logconv.m~logging/logconv.m - -# the EXTERNAL_SCRIPTS variable is used to add out of tree scripts -# to ROMFS. -ROMFS_FSSPEC += $(EXTERNAL_SCRIPTS) - -# -# Add the PX4IO firmware to the spec if someone has dropped it into the -# source directory, or otherwise specified its location. -# -# Normally this is only something you'd do when working on PX4IO; most -# users will upgrade with firmware off the microSD card. -# -PX4IO_FIRMWARE ?= $(SRCROOT)/px4io.bin -ifneq ($(wildcard $(PX4IO_FIRMWARE)),) -ROMFS_FSSPEC += $(PX4IO_FIRMWARE)~px4io.bin -endif - -################################################################################ -# No user-serviceable parts below -################################################################################ - -# -# Just the source files from the ROMFS spec, so that we can fail cleanly if they don't -# exist -# -ROMFS_SRCFILES = $(foreach spec,$(ROMFS_FSSPEC),$(firstword $(subst ~, ,$(spec)))) - -# -# Just the destination directories from the ROMFS spec -# -ROMFS_DIRS = $(sort $(dir $(foreach spec,$(ROMFS_FSSPEC),$(lastword $(subst ~, ,$(spec)))))) - - -# -# Intermediate products -# -ROMFS_IMG = $(BUILDROOT)/romfs.img -ROMFS_WORKDIR = $(BUILDROOT)/romfs - -# -# Convenience target for rebuilding the ROMFS header -# -all: $(ROMFS_HEADER) - -$(ROMFS_HEADER): $(ROMFS_IMG) $(dir $(ROMFS_HEADER)) - @echo Generating the ROMFS header... - @(cd $(dir $(ROMFS_IMG)) && xxd -i $(notdir $(ROMFS_IMG))) > $@ - -$(ROMFS_IMG): $(ROMFS_WORKDIR) - @echo Generating the ROMFS image... - @genromfs -f $@ -d $(ROMFS_WORKDIR) -V "NSHInitVol" - -$(ROMFS_WORKDIR): $(ROMFS_SRCFILES) - @echo Rebuilding the ROMFS work area... - @rm -rf $(ROMFS_WORKDIR) - @mkdir -p $(ROMFS_WORKDIR) - @for dir in $(ROMFS_DIRS) ; do mkdir -p $(ROMFS_WORKDIR)/$$dir; done - @for spec in $(ROMFS_FSSPEC) ; do \ - echo $$spec | sed -e 's%^.*~% %' ;\ - `echo "cp $$spec" | sed -e 's%~% $(ROMFS_WORKDIR)/%'` ;\ - done - -$(BUILDROOT): - @mkdir -p $(BUILDROOT) - -clean: - @rm -rf $(BUILDROOT) - -distclean: clean - @rm -f $(PX4IO_FIRMWARE) $(ROMFS_HEADER) - -.PHONY: all install clean distclean - -# -# Hacks and fixups -# -SYSTYPE = $(shell uname) - -ifeq ($(SYSTYPE),Darwin) -# PATH inherited by Eclipse may not include toolchain install location -export PATH := $(PATH):/usr/local/bin -endif - diff --git a/ROMFS/logging/logconv.m b/ROMFS/px4fmu_default/logging/logconv.m similarity index 100% rename from ROMFS/logging/logconv.m rename to ROMFS/px4fmu_default/logging/logconv.m diff --git a/ROMFS/mixers/FMU_AERT.mix b/ROMFS/px4fmu_default/mixers/FMU_AERT.mix similarity index 100% rename from ROMFS/mixers/FMU_AERT.mix rename to ROMFS/px4fmu_default/mixers/FMU_AERT.mix diff --git a/ROMFS/mixers/FMU_AET.mix b/ROMFS/px4fmu_default/mixers/FMU_AET.mix similarity index 100% rename from ROMFS/mixers/FMU_AET.mix rename to ROMFS/px4fmu_default/mixers/FMU_AET.mix diff --git a/ROMFS/mixers/FMU_Q.mix b/ROMFS/px4fmu_default/mixers/FMU_Q.mix similarity index 100% rename from ROMFS/mixers/FMU_Q.mix rename to ROMFS/px4fmu_default/mixers/FMU_Q.mix diff --git a/ROMFS/mixers/FMU_RET.mix b/ROMFS/px4fmu_default/mixers/FMU_RET.mix similarity index 100% rename from ROMFS/mixers/FMU_RET.mix rename to ROMFS/px4fmu_default/mixers/FMU_RET.mix diff --git a/ROMFS/mixers/FMU_X5.mix b/ROMFS/px4fmu_default/mixers/FMU_X5.mix similarity index 100% rename from ROMFS/mixers/FMU_X5.mix rename to ROMFS/px4fmu_default/mixers/FMU_X5.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_delta.mix b/ROMFS/px4fmu_default/mixers/FMU_delta.mix new file mode 100644 index 0000000000..9814667041 --- /dev/null +++ b/ROMFS/px4fmu_default/mixers/FMU_delta.mix @@ -0,0 +1,50 @@ +Delta-wing mixer for PX4FMU +=========================== + +This file defines mixers suitable for controlling a delta wing aircraft using +PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU +servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is +assumed to be unused. + +Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0 +(roll), 1 (pitch) and 3 (thrust). + +See the README for more information on the scaler format. + +Elevon mixers +------------- +Three scalers total (output, roll, pitch). + +On the assumption that the two elevon servos are physically reversed, the pitch +input is inverted between the two servos. + +The scaling factor for roll inputs is adjusted to implement differential travel +for the elevons. + +M: 2 +O: 10000 10000 0 -10000 10000 +S: 0 0 3000 5000 0 -10000 10000 +S: 0 1 5000 5000 0 -10000 10000 + +M: 2 +O: 10000 10000 0 -10000 10000 +S: 0 0 5000 3000 0 -10000 10000 +S: 0 1 -5000 -5000 0 -10000 10000 + +Output 2 +-------- +This mixer is empty. + +Z: + +Motor speed mixer +----------------- +Two scalers total (output, thrust). + +This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1) +range. Inputs below zero are treated as zero. + +M: 1 +O: 10000 10000 0 -10000 10000 +S: 0 3 0 20000 -10000 -10000 10000 + diff --git a/ROMFS/mixers/FMU_hex_+.mix b/ROMFS/px4fmu_default/mixers/FMU_hex_+.mix similarity index 100% rename from ROMFS/mixers/FMU_hex_+.mix rename to ROMFS/px4fmu_default/mixers/FMU_hex_+.mix diff --git a/ROMFS/mixers/FMU_hex_x.mix b/ROMFS/px4fmu_default/mixers/FMU_hex_x.mix similarity index 100% rename from ROMFS/mixers/FMU_hex_x.mix rename to ROMFS/px4fmu_default/mixers/FMU_hex_x.mix diff --git a/ROMFS/mixers/FMU_octo_+.mix b/ROMFS/px4fmu_default/mixers/FMU_octo_+.mix similarity index 100% rename from ROMFS/mixers/FMU_octo_+.mix rename to ROMFS/px4fmu_default/mixers/FMU_octo_+.mix diff --git a/ROMFS/mixers/FMU_octo_x.mix b/ROMFS/px4fmu_default/mixers/FMU_octo_x.mix similarity index 100% rename from ROMFS/mixers/FMU_octo_x.mix rename to ROMFS/px4fmu_default/mixers/FMU_octo_x.mix diff --git a/ROMFS/mixers/FMU_pass.mix b/ROMFS/px4fmu_default/mixers/FMU_pass.mix similarity index 100% rename from ROMFS/mixers/FMU_pass.mix rename to ROMFS/px4fmu_default/mixers/FMU_pass.mix diff --git a/ROMFS/mixers/FMU_quad_+.mix b/ROMFS/px4fmu_default/mixers/FMU_quad_+.mix similarity index 100% rename from ROMFS/mixers/FMU_quad_+.mix rename to ROMFS/px4fmu_default/mixers/FMU_quad_+.mix diff --git a/ROMFS/mixers/FMU_quad_x.mix b/ROMFS/px4fmu_default/mixers/FMU_quad_x.mix similarity index 100% rename from ROMFS/mixers/FMU_quad_x.mix rename to ROMFS/px4fmu_default/mixers/FMU_quad_x.mix diff --git a/ROMFS/mixers/README b/ROMFS/px4fmu_default/mixers/README similarity index 100% rename from ROMFS/mixers/README rename to ROMFS/px4fmu_default/mixers/README diff --git a/ROMFS/scripts/rc.FMU_quad_x b/ROMFS/scripts/rc.FMU_quad_x deleted file mode 100644 index 8787443ea2..0000000000 --- a/ROMFS/scripts/rc.FMU_quad_x +++ /dev/null @@ -1,67 +0,0 @@ -#!nsh -# -# Flight startup script for PX4FMU with PWM outputs. -# - -# Disable the USB interface -set USB no - -# Disable autostarting other apps -set MODE custom - -echo "[init] doing PX4FMU Quad startup..." - -# -# Start the ORB -# -uorb start - -# -# Load microSD params -# -echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] -then - param load /fs/microsd/parameters -fi - -# -# Force some key parameters to sane values -# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor -# see https://pixhawk.ethz.ch/mavlink/ -# -param set MAV_TYPE 2 - -# -# Start MAVLink -# -mavlink start -d /dev/ttyS0 -b 57600 -usleep 5000 - -# -# Start the sensors and test them. -# -sh /etc/init.d/rc.sensors - -# -# Start the commander. -# -commander start - -# -# Start the attitude estimator -# -attitude_estimator_ekf start - -echo "[init] starting PWM output" -fmu mode_pwm -mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix - -# -# Start attitude control -# -multirotor_att_control start - -echo "[init] startup done, exiting" -exit \ No newline at end of file diff --git a/ROMFS/scripts/rc.PX4IO b/ROMFS/scripts/rc.PX4IO deleted file mode 100644 index 1e3963b9ad..0000000000 --- a/ROMFS/scripts/rc.PX4IO +++ /dev/null @@ -1,80 +0,0 @@ -#!nsh - -# Disable USB and autostart -set USB no -set MODE camflyer - -# -# Start the ORB -# -uorb start - -# -# Load microSD params -# -echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] -then - param load /fs/microsd/parameters -fi - -# -# Force some key parameters to sane values -# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor -# see https://pixhawk.ethz.ch/mavlink/ -# -param set MAV_TYPE 1 - -# -# Start the sensors. -# -sh /etc/init.d/rc.sensors - -# -# Start MAVLink -# -mavlink start -d /dev/ttyS1 -b 57600 -usleep 5000 - -# -# Start the commander. -# -commander start - -# -# Start GPS interface -# -gps start - -# -# Start the attitude estimator -# -kalman_demo start - -# -# Start PX4IO interface -# -px4io start - -# -# Load mixer and start controllers -# -mixer load /dev/pwm_output /etc/mixers/FMU_Q.mix -control_demo start - -# -# Start logging -# -sdlog start -s 10 - -# -# Start system state -# -if blinkm start -then - echo "using BlinkM for state indication" - blinkm systemstate -else - echo "no BlinkM found, OK." -fi diff --git a/ROMFS/scripts/rc.PX4IOAR b/ROMFS/scripts/rc.PX4IOAR deleted file mode 100644 index 72df68e350..0000000000 --- a/ROMFS/scripts/rc.PX4IOAR +++ /dev/null @@ -1,98 +0,0 @@ -#!nsh -# -# Flight startup script for PX4FMU on PX4IOAR carrier board. -# - -# Disable the USB interface -set USB no - -# Disable autostarting other apps -set MODE ardrone - -echo "[init] doing PX4IOAR startup..." - -# -# Start the ORB -# -uorb start - -# -# Init the parameter storage -# -echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] -then - param load /fs/microsd/parameters -fi - -# -# Force some key parameters to sane values -# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor -# see https://pixhawk.ethz.ch/mavlink/ -# -param set MAV_TYPE 2 - -# -# Start the sensors. -# -sh /etc/init.d/rc.sensors - -# -# Start MAVLink -# -mavlink start -d /dev/ttyS0 -b 57600 -usleep 5000 - -# -# Start the commander. -# -commander start - -# -# Start the attitude estimator -# -attitude_estimator_ekf start - -# -# Configure PX4FMU for operation with PX4IOAR -# -fmu mode_gpio_serial - -# -# Fire up the multi rotor attitude controller -# -multirotor_att_control start - -# -# Fire up the AR.Drone interface. -# -ardrone_interface start -d /dev/ttyS1 - -# -# Start GPS capture -# -gps start - -# -# Start logging -# -sdlog start -s 10 - -# -# Start system state -# -if blinkm start -then - echo "using BlinkM for state indication" - blinkm systemstate -else - echo "no BlinkM found, OK." -fi - -# -# startup is done; we don't want the shell because we -# use the same UART for telemetry -# -echo "[init] startup done" -exit \ No newline at end of file diff --git a/ROMFS/scripts/rc.boarddetect b/ROMFS/scripts/rc.boarddetect deleted file mode 100644 index f233e51df4..0000000000 --- a/ROMFS/scripts/rc.boarddetect +++ /dev/null @@ -1,66 +0,0 @@ -#!nsh -# -# If we are still in flight mode, work out what airframe -# configuration we have and start up accordingly. -# -if [ $MODE != autostart ] -then - echo "[init] automatic startup cancelled by user script" -else - echo "[init] detecting attached hardware..." - - # - # Assume that we are PX4FMU in standalone mode - # - set BOARD PX4FMU - - # - # Are we attached to a PX4IOAR (AR.Drone carrier board)? - # - if boardinfo test name PX4IOAR - then - set BOARD PX4IOAR - if [ -f /etc/init.d/rc.PX4IOAR ] - then - echo "[init] reading /etc/init.d/rc.PX4IOAR" - usleep 500 - sh /etc/init.d/rc.PX4IOAR - fi - else - echo "[init] PX4IOAR not detected" - fi - - # - # Are we attached to a PX4IO? - # - if boardinfo test name PX4IO - then - set BOARD PX4IO - if [ -f /etc/init.d/rc.PX4IO ] - then - echo "[init] reading /etc/init.d/rc.PX4IO" - usleep 500 - sh /etc/init.d/rc.PX4IO - fi - else - echo "[init] PX4IO not detected" - fi - - # - # Looks like we are stand-alone - # - if [ $BOARD == PX4FMU ] - then - echo "[init] no expansion board detected" - if [ -f /etc/init.d/rc.standalone ] - then - echo "[init] reading /etc/init.d/rc.standalone" - sh /etc/init.d/rc.standalone - fi - fi - - # - # We may not reach here if the airframe-specific script exits the shell. - # - echo "[init] startup done." -fi \ No newline at end of file diff --git a/ROMFS/scripts/rc.jig b/ROMFS/scripts/rc.jig deleted file mode 100644 index e2b5d8f30d..0000000000 --- a/ROMFS/scripts/rc.jig +++ /dev/null @@ -1,10 +0,0 @@ -#!nsh -# -# Test jig startup script -# - -echo "[testing] doing production test.." - -tests jig - -echo "[testing] testing done" diff --git a/ROMFS/scripts/rc.logging b/ROMFS/scripts/rc.logging deleted file mode 100644 index 09c2d00d19..0000000000 --- a/ROMFS/scripts/rc.logging +++ /dev/null @@ -1,9 +0,0 @@ -#!nsh -# -# Initialise logging services. -# - -if [ -d /fs/microsd ] -then - sdlog start -fi diff --git a/ROMFS/scripts/rc.sensors b/ROMFS/scripts/rc.sensors deleted file mode 100644 index 42c2f52e94..0000000000 --- a/ROMFS/scripts/rc.sensors +++ /dev/null @@ -1,34 +0,0 @@ -#!nsh -# -# Standard startup script for PX4FMU onboard sensor drivers. -# - -# -# Start sensor drivers here. -# - -ms5611 start -adc start - -if mpu6000 start -then - echo "using MPU6000 and HMC5883L" - hmc5883 start -else - echo "using L3GD20 and LSM303D" - l3gd20 start - lsm303 start -fi - -# -# Start the sensor collection task. -# IMPORTANT: this also loads param offsets -# ALWAYS start this task before the -# preflight_check. -# -sensors start - -# -# Check sensors - run AFTER 'sensors start' -# -preflight_check \ No newline at end of file diff --git a/ROMFS/scripts/rc.standalone b/ROMFS/scripts/rc.standalone deleted file mode 100644 index 67e95215b9..0000000000 --- a/ROMFS/scripts/rc.standalone +++ /dev/null @@ -1,13 +0,0 @@ -#!nsh -# -# Flight startup script for PX4FMU standalone configuration. -# - -echo "[init] doing standalone PX4FMU startup..." - -# -# Start the ORB -# -uorb start - -echo "[init] startup done" diff --git a/ROMFS/scripts/rcS b/ROMFS/scripts/rcS deleted file mode 100755 index 89a7678797..0000000000 --- a/ROMFS/scripts/rcS +++ /dev/null @@ -1,79 +0,0 @@ -#!nsh -# -# PX4FMU 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 - -# -# Start playing the startup tune -# -tone_alarm start - -# -# 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" -else - echo "[init] no microSD card found" -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 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 ] -then - echo Running rc.APM - # if APM startup is successful then nsh will exit - sh /etc/init.d/rc.APM -fi diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 45b1170ff0..e0c1aff9dc 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -4,5 +4,6 @@ CONFIG = px4fmu_default SRCS = $(PX4_BASE)/platforms/empty.c +ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) include $(PX4_BASE)/makefiles/firmware.mk diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 338bda8d3f..d64d39ea42 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -23,6 +23,11 @@ # to the directory 'build' under the directory containing the # parent Makefile. # +# ROMFS_ROOT: +# If set to the path to a directory, a ROMFS image will be generated +# containing the files under the directory and linked into the final +# image. +# ################################################################################ # Paths and configuration @@ -71,6 +76,7 @@ MKFW = $(PX4_BASE)/Tools/px_mkfw.py COPY = cp REMOVE = rm -f RMDIR = rm -rf +GENROMFS = genromfs # # Sanity-check the PLATFORM variable and then get the platform config. @@ -134,6 +140,29 @@ LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs LIBS += -lapps -lnuttx LINK_DEPS += $(wildcard $(addsuffix /*.a,$(LIB_DIRS))) +################################################################################ +# ROMFS generation +################################################################################ + +# +# Note that we can't just put romfs.c in SRCS, as it's depended on by the +# NuttX export library. Instead, we have to treat it like a library. +# +ifneq ($(ROMFS_ROOT),) +ROMFS_DEPS += $(wildcard \ + (ROMFS_ROOT)/* \ + (ROMFS_ROOT)/*/* \ + (ROMFS_ROOT)/*/*/* \ + (ROMFS_ROOT)/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/*/*) +ROMFS_IMG = $(WORK_DIR)/romfs.img +ROMFS_CSRC = $(ROMFS_IMG:.img=.c) +ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) +LIBS += $(ROMFS_OBJ) +LINK_DEPS += $(ROMFS_OBJ) +endif + ################################################################################ # Build rules ################################################################################ @@ -159,7 +188,7 @@ all: $(PRODUCT_BUNDLE) OBJS = $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) # -# Rules +# SRCS -> OBJS rules # $(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c $(GLOBAL_DEPS) @@ -174,11 +203,19 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call ASSEMBLE,$<,$@) +# +# Build directory setup rules +# + $(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) @echo %% Unpacking $(NUTTX_ARCHIVE) $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) $(Q) touch $@ +# +# Built product rules +# + $(PRODUCT_BUNDLE): $(PRODUCT_BIN) @echo %% Generating $@ $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(PLATFORM).prototype \ @@ -191,6 +228,25 @@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(call LINK,$@,$(OBJS)) +# +# ROMFS rules +# + +$(ROMFS_OBJ): $(ROMFS_CSRC) + $(call COMPILE,$<,$@) + +$(ROMFS_CSRC): $(ROMFS_IMG) + @echo %% generating $@ + $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ + +$(ROMFS_IMG): $(ROMFS_DEPS) + @echo %% generating $@ + $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" + +# +# Utility rules +# + upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(Q) make -f $(PX4_MK_INCLUDE)/upload.mk \ METHOD=serial \ diff --git a/makefiles/upload.mk b/makefiles/upload.mk index 15e0e240aa..5308aaa3ee 100644 --- a/makefiles/upload.mk +++ b/makefiles/upload.mk @@ -1,5 +1,5 @@ # -# Rules and tools for uploading firmware. +# Rules and tools for uploading firmware to various PX4 boards. # UPLOADER = $(PX4_BASE)/Tools/px_uploader.py From c3ed120d01740c61a2cafc67e597389aa0c4b674 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 30 Jan 2013 16:16:12 -0800 Subject: [PATCH 013/129] Back out deletion of the /etc/init.d scripts; we need these. --- ROMFS/scripts/rc.FMU_quad_x | 40 +++++++++++ ROMFS/scripts/rc.PX4IO | 73 +++++++++++++++++++ ROMFS/scripts/rc.PX4IOAR | 80 +++++++++++++++++++++ ROMFS/scripts/rc.jig | 10 +++ ROMFS/scripts/rc.logging | 9 +++ ROMFS/scripts/rc.sensors | 34 +++++++++ ROMFS/scripts/rc.standalone | 13 ++++ ROMFS/scripts/rcS | 136 ++++++++++++++++++++++++++++++++++++ 8 files changed, 395 insertions(+) create mode 100644 ROMFS/scripts/rc.FMU_quad_x create mode 100644 ROMFS/scripts/rc.PX4IO create mode 100644 ROMFS/scripts/rc.PX4IOAR create mode 100644 ROMFS/scripts/rc.jig create mode 100644 ROMFS/scripts/rc.logging create mode 100644 ROMFS/scripts/rc.sensors create mode 100644 ROMFS/scripts/rc.standalone create mode 100755 ROMFS/scripts/rcS diff --git a/ROMFS/scripts/rc.FMU_quad_x b/ROMFS/scripts/rc.FMU_quad_x new file mode 100644 index 0000000000..d9c9a8457f --- /dev/null +++ b/ROMFS/scripts/rc.FMU_quad_x @@ -0,0 +1,40 @@ +# +# Startup for X-quad on FMU1.5/1.6 +# + +echo "[init] uORB" +uorb start + +echo "[init] eeprom" +eeprom start +if [ -f /eeprom/parameters ] +then + param load +fi + +echo "[init] sensors" +#bma180 start +#l3gd20 start +mpu6000 start +hmc5883 start +ms5611 start + +sensors start + +echo "[init] mavlink" +mavlink start -d /dev/ttyS0 -b 57600 +usleep 5000 + +echo "[init] commander" +commander start + +echo "[init] attitude control" +attitude_estimator_ekf start +multirotor_att_control start + +echo "[init] starting PWM output" +fmu mode_pwm +mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix + +echo "[init] startup done, exiting" +exit diff --git a/ROMFS/scripts/rc.PX4IO b/ROMFS/scripts/rc.PX4IO new file mode 100644 index 0000000000..84e181a5ae --- /dev/null +++ b/ROMFS/scripts/rc.PX4IO @@ -0,0 +1,73 @@ +#!nsh + +set USB no + +# +# Start the object request broker +# +uorb start + +# +# Init the EEPROM +# +echo "[init] eeprom" +eeprom start +if [ -f /eeprom/parameters ] +then + param load +fi + +# +# Enable / connect to PX4IO +# +px4io start + +# +# Load an appropriate mixer. FMU_pass.mix is a passthru mixer +# which is good for testing. See ROMFS/mixers for a full list of mixers. +# +mixer load /dev/pwm_output /etc/mixers/FMU_pass.mix + +# +# Start the sensors. +# +sh /etc/init.d/rc.sensors + +# +# Start MAVLink on UART1 (dev/ttyS0) at 57600 baud (CLI is now unusable) +# +mavlink start -d /dev/ttyS0 -b 57600 +usleep 5000 + +# +# Start the commander. +# +commander start + +# +# Start the attitude estimator +# +attitude_estimator_ekf start + +# +# Start the attitude and position controller +# +fixedwing_att_control start +fixedwing_pos_control start + +# +# Start GPS capture. Comment this out if you do not have a GPS. +# +gps start + +# +# Start logging to microSD if we can +# +sh /etc/init.d/rc.logging + +# +# startup is done; we don't want the shell because we +# use the same UART for telemetry +# +echo "[init] startup done" +exit diff --git a/ROMFS/scripts/rc.PX4IOAR b/ROMFS/scripts/rc.PX4IOAR new file mode 100644 index 0000000000..640cdf5411 --- /dev/null +++ b/ROMFS/scripts/rc.PX4IOAR @@ -0,0 +1,80 @@ +#!nsh +# +# Flight startup script for PX4FMU on PX4IOAR carrier board. +# + +# Disable the USB interface +set USB no + +# Disable autostarting other apps +set MODE ardrone + +echo "[init] doing PX4IOAR startup..." + +# +# Start the ORB +# +uorb start + +# +# Load microSD params +# +echo "[init] loading microSD params" +param select /fs/microsd/parameters +if [ -f /fs/microsd/parameters ] +then + param load /fs/microsd/parameters +fi + +# +# Start MAVLink +# +mavlink start -d /dev/ttyS0 -b 57600 +usleep 5000 + +# +# Start the sensors and test them. +# +sh /etc/init.d/rc.sensors + +# +# Start the commander. +# +commander start + +# +# Start the attitude estimator +# +attitude_estimator_ekf start + +# +# Configure PX4FMU for operation with PX4IOAR +# +fmu mode_gpio_serial + +# +# Fire up the multi rotor attitude controller +# +multirotor_att_control start + +# +# Fire up the AR.Drone interface. +# +ardrone_interface start -d /dev/ttyS1 + +# +# Start logging +# +#sdlog start + +# +# Start GPS capture +# +gps start + +# +# startup is done; we don't want the shell because we +# use the same UART for telemetry +# +echo "[init] startup done" +exit \ No newline at end of file diff --git a/ROMFS/scripts/rc.jig b/ROMFS/scripts/rc.jig new file mode 100644 index 0000000000..e2b5d8f30d --- /dev/null +++ b/ROMFS/scripts/rc.jig @@ -0,0 +1,10 @@ +#!nsh +# +# Test jig startup script +# + +echo "[testing] doing production test.." + +tests jig + +echo "[testing] testing done" diff --git a/ROMFS/scripts/rc.logging b/ROMFS/scripts/rc.logging new file mode 100644 index 0000000000..09c2d00d19 --- /dev/null +++ b/ROMFS/scripts/rc.logging @@ -0,0 +1,9 @@ +#!nsh +# +# Initialise logging services. +# + +if [ -d /fs/microsd ] +then + sdlog start +fi diff --git a/ROMFS/scripts/rc.sensors b/ROMFS/scripts/rc.sensors new file mode 100644 index 0000000000..42c2f52e94 --- /dev/null +++ b/ROMFS/scripts/rc.sensors @@ -0,0 +1,34 @@ +#!nsh +# +# Standard startup script for PX4FMU onboard sensor drivers. +# + +# +# Start sensor drivers here. +# + +ms5611 start +adc start + +if mpu6000 start +then + echo "using MPU6000 and HMC5883L" + hmc5883 start +else + echo "using L3GD20 and LSM303D" + l3gd20 start + lsm303 start +fi + +# +# Start the sensor collection task. +# IMPORTANT: this also loads param offsets +# ALWAYS start this task before the +# preflight_check. +# +sensors start + +# +# Check sensors - run AFTER 'sensors start' +# +preflight_check \ No newline at end of file diff --git a/ROMFS/scripts/rc.standalone b/ROMFS/scripts/rc.standalone new file mode 100644 index 0000000000..67e95215b9 --- /dev/null +++ b/ROMFS/scripts/rc.standalone @@ -0,0 +1,13 @@ +#!nsh +# +# Flight startup script for PX4FMU standalone configuration. +# + +echo "[init] doing standalone PX4FMU startup..." + +# +# Start the ORB +# +uorb start + +echo "[init] startup done" diff --git a/ROMFS/scripts/rcS b/ROMFS/scripts/rcS new file mode 100755 index 0000000000..69d791da52 --- /dev/null +++ b/ROMFS/scripts/rcS @@ -0,0 +1,136 @@ +#!nsh +# +# PX4FMU 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 + +# +# Start playing the startup tune +# +tone_alarm start + +# +# 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" +else + echo "[init] no microSD card found" +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 we are still in flight mode, work out what airframe +# configuration we have and start up accordingly. +# +if [ $MODE != autostart ] +then + echo "[init] automatic startup cancelled by user script" +else + echo "[init] detecting attached hardware..." + + # + # Assume that we are PX4FMU in standalone mode + # + set BOARD PX4FMU + + # + # Are we attached to a PX4IOAR (AR.Drone carrier board)? + # + if boardinfo test name PX4IOAR + then + set BOARD PX4IOAR + if [ -f /etc/init.d/rc.PX4IOAR ] + then + echo "[init] reading /etc/init.d/rc.PX4IOAR" + usleep 500 + sh /etc/init.d/rc.PX4IOAR + fi + else + echo "[init] PX4IOAR not detected" + fi + + # + # Are we attached to a PX4IO? + # + if boardinfo test name PX4IO + then + set BOARD PX4IO + if [ -f /etc/init.d/rc.PX4IO ] + then + echo "[init] reading /etc/init.d/rc.PX4IO" + usleep 500 + sh /etc/init.d/rc.PX4IO + fi + else + echo "[init] PX4IO not detected" + fi + + # + # Looks like we are stand-alone + # + if [ $BOARD == PX4FMU ] + then + echo "[init] no expansion board detected" + if [ -f /etc/init.d/rc.standalone ] + then + echo "[init] reading /etc/init.d/rc.standalone" + sh /etc/init.d/rc.standalone + fi + fi + + # + # We may not reach here if the airframe-specific script exits the shell. + # + echo "[init] startup done." +fi From eece05a287e48754a424d2a824a2ace3a5a89d51 Mon Sep 17 00:00:00 2001 From: px4dev Date: Thu, 31 Jan 2013 23:18:17 -0800 Subject: [PATCH 014/129] We need a stub ROMFS header so that the client can supply their own bits. --- .gitignore | 1 - nuttx/configs/px4fmu/include/nsh_romfsimg.h | 42 +++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 nuttx/configs/px4fmu/include/nsh_romfsimg.h diff --git a/.gitignore b/.gitignore index 69edb0dce7..46b347f72e 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,6 @@ nuttx/nuttx.hex .settings Firmware.sublime-workspace .DS_Store -nsh_romfsimg.h cscope.out .configX-e nuttx-export.zip diff --git a/nuttx/configs/px4fmu/include/nsh_romfsimg.h b/nuttx/configs/px4fmu/include/nsh_romfsimg.h new file mode 100644 index 0000000000..15e4e7a8d5 --- /dev/null +++ b/nuttx/configs/px4fmu/include/nsh_romfsimg.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * nsh_romfsetc.h + * + * This file is a stub for 'make export' purposes; the actual ROMFS + * must be supplied by the library client. + */ + +extern unsigned char romfs_img[]; +extern unsigned int romfs_img_len; From d3a6f448c93aaf6d611f1aa3d3af60788eb0ff7a Mon Sep 17 00:00:00 2001 From: px4dev Date: Tue, 19 Feb 2013 21:45:17 -0800 Subject: [PATCH 015/129] Git zombies must die. --- ROMFS/scripts/rc.FMU_quad_x | 40 ----------- ROMFS/scripts/rc.PX4IO | 73 ------------------- ROMFS/scripts/rc.PX4IOAR | 80 --------------------- ROMFS/scripts/rc.jig | 10 --- ROMFS/scripts/rc.logging | 9 --- ROMFS/scripts/rc.sensors | 34 --------- ROMFS/scripts/rc.standalone | 13 ---- ROMFS/scripts/rcS | 136 ------------------------------------ 8 files changed, 395 deletions(-) delete mode 100644 ROMFS/scripts/rc.FMU_quad_x delete mode 100644 ROMFS/scripts/rc.PX4IO delete mode 100644 ROMFS/scripts/rc.PX4IOAR delete mode 100644 ROMFS/scripts/rc.jig delete mode 100644 ROMFS/scripts/rc.logging delete mode 100644 ROMFS/scripts/rc.sensors delete mode 100644 ROMFS/scripts/rc.standalone delete mode 100755 ROMFS/scripts/rcS diff --git a/ROMFS/scripts/rc.FMU_quad_x b/ROMFS/scripts/rc.FMU_quad_x deleted file mode 100644 index d9c9a8457f..0000000000 --- a/ROMFS/scripts/rc.FMU_quad_x +++ /dev/null @@ -1,40 +0,0 @@ -# -# Startup for X-quad on FMU1.5/1.6 -# - -echo "[init] uORB" -uorb start - -echo "[init] eeprom" -eeprom start -if [ -f /eeprom/parameters ] -then - param load -fi - -echo "[init] sensors" -#bma180 start -#l3gd20 start -mpu6000 start -hmc5883 start -ms5611 start - -sensors start - -echo "[init] mavlink" -mavlink start -d /dev/ttyS0 -b 57600 -usleep 5000 - -echo "[init] commander" -commander start - -echo "[init] attitude control" -attitude_estimator_ekf start -multirotor_att_control start - -echo "[init] starting PWM output" -fmu mode_pwm -mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix - -echo "[init] startup done, exiting" -exit diff --git a/ROMFS/scripts/rc.PX4IO b/ROMFS/scripts/rc.PX4IO deleted file mode 100644 index 84e181a5ae..0000000000 --- a/ROMFS/scripts/rc.PX4IO +++ /dev/null @@ -1,73 +0,0 @@ -#!nsh - -set USB no - -# -# Start the object request broker -# -uorb start - -# -# Init the EEPROM -# -echo "[init] eeprom" -eeprom start -if [ -f /eeprom/parameters ] -then - param load -fi - -# -# Enable / connect to PX4IO -# -px4io start - -# -# Load an appropriate mixer. FMU_pass.mix is a passthru mixer -# which is good for testing. See ROMFS/mixers for a full list of mixers. -# -mixer load /dev/pwm_output /etc/mixers/FMU_pass.mix - -# -# Start the sensors. -# -sh /etc/init.d/rc.sensors - -# -# Start MAVLink on UART1 (dev/ttyS0) at 57600 baud (CLI is now unusable) -# -mavlink start -d /dev/ttyS0 -b 57600 -usleep 5000 - -# -# Start the commander. -# -commander start - -# -# Start the attitude estimator -# -attitude_estimator_ekf start - -# -# Start the attitude and position controller -# -fixedwing_att_control start -fixedwing_pos_control start - -# -# Start GPS capture. Comment this out if you do not have a GPS. -# -gps start - -# -# Start logging to microSD if we can -# -sh /etc/init.d/rc.logging - -# -# startup is done; we don't want the shell because we -# use the same UART for telemetry -# -echo "[init] startup done" -exit diff --git a/ROMFS/scripts/rc.PX4IOAR b/ROMFS/scripts/rc.PX4IOAR deleted file mode 100644 index 640cdf5411..0000000000 --- a/ROMFS/scripts/rc.PX4IOAR +++ /dev/null @@ -1,80 +0,0 @@ -#!nsh -# -# Flight startup script for PX4FMU on PX4IOAR carrier board. -# - -# Disable the USB interface -set USB no - -# Disable autostarting other apps -set MODE ardrone - -echo "[init] doing PX4IOAR startup..." - -# -# Start the ORB -# -uorb start - -# -# Load microSD params -# -echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] -then - param load /fs/microsd/parameters -fi - -# -# Start MAVLink -# -mavlink start -d /dev/ttyS0 -b 57600 -usleep 5000 - -# -# Start the sensors and test them. -# -sh /etc/init.d/rc.sensors - -# -# Start the commander. -# -commander start - -# -# Start the attitude estimator -# -attitude_estimator_ekf start - -# -# Configure PX4FMU for operation with PX4IOAR -# -fmu mode_gpio_serial - -# -# Fire up the multi rotor attitude controller -# -multirotor_att_control start - -# -# Fire up the AR.Drone interface. -# -ardrone_interface start -d /dev/ttyS1 - -# -# Start logging -# -#sdlog start - -# -# Start GPS capture -# -gps start - -# -# startup is done; we don't want the shell because we -# use the same UART for telemetry -# -echo "[init] startup done" -exit \ No newline at end of file diff --git a/ROMFS/scripts/rc.jig b/ROMFS/scripts/rc.jig deleted file mode 100644 index e2b5d8f30d..0000000000 --- a/ROMFS/scripts/rc.jig +++ /dev/null @@ -1,10 +0,0 @@ -#!nsh -# -# Test jig startup script -# - -echo "[testing] doing production test.." - -tests jig - -echo "[testing] testing done" diff --git a/ROMFS/scripts/rc.logging b/ROMFS/scripts/rc.logging deleted file mode 100644 index 09c2d00d19..0000000000 --- a/ROMFS/scripts/rc.logging +++ /dev/null @@ -1,9 +0,0 @@ -#!nsh -# -# Initialise logging services. -# - -if [ -d /fs/microsd ] -then - sdlog start -fi diff --git a/ROMFS/scripts/rc.sensors b/ROMFS/scripts/rc.sensors deleted file mode 100644 index 42c2f52e94..0000000000 --- a/ROMFS/scripts/rc.sensors +++ /dev/null @@ -1,34 +0,0 @@ -#!nsh -# -# Standard startup script for PX4FMU onboard sensor drivers. -# - -# -# Start sensor drivers here. -# - -ms5611 start -adc start - -if mpu6000 start -then - echo "using MPU6000 and HMC5883L" - hmc5883 start -else - echo "using L3GD20 and LSM303D" - l3gd20 start - lsm303 start -fi - -# -# Start the sensor collection task. -# IMPORTANT: this also loads param offsets -# ALWAYS start this task before the -# preflight_check. -# -sensors start - -# -# Check sensors - run AFTER 'sensors start' -# -preflight_check \ No newline at end of file diff --git a/ROMFS/scripts/rc.standalone b/ROMFS/scripts/rc.standalone deleted file mode 100644 index 67e95215b9..0000000000 --- a/ROMFS/scripts/rc.standalone +++ /dev/null @@ -1,13 +0,0 @@ -#!nsh -# -# Flight startup script for PX4FMU standalone configuration. -# - -echo "[init] doing standalone PX4FMU startup..." - -# -# Start the ORB -# -uorb start - -echo "[init] startup done" diff --git a/ROMFS/scripts/rcS b/ROMFS/scripts/rcS deleted file mode 100755 index 69d791da52..0000000000 --- a/ROMFS/scripts/rcS +++ /dev/null @@ -1,136 +0,0 @@ -#!nsh -# -# PX4FMU 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 - -# -# Start playing the startup tune -# -tone_alarm start - -# -# 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" -else - echo "[init] no microSD card found" -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 we are still in flight mode, work out what airframe -# configuration we have and start up accordingly. -# -if [ $MODE != autostart ] -then - echo "[init] automatic startup cancelled by user script" -else - echo "[init] detecting attached hardware..." - - # - # Assume that we are PX4FMU in standalone mode - # - set BOARD PX4FMU - - # - # Are we attached to a PX4IOAR (AR.Drone carrier board)? - # - if boardinfo test name PX4IOAR - then - set BOARD PX4IOAR - if [ -f /etc/init.d/rc.PX4IOAR ] - then - echo "[init] reading /etc/init.d/rc.PX4IOAR" - usleep 500 - sh /etc/init.d/rc.PX4IOAR - fi - else - echo "[init] PX4IOAR not detected" - fi - - # - # Are we attached to a PX4IO? - # - if boardinfo test name PX4IO - then - set BOARD PX4IO - if [ -f /etc/init.d/rc.PX4IO ] - then - echo "[init] reading /etc/init.d/rc.PX4IO" - usleep 500 - sh /etc/init.d/rc.PX4IO - fi - else - echo "[init] PX4IO not detected" - fi - - # - # Looks like we are stand-alone - # - if [ $BOARD == PX4FMU ] - then - echo "[init] no expansion board detected" - if [ -f /etc/init.d/rc.standalone ] - then - echo "[init] reading /etc/init.d/rc.standalone" - sh /etc/init.d/rc.standalone - fi - fi - - # - # We may not reach here if the airframe-specific script exits the shell. - # - echo "[init] startup done." -fi From abe48bd7149fee4d18d709e7325cc70ca7230cb8 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 20 Feb 2013 21:12:59 -0800 Subject: [PATCH 016/129] Auto-generate builtin command prototypes. Tidy up path configuration, etc. --- Makefile | 28 +----- makefiles/firmware.mk | 147 +++++++++++++++------------- makefiles/setup.mk | 42 ++++++++ makefiles/toolchain_gnu-arm-eabi.mk | 9 +- 4 files changed, 132 insertions(+), 94 deletions(-) create mode 100644 makefiles/setup.mk diff --git a/Makefile b/Makefile index b5a66e59a2..6af1f16e21 100644 --- a/Makefile +++ b/Makefile @@ -2,27 +2,11 @@ # Top-level Makefile for building PX4 firmware images. # - # -# Some useful paths. +# Get path and tool configuration # -export PX4_BASE = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export NUTTX_SRC = $(PX4_BASE)/nuttx -export NUTTX_APPS = $(PX4_BASE)/apps -export MAVLINK_SRC = $(PX4_BASE)/mavlink -export ROMFS_SRC = $(PX4_BASE)/ROMFS -export IMAGE_DIR = $(PX4_BASE)/Images -export BUILD_DIR = $(PX4_BASE)/Build -export ARCHIVE_DIR = $(PX4_BASE)/Archives - -# -# Tools -# -MKFW = $(PX4_BASE)/Tools/px_mkfw.py -UPLOADER = $(PX4_BASE)/Tools/px_uploader.py -COPY = cp -REMOVE = rm -f -RMDIR = rm -rf +export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) +include $(PX4_BASE)/makefiles/setup.mk # # Canned firmware configurations that we build. @@ -55,7 +39,6 @@ FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware. # MQUIET = --no-print-directory #MQUIET = --print-directory -Q := $(if $(V),,@) all: $(STAGED_FIRMWARES) @@ -77,7 +60,8 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ -f $(PX4_BASE)/makefiles/config_$(config).mk \ - WORK_DIR=$(work_dir) + WORK_DIR=$(work_dir) \ + firmware # # Build the NuttX export archives. @@ -117,11 +101,9 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) clean: $(Q) $(RMDIR) $(BUILD_DIR)/*.build $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.px4 - $(Q) make -C $(ROMFS_SRC) -r $(MQUIET) clean .PHONY: distclean distclean: clean $(Q) $(REMOVE) -f $(ARCHIVE_DIR)/*.export $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) make -C $(ROMFS_SRC) -r $(MQUIET) distclean diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index d64d39ea42..574818d640 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -7,7 +7,8 @@ # Requires: # # PLATFORM -# Must be set to a platform name known to the PX4 distribution. +# Must be set to a platform name known to the PX4 distribution (as +# we need a corresponding NuttX export archive to link with). # # Optional: # @@ -43,8 +44,13 @@ export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(PX4_MK_INCLUDE)/..) +$(info %% set PX4_BASE to $(PX4_BASE)) endif -$(info %% PX4_BASE $(PX4_BASE)) + +# +# Get path and tool config +# +include $(PX4_MK_INCLUDE)/setup.mk # # If WORK_DIR is not set, create a 'build' directory next to the @@ -56,28 +62,6 @@ export WORK_DIR := $(dir $(PARENT_MAKEFILE))/build endif $(info %% WORK_DIR $(WORK_DIR)) -# -# Paths -# -export NUTTX_SRC = $(PX4_BASE)/nuttx -export NUTTX_APPS = $(PX4_BASE)/apps -export MAVLINK_SRC = $(PX4_BASE)/mavlink -export ROMFS_SRC = $(PX4_BASE)/ROMFS -export IMAGE_DIR = $(PX4_BASE)/Images -export BUILD_DIR = $(PX4_BASE)/Build -export ARCHIVE_DIR = $(PX4_BASE)/Archives - -# -# Extra tools. -# -# XXX should be in a common toolchain config somewhere. -# -MKFW = $(PX4_BASE)/Tools/px_mkfw.py -COPY = cp -REMOVE = rm -f -RMDIR = rm -rf -GENROMFS = genromfs - # # Sanity-check the PLATFORM variable and then get the platform config. # If PLATFORM is not set, but CONFIG is, use that. @@ -93,19 +77,9 @@ endif include $(PX4_MK_INCLUDE)/platform_$(PLATFORM).mk # -# Makefile debugging. +# Things that, if they change, might affect everything # -Q := $(if $(V),,@) - -# -# Host-specific paths, hacks and fixups -# -SYSTYPE := $(shell uname -s) - -ifeq ($(SYSTYPE),Darwin) -# Eclipse may not have the toolchain on its path. -export PATH := $(PATH):/usr/local/bin -endif +GLOBAL_DEPS += $(MAKEFILE_LIST) ################################################################################ # NuttX libraries and paths @@ -126,6 +100,7 @@ endif # NUTTX_EXPORT_DIR = $(WORK_DIR)/nuttx-export NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)/include/nuttx/config.h +GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) # # Use the linker script from the NuttX export @@ -140,6 +115,11 @@ LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs LIBS += -lapps -lnuttx LINK_DEPS += $(wildcard $(addsuffix /*.a,$(LIB_DIRS))) +$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) + @echo %% Unpacking $(NUTTX_ARCHIVE) + $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) touch $@ + ################################################################################ # ROMFS generation ################################################################################ @@ -161,17 +141,70 @@ ROMFS_CSRC = $(ROMFS_IMG:.img=.c) ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) LIBS += $(ROMFS_OBJ) LINK_DEPS += $(ROMFS_OBJ) + +$(ROMFS_OBJ): $(ROMFS_CSRC) + $(Q) $(call COMPILE,$<,$@) + +$(ROMFS_CSRC): $(ROMFS_IMG) + @echo %% generating $@ + $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ + +$(ROMFS_IMG): $(ROMFS_DEPS) + @echo %% generating $@ + $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" + +endif + +################################################################################ +# Builtin command list generation +################################################################################ + +# +# Note that we can't just put builtin_commands.c in SRCS, as it's depended on by the +# NuttX export library. Instead, we have to treat it like a library. +# +# XXX need to fix stack size numbers here so that apps can set them. +# +BUILTIN_CSRC = $(WORK_DIR)/builtin_commands.c + +$(BUILTIN_CSRC): $(MAKEFILE_LIST) + @echo %% generating $@ + $(Q) echo '/* builtin command list - automatically generated, do not edit */' > $@ + $(Q) echo '#include ' >> $@ + $(Q) echo '#include ' >> $@ + $(Q) $(foreach app,$(APPS),echo 'extern int $(app)_main(int argc, char *argv[]);' >> $@;) + $(Q) echo 'const struct builtin_s g_builtins[] = {' >> $@ + $(Q) $(foreach app,$(APPS),echo ' {"$(app)", SCHED_PRIORITY_DEFAULT, CONFIG_PTHREAD_STACK_DEFAULT, $(app)_main},' >> $@;) + $(Q) echo '};' >> $@ + $(Q) echo 'const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);' >> $@ + +BUILTIN_OBJ = $(BUILTIN_CSRC:.c=.o) +LIBS += $(BUILTIN_OBJ) +LINK_DEPS += $(BUILTIN_OBJ) + +$(BUILTIN_OBJ): $(BUILTIN_CSRC) $(GLOBAL_DEPS) + $(Q) $(call COMPILE,$<,$@) + +################################################################################ +# Default SRCS generation +################################################################################ + +# +# If there are no SRCS, the build will fail; in that case, generate an empty +# source file. +# +ifeq ($(SRCS),) +EMPTY_SRC = $(WORK_DIR)/empty.c +$(EMPTY_SRC): + $(Q) echo '/* this is an empty file */' > $@ + +SRCS += $(EMPTY_SRC) endif ################################################################################ # Build rules ################################################################################ -# -# Things that, if they change, might affect everything -# -GLOBAL_DEPS += $(MAKEFILE_LIST) $(NUTTX_CONFIG_HEADER) - # # What we're going to build. # @@ -180,18 +213,20 @@ PRODUCT_BIN = $(WORK_DIR)/firmware.bin PRODUCT_SYM = $(WORK_DIR)/firmware.sym .PHONY: all -all: $(PRODUCT_BUNDLE) +firmware: $(PRODUCT_BUNDLE) # # Object files we will generate from sources # -OBJS = $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) +OBJS := $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) # # SRCS -> OBJS rules # -$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c $(GLOBAL_DEPS) +$(OBJS): $(GLOBAL_DEPS) + +$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c @mkdir -p $(dir $@) $(call COMPILE,$<,$@) @@ -203,15 +238,6 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) @mkdir -p $(dir $@) $(call ASSEMBLE,$<,$@) -# -# Build directory setup rules -# - -$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) - @echo %% Unpacking $(NUTTX_ARCHIVE) - $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) - $(Q) touch $@ - # # Built product rules # @@ -228,21 +254,6 @@ $(PRODUCT_BIN): $(PRODUCT_SYM) $(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(call LINK,$@,$(OBJS)) -# -# ROMFS rules -# - -$(ROMFS_OBJ): $(ROMFS_CSRC) - $(call COMPILE,$<,$@) - -$(ROMFS_CSRC): $(ROMFS_IMG) - @echo %% generating $@ - $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ - -$(ROMFS_IMG): $(ROMFS_DEPS) - @echo %% generating $@ - $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" - # # Utility rules # diff --git a/makefiles/setup.mk b/makefiles/setup.mk new file mode 100644 index 0000000000..97893921db --- /dev/null +++ b/makefiles/setup.mk @@ -0,0 +1,42 @@ +# +# Path and tool setup +# + +# +# Some useful paths. +# +export PX4_APP_SRC = $(PX4_BASE)/src/apps +export PX4_LIB_SRC = $(PX4_BASE)/src/libs +export NUTTX_SRC = $(PX4_BASE)/nuttx +export NUTTX_APP_SRC = $(PX4_BASE)/apps +export MAVLINK_SRC = $(PX4_BASE)/mavlink +export ROMFS_SRC = $(PX4_BASE)/ROMFS +export IMAGE_DIR = $(PX4_BASE)/Images +export BUILD_DIR = $(PX4_BASE)/Build +export ARCHIVE_DIR = $(PX4_BASE)/Archives + +# +# Tools +# +MKFW = $(PX4_BASE)/Tools/px_mkfw.py +UPLOADER = $(PX4_BASE)/Tools/px_uploader.py +COPY = cp +REMOVE = rm -f +RMDIR = rm -rf +GENROMFS = genromfs + +# +# Host-specific paths, hacks and fixups +# +SYSTYPE := $(shell uname -s) + +ifeq ($(SYSTYPE),Darwin) +# Eclipse may not have the toolchain on its path. +export PATH := $(PATH):/usr/local/bin +endif + +# +# Makefile debugging. +# +Q := $(if $(V),,@) + diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 73ac30669a..364cde1c1d 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -96,7 +96,8 @@ CFLAGS = $(ARCHCFLAGS) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ $(EXTRADEFINES) \ - -fno-common + -fno-common \ + $(addprefix -I,$(INCLUDE_DIRS)) CXXFLAGS = $(ARCHCXXFLAGS) \ $(ARCHWARNINGSXX) \ @@ -105,12 +106,14 @@ CXXFLAGS = $(ARCHCXXFLAGS) \ $(ARCHXXINCLUDES) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ - $(EXTRADEFINES) + $(EXTRADEFINES) \ + $(addprefix -I,$(INCLUDE_DIRS)) CPPFLAGS = $(ARCHINCLUDES) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ - $(EXTRADEFINES) + $(EXTRADEFINES) \ + $(addprefix -I,$(INCLUDE_DIRS)) AFLAGS = $(CFLAGS) -D__ASSEMBLY__ From 50739c1843d266a7ff26c26284dfec9d77cf80f5 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 20 Feb 2013 21:25:04 -0800 Subject: [PATCH 017/129] platform -> board --- Makefile | 34 +++++++++++-------- .../{platform_px4fmu.mk => board_px4fmu.mk} | 2 +- .../{platform_px4io.mk => board_px4io.mk} | 2 +- makefiles/config_px4fmu_default.mk | 2 +- makefiles/config_px4io_default.mk | 2 +- makefiles/firmware.mk | 32 ++++++++--------- makefiles/setup.mk | 1 + 7 files changed, 40 insertions(+), 35 deletions(-) rename makefiles/{platform_px4fmu.mk => board_px4fmu.mk} (67%) rename makefiles/{platform_px4io.mk => board_px4io.mk} (67%) diff --git a/Makefile b/Makefile index 6af1f16e21..2495a363ae 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,22 @@ include $(PX4_BASE)/makefiles/setup.mk CONFIGS ?= px4fmu_default px4io_default # -# Platforms (boards) that we build NuttX export kits for. +# Boards that we build NuttX export kits for. # -PLATFORMS = px4fmu px4io +BOARDS = px4fmu px4io # -# If the user has listed a config as a target, strip it out and override CONFIGS +# Debugging +# +MQUIET = --no-print-directory +#MQUIET = --print-directory + +################################################################################ +# No user-serviceable parts below +################################################################################ + +# +# If the user has listed a config as a target, strip it out and override CONFIGS. # EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) ifneq ($(EXPLICIT_CONFIGS),) @@ -34,12 +44,6 @@ endif STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.px4) -# -# Debugging -# -MQUIET = --no-print-directory -#MQUIET = --print-directory - all: $(STAGED_FIRMWARES) # @@ -76,18 +80,18 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: # # XXX PX4IO configuration name is bad - NuttX configs should probably all be "px4" # -NUTTX_ARCHIVES = $(foreach platform,$(PLATFORMS),$(ARCHIVE_DIR)/$(platform).export) +NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)/$(board).export) .PHONY: archives archives: $(NUTTX_ARCHIVES) -$(ARCHIVE_DIR)/%.export: platform = $(notdir $(basename $@)) -$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(platform),px4io),io,nsh) +$(ARCHIVE_DIR)/%.export: board = $(notdir $(basename $@)) +$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(board),px4io),io,nsh) $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) - @echo %% Configuring NuttX for $(platform) + @echo %% Configuring NuttX for $(board) $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(configuration)) - @echo %% Exporting NuttX for $(platform) + $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(board)/$(configuration)) + @echo %% Exporting NuttX for $(board) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export $(Q) mkdir -p $(dir $@) $(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@ diff --git a/makefiles/platform_px4fmu.mk b/makefiles/board_px4fmu.mk similarity index 67% rename from makefiles/platform_px4fmu.mk rename to makefiles/board_px4fmu.mk index a9e103cc8a..959e4ed263 100644 --- a/makefiles/platform_px4fmu.mk +++ b/makefiles/board_px4fmu.mk @@ -7,4 +7,4 @@ # CONFIG_ARCH = CORTEXM4F -include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk +include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/platform_px4io.mk b/makefiles/board_px4io.mk similarity index 67% rename from makefiles/platform_px4io.mk rename to makefiles/board_px4io.mk index 7de24a60bd..275014aba5 100644 --- a/makefiles/platform_px4io.mk +++ b/makefiles/board_px4io.mk @@ -7,4 +7,4 @@ # CONFIG_ARCH = CORTEXM3 -include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk +include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index e0c1aff9dc..5a61e94287 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -6,4 +6,4 @@ CONFIG = px4fmu_default SRCS = $(PX4_BASE)/platforms/empty.c ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) -include $(PX4_BASE)/makefiles/firmware.mk +include $(PX4_MK_DIR)/firmware.mk diff --git a/makefiles/config_px4io_default.mk b/makefiles/config_px4io_default.mk index f47e7968b5..4361ce3ccf 100644 --- a/makefiles/config_px4io_default.mk +++ b/makefiles/config_px4io_default.mk @@ -5,4 +5,4 @@ CONFIG = px4io_default SRCS = $(PX4_BASE)/platforms/empty.c -include $(PX4_BASE)/makefiles/firmware.mk +include $(PX4_MK_DIR)/firmware.mk diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 574818d640..eade36905a 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -6,8 +6,8 @@ # # Requires: # -# PLATFORM -# Must be set to a platform name known to the PX4 distribution (as +# BOARD +# Must be set to a board name known to the PX4 distribution (as # we need a corresponding NuttX export archive to link with). # # Optional: @@ -41,16 +41,16 @@ # If PX4_BASE wasn't set previously, work out what it should be # and set it here now. # -export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST))) +export MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) -export PX4_BASE := $(abspath $(PX4_MK_INCLUDE)/..) +export PX4_BASE := $(abspath $(MK_DIR)/..) $(info %% set PX4_BASE to $(PX4_BASE)) endif # # Get path and tool config # -include $(PX4_MK_INCLUDE)/setup.mk +include $(MK_DIR)/setup.mk # # If WORK_DIR is not set, create a 'build' directory next to the @@ -63,18 +63,18 @@ endif $(info %% WORK_DIR $(WORK_DIR)) # -# Sanity-check the PLATFORM variable and then get the platform config. -# If PLATFORM is not set, but CONFIG is, use that. +# Sanity-check the BOARD variable and then get the board config. +# If BOARD is not set, but CONFIG is, use that. # -# The platform config in turn will fetch the toolchain configuration. +# The board config in turn will fetch the toolchain configuration. # -ifeq ($(PLATFORM),) +ifeq ($(BOARD),) ifeq ($(CONFIG),) -$(error At least one of the PLATFORM or CONFIG variables must be set before including firmware.mk) +$(error At least one of the BOARD or CONFIG variables must be set before including firmware.mk) endif -PLATFORM := $(firstword $(subst _, ,$(CONFIG))) +BOARD := $(firstword $(subst _, ,$(CONFIG))) endif -include $(PX4_MK_INCLUDE)/platform_$(PLATFORM).mk +include $(PX4_MK_DIR)/board_$(BOARD).mk # # Things that, if they change, might affect everything @@ -86,11 +86,11 @@ GLOBAL_DEPS += $(MAKEFILE_LIST) ################################################################################ # -# Check that the NuttX archive for the selected platform is available. +# Check that the NuttX archive for the selected board is available. # -NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(PLATFORM).export) +NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(BOARD).export) ifeq ($(NUTTX_ARCHIVE),) -$(error The NuttX export archive for $(PLATFORM) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) +$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) endif # @@ -244,7 +244,7 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) $(PRODUCT_BUNDLE): $(PRODUCT_BIN) @echo %% Generating $@ - $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(PLATFORM).prototype \ + $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \ --git_identity $(PX4_BASE) \ --image $< > $@ diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 97893921db..94efd401d4 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -7,6 +7,7 @@ # export PX4_APP_SRC = $(PX4_BASE)/src/apps export PX4_LIB_SRC = $(PX4_BASE)/src/libs +export PX4_MK_DIR = $(PX4_BASE)/makefiles export NUTTX_SRC = $(PX4_BASE)/nuttx export NUTTX_APP_SRC = $(PX4_BASE)/apps export MAVLINK_SRC = $(PX4_BASE)/mavlink From 3494039d9000d211c122d73d5e7ac9cf9109dddb Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 20 Feb 2013 22:07:18 -0800 Subject: [PATCH 018/129] Get a bit fancier with the builtin app specifications, so that we can generate them from apps as well as the config. --- makefiles/config_px4fmu_default.mk | 5 +++++ makefiles/firmware.mk | 33 +++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 5a61e94287..2c1764d61b 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -6,4 +6,9 @@ CONFIG = px4fmu_default SRCS = $(PX4_BASE)/platforms/empty.c ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) +# Commands from the NuttX export archive +# +# Each entry here is ... +BUILTIN_COMMANDS = perf.SCHED_PRIORITY_DEFAULT.CONFIG_PTHREAD_STACK_DEFAULT.perf_main + include $(PX4_MK_DIR)/firmware.mk diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index eade36905a..a6c7e0f485 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -165,18 +165,45 @@ endif # # XXX need to fix stack size numbers here so that apps can set them. # +# Builtin commands can be generated by the configuration, in which case they +# must refer to commands that already exist, or indirectly generated by applications +# when they are built. +# +# The configuration supplies builtin command information in the BUILTIN_COMMANDS +# variable. Applications make empty files in $(WORK_DIR)/builtin_commands whose +# filename contains the same information. +# +# In each case, the command information consists of four fields separated with a +# period. These fields are the command's name, its thread priority, its stack size +# and the name of the function to call when starting the thread. +# +# BUILTIN_CSRC = $(WORK_DIR)/builtin_commands.c +# add command definitions from apps +BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)/builtin_commands/APP.*))) + +# (BUILTIN_PROTO,,) +define BUILTIN_PROTO + echo 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; +endef + +# (BUILTIN_DEF,,) +define BUILTIN_DEF + echo ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; +endef + $(BUILTIN_CSRC): $(MAKEFILE_LIST) @echo %% generating $@ $(Q) echo '/* builtin command list - automatically generated, do not edit */' > $@ $(Q) echo '#include ' >> $@ $(Q) echo '#include ' >> $@ - $(Q) $(foreach app,$(APPS),echo 'extern int $(app)_main(int argc, char *argv[]);' >> $@;) + $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) $(Q) echo 'const struct builtin_s g_builtins[] = {' >> $@ - $(Q) $(foreach app,$(APPS),echo ' {"$(app)", SCHED_PRIORITY_DEFAULT, CONFIG_PTHREAD_STACK_DEFAULT, $(app)_main},' >> $@;) + $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) + $(Q) echo ' {NULL, 0, 0, NULL}' >> $@ $(Q) echo '};' >> $@ - $(Q) echo 'const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);' >> $@ + $(Q) echo 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ BUILTIN_OBJ = $(BUILTIN_CSRC:.c=.o) LIBS += $(BUILTIN_OBJ) From 8d7621079aa123d1d8e44ae4fd628bb1be72eb1f Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 22 Feb 2013 23:27:24 -0800 Subject: [PATCH 019/129] Checkpoint: application framework makefile done --- Makefile | 5 +- makefiles/application.mk | 162 +++++++++++++++++++++ makefiles/config_px4fmu_default.mk | 14 +- makefiles/config_px4io_default.mk | 5 +- makefiles/firmware.mk | 214 +++++++++++++++++++--------- makefiles/nuttx.mk | 40 ++++++ makefiles/setup.mk | 2 +- makefiles/toolchain_gnu-arm-eabi.mk | 17 +-- src/apps/test/app.mk | 4 + src/apps/test/foo.c | 0 10 files changed, 377 insertions(+), 86 deletions(-) create mode 100644 makefiles/application.mk create mode 100644 makefiles/nuttx.mk create mode 100644 src/apps/test/app.mk create mode 100644 src/apps/test/foo.c diff --git a/Makefile b/Makefile index 2495a363ae..a86065b977 100644 --- a/Makefile +++ b/Makefile @@ -60,10 +60,13 @@ $(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 $(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@) $(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: + @echo %%%% @echo %%%% Building $(config) in $(work_dir) + @echo %%%% $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ - -f $(PX4_BASE)/makefiles/config_$(config).mk \ + -f $(PX4_MK_DIR)/firmware.mk \ + CONFIG=$(config) \ WORK_DIR=$(work_dir) \ firmware diff --git a/makefiles/application.mk b/makefiles/application.mk new file mode 100644 index 0000000000..24be729ccd --- /dev/null +++ b/makefiles/application.mk @@ -0,0 +1,162 @@ +# +# Framework makefile for PX4 applications +# +# This makefile is invoked by firmware.mk to build each of the applications +# that will subsequently be linked into the firmware image. +# +# Applications are built as prelinked objects with a limited set of exported +# symbols, as the global namespace is shared between all apps. Normally an +# application will just export one or more _main functions. +# + +# +# Variables that can be set by the application's app.mk: +# +# +# SRCS (required) +# Lists the .c, cpp and .S files that should be compiled/assembled to +# produce the application. +# +# APP_NAME (optional) +# APP_ENTRYPOINT (optional if APP_NAME is set) +# APP_STACKSIZE (optional if APP_NAME is set) +# APP_PRIORITY (optional if APP_NAME is set) +# Defines a single builtin command exported by the application. +# APP_NAME must be unique for any configuration, but need not be the +# same as the app directory name. +# +# If APP_ENTRYPOINT is set, it names the function (which must be exported) +# that will be the entrypoint for the builtin command. It defaults to +# $(APP_NAME)_main. +# +# If APP_STACKSIZE is set, it is the size in bytes of the stack to be +# allocated for the builtin command. If it is not set, it defaults +# to CONFIG_PTHREAD_STACK_DEFAULT. +# +# If APP_PRIORITY is set, it is the thread priority for the builtin +# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. +# +# APP_COMMANDS (optional) +# Defines builtin commands exported by the application. Each word in +# the list should be formatted as: +# ... +# + +# +# Variables visible to the application's app.mk: +# +# CONFIG +# BOARD +# APP_WORK_DIR +# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. +# Anything exported from config_$(CONFIG).mk +# + +################################################################################ +# No user-serviceable parts below. +################################################################################ + +ifeq ($(APP_MK),) +$(error No application makefile specified) +endif + +# +# Get path and tool config +# +include $(PX4_BASE)/makefiles/setup.mk + +# +# Get the board/toolchain config +# +include $(PX4_MK_DIR)/board_$(BOARD).mk + +# +# Get the application's config +# +include $(APP_MK) +APP_SRC_DIR := $(dir $(APP_MK)) + +# +# Things that, if they change, might affect everything +# +GLOBAL_DEPS += $(MAKEFILE_LIST) + +################################################################################ +# Builtin command definitions +################################################################################ + +ifneq ($(APP_NAME),) +APP_ENTRYPOINT ?= $(APP_NAME)_main +APP_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT +APP_PRIORITY ?= SCHED_PRIORITY_DEFAULT +APP_COMMANDS += $(APP_NAME).$(APP_PRIORITY).$(APP_STACKSIZE).$(APP_ENTRYPOINT) +endif + +ifneq ($(APP_COMMANDS),) +APP_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(APP_COMMANDS)) + +.PHONY: $(APP_COMMAND_FILES) +$(APP_COMMAND_FILES): $(GLOBAL_DEPS) + @echo %% registering: $(word 2,$(subst ., ,$(notdir $(@)))) + @mkdir -p $@ + $(Q) touch $@ +endif + +################################################################################ +# Build rules +################################################################################ + +# +# What we're going to build +# +app: $(APP_OBJ) $(APP_COMMAND_FILES) + +# +# Locate sources (allows relative source paths in app.mk) +# +define SRC_SEARCH + $(firstword $(wildcard $(APP_SRC_DIR)/$1) MISSING_$1) +endef + +ABS_SRCS := $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) +MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) +ifneq ($(MISSING_SRCS),) +$(error $(APP_MK): missing in SRCS: $(MISSING_SRCS)) +endif +ifeq ($(ABS_SRCS),) +$(error $(APP_MK): nothing to compile in SRCS) +endif + +# +# Object files we will generate from sources +# +OBJS := $(foreach src,$(ABS_SRCS),$(APP_WORK_DIR)/$(src).o) + +# +# SRCS -> OBJS rules +# + +$(OBJS): $(GLOBAL_DEPS) + +$(filter %.c.o,$(OBJS)): $(APP_WORK_DIR)/%.c.o: %.c + $(call COMPILE,$<,$@) + +$(filter %.cpp.o,$(OBJS)): $(APP_WORK_DIR)/%.cpp.o: %.cpp $(GLOBAL_DEPS) + $(call COMPILEXX,$<,$@) + +$(filter %.S.o,$(OBJS)): $(APP_WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) + $(call ASSEMBLE,$<,$@) + +# +# Built product rules +# + +$(APP_OBJ): $(OBJS) $(GLOBAL_DEPS) + $(call PRELINK,$@,$(OBJS)) + +# +# Utility rules +# + +clean: + $(Q) $(REMOVE) $(APP_PRELINK) $(OBJS) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 2c1764d61b..16b105277f 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -2,13 +2,19 @@ # Makefile for the px4fmu_default configuration # -CONFIG = px4fmu_default -SRCS = $(PX4_BASE)/platforms/empty.c +# +# Use the configuration's ROMFS. +# ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) -# Commands from the NuttX export archive +# +# Add commands from the NuttX export archive. # # Each entry here is ... +# BUILTIN_COMMANDS = perf.SCHED_PRIORITY_DEFAULT.CONFIG_PTHREAD_STACK_DEFAULT.perf_main -include $(PX4_MK_DIR)/firmware.mk +# +# Build the test app +# +APPS = test diff --git a/makefiles/config_px4io_default.mk b/makefiles/config_px4io_default.mk index 4361ce3ccf..dc774fe639 100644 --- a/makefiles/config_px4io_default.mk +++ b/makefiles/config_px4io_default.mk @@ -2,7 +2,4 @@ # Makefile for the px4io_default configuration # -CONFIG = px4io_default -SRCS = $(PX4_BASE)/platforms/empty.c - -include $(PX4_MK_DIR)/firmware.mk +# ... nothing here yet diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index a6c7e0f485..9a98d2bc64 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -1,8 +1,5 @@ # -# Generic Makefile for PX4 firmware. -# -# Currently this assumes that we're just compiling SRCS -# and then linking the whole thing together. +# Generic Makefile for PX4 firmware images. # # Requires: # @@ -12,6 +9,39 @@ # # Optional: # +# APPS +# Contains a list of application paths or path fragments used +# to find applications. The names listed here are searched in +# the following directories: +# +# $(APP_SEARCH_DIRS) +# WORK_DIR +# APP_SRC +# PX4_APP_SRC +# +# Application directories are expected to contain an 'app.mk' +# file which provides build configuration for the app. See +# application.mk for more details. +# +# LIBS +# Contains a list of library paths or path fragments used +# to find libraries. The names listed here are searched in the +# following directories: +# +# $(LIB_SEARCH_DIRS) +# WORK_DIR +# LIB_SRC +# PX4_LIB_SRC +# +# Library directories are expected to contain a 'lib.mk' +# file which provides build configuration for the library. See +# library.mk for more details. +# +# BUILTIN_COMMANDS +# Contains a list of built-in commands not explicitly provided +# by applications / libraries. Each entry in this list is formatted +# as ... +# # PX4_BASE: # Points to a PX4 distribution. Normally determined based on the # path to this file. @@ -29,6 +59,14 @@ # containing the files under the directory and linked into the final # image. # +# APP_SEARCH_DIRS: +# Extra directories to search first for APPS before looking in the +# usual places. +# +# LIB_SEARCH_DIRS: +# Extra directories to search first for LIBS before looking in the +# usual places. +# ################################################################################ # Paths and configuration @@ -41,17 +79,57 @@ # If PX4_BASE wasn't set previously, work out what it should be # and set it here now. # -export MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) +MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(MK_DIR)/..) $(info %% set PX4_BASE to $(PX4_BASE)) endif +# +# Set a default target so that included makefiles or errors here don't +# cause confusion. +# +# XXX We could do something cute here with $(DEFAULT_GOAL) if it's not one +# of the maintenance targets and set CONFIG based on it. +# +all: firmware + # # Get path and tool config # include $(MK_DIR)/setup.mk +# +# Locate the configuration file +# +ifeq ($(CONFIG),) +$(error Missing configuration name or file (specify with CONFIG=)) +endif +CONFIG_FILE := $(firstword $(wildcard $(CONFIG)) $(wildcard $(PX4_MK_DIR)/config_$(CONFIG).mk)) +ifeq ($(CONFIG_FILE),) +$(error Can't find a config file called $(CONFIG) or $(PX4_MK_DIR)/config_$(CONFIG).mk) +endif +export CONFIG +include $(CONFIG_FILE) +$(info %% CONFIG $(CONFIG)) + +# +# Sanity-check the BOARD variable and then get the board config. +# If BOARD was not set by the configuration, extract it automatically. +# +# The board config in turn will fetch the toolchain configuration. +# +ifeq ($(BOARD),) +BOARD := $(firstword $(subst _, ,$(CONFIG))) +endif +BOARD_FILE := $(wildcard $(PX4_MK_DIR)/board_$(BOARD).mk) +ifeq ($(BOARD_FILE),) +$(error Config $(CONFIG) references board $(BOARD), but no board definition file found) +endif +export BOARD +include $(BOARD_FILE) +$(info %% BOARD $(BOARD)) + # # If WORK_DIR is not set, create a 'build' directory next to the # parent Makefile. @@ -60,65 +138,68 @@ PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEF ifeq ($(WORK_DIR),) export WORK_DIR := $(dir $(PARENT_MAKEFILE))/build endif -$(info %% WORK_DIR $(WORK_DIR)) - -# -# Sanity-check the BOARD variable and then get the board config. -# If BOARD is not set, but CONFIG is, use that. -# -# The board config in turn will fetch the toolchain configuration. -# -ifeq ($(BOARD),) -ifeq ($(CONFIG),) -$(error At least one of the BOARD or CONFIG variables must be set before including firmware.mk) -endif -BOARD := $(firstword $(subst _, ,$(CONFIG))) -endif -include $(PX4_MK_DIR)/board_$(BOARD).mk +$(info %% WORK_DIR $(WORK_DIR)) # # Things that, if they change, might affect everything # GLOBAL_DEPS += $(MAKEFILE_LIST) +################################################################################ +# Applications +################################################################################ + +# where to look for applications +APP_SEARCH_DIRS += $(WORK_DIR) $(APP_SRC) $(PX4_APP_SRC) + +# sort and unique the apps list +APPS := $(sort $(APPS)) + +# locate the first instance of an app by full path or by looking on the +# application search path +define APP_SEARCH + $(firstword $(wildcard $(1)/app.mk) \ + $(foreach search_dir,$(APP_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/app.mk)) \ + MISSING_$1) +endef + +APP_MKFILES := $(foreach app,$(APPS),$(call APP_SEARCH,$(app))) +MISSING_APPS := $(subst MISSING_,,$(filter MISSING_%,$(APP_MKFILES))) +ifneq ($(MISSING_APPS),) +$(error Can't find application(s): $(MISSING_APPS)) +endif + +APP_OBJS := $(foreach path,$(dir $(APP_MKFILES)),$(WORK_DIR)/$(path)/app.pre.o) + +$(APP_OBJS): relpath = $(patsubst $(WORK_DIR)/%,%,$@) +$(APP_OBJS): mkfile = $(patsubst %/app.pre.o,%/app.mk,$(relpath)) +$(APP_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) + @echo %% + @echo %% Building app in $(relpath) using $(mkfile) + @echo %% + $(Q) make -f $(PX4_MK_DIR)/application.mk \ + APP_WORK_DIR=$(dir $@) \ + APP_OBJ=$@ \ + APP_MK=$(mkfile) \ + app + +APP_CLEANS := $(foreach path,$(dir $(APP_MKFILES)),$(WORK_DIR)/$(path)/clean) + +.PHONY: $(APP_CLEANS) +$(APP_CLEANS): relpath = $(patsubst $(WORK_DIR)/%,%,$@) +$(APP_CLEANS): mkfile = $(patsubst %/clean,%/app.mk,$(relpath)) +$(APP_CLEANS): + @echo %% cleaning using $(mkfile) + $(Q) make -f $(PX4_MK_DIR)/application.mk \ + APP_WORK_DIR=$(dir $@) \ + APP_MK=$(mkfile) \ + clean + ################################################################################ # NuttX libraries and paths ################################################################################ -# -# Check that the NuttX archive for the selected board is available. -# -NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(BOARD).export) -ifeq ($(NUTTX_ARCHIVE),) -$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) -endif - -# -# The NuttX config header should always be present in the NuttX archive, and -# if it changes, everything should be rebuilt. So, use it as the trigger to -# unpack the NuttX archive. -# -NUTTX_EXPORT_DIR = $(WORK_DIR)/nuttx-export -NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)/include/nuttx/config.h -GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) - -# -# Use the linker script from the NuttX export -# -LDSCRIPT = $(NUTTX_EXPORT_DIR)/build/ld.script - -# -# Add directories from the NuttX export to the relevant search paths -# -INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)/include -LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs -LIBS += -lapps -lnuttx -LINK_DEPS += $(wildcard $(addsuffix /*.a,$(LIB_DIRS))) - -$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) - @echo %% Unpacking $(NUTTX_ARCHIVE) - $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) - $(Q) touch $@ +include $(PX4_MK_DIR)/nuttx.mk ################################################################################ # ROMFS generation @@ -149,7 +230,7 @@ $(ROMFS_CSRC): $(ROMFS_IMG) @echo %% generating $@ $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ -$(ROMFS_IMG): $(ROMFS_DEPS) +$(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS) @echo %% generating $@ $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" @@ -163,8 +244,6 @@ endif # Note that we can't just put builtin_commands.c in SRCS, as it's depended on by the # NuttX export library. Instead, we have to treat it like a library. # -# XXX need to fix stack size numbers here so that apps can set them. -# # Builtin commands can be generated by the configuration, in which case they # must refer to commands that already exist, or indirectly generated by applications # when they are built. @@ -181,7 +260,7 @@ endif BUILTIN_CSRC = $(WORK_DIR)/builtin_commands.c # add command definitions from apps -BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)/builtin_commands/APP.*))) +BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)/builtin_commands/COMMAND.*))) # (BUILTIN_PROTO,,) define BUILTIN_PROTO @@ -193,7 +272,7 @@ define BUILTIN_DEF echo ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; endef -$(BUILTIN_CSRC): $(MAKEFILE_LIST) +$(BUILTIN_CSRC): $(GLOBAL_DEPS) @echo %% generating $@ $(Q) echo '/* builtin command list - automatically generated, do not edit */' > $@ $(Q) echo '#include ' >> $@ @@ -209,7 +288,7 @@ BUILTIN_OBJ = $(BUILTIN_CSRC:.c=.o) LIBS += $(BUILTIN_OBJ) LINK_DEPS += $(BUILTIN_OBJ) -$(BUILTIN_OBJ): $(BUILTIN_CSRC) $(GLOBAL_DEPS) +$(BUILTIN_OBJ): $(BUILTIN_CSRC) $(Q) $(call COMPILE,$<,$@) ################################################################################ @@ -239,7 +318,7 @@ PRODUCT_BUNDLE = $(WORK_DIR)/firmware.px4 PRODUCT_BIN = $(WORK_DIR)/firmware.bin PRODUCT_SYM = $(WORK_DIR)/firmware.sym -.PHONY: all +.PHONY: firmware firmware: $(PRODUCT_BUNDLE) # @@ -254,15 +333,12 @@ OBJS := $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) $(OBJS): $(GLOBAL_DEPS) $(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c - @mkdir -p $(dir $@) $(call COMPILE,$<,$@) $(filter %.cpp.o,$(OBJS)): $(WORK_DIR)/%.cpp.o: %.cpp $(GLOBAL_DEPS) - @mkdir -p $(dir $@) $(call COMPILEXX,$<,$@) $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) - @mkdir -p $(dir $@) $(call ASSEMBLE,$<,$@) # @@ -278,21 +354,23 @@ $(PRODUCT_BUNDLE): $(PRODUCT_BIN) $(PRODUCT_BIN): $(PRODUCT_SYM) $(call SYM_TO_BIN,$<,$@) -$(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) - $(call LINK,$@,$(OBJS)) +$(PRODUCT_SYM): $(OBJS) $(APP_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(APP_MKFILES) + $(call LINK,$@,$(OBJS) $(APP_OBJS)) # # Utility rules # +.PHONY: upload upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) - $(Q) make -f $(PX4_MK_INCLUDE)/upload.mk \ + $(Q) make -f $(PX4_MK_DIR)/upload.mk \ METHOD=serial \ PRODUCT=$(PRODUCT) \ BUNDLE=$(PRODUCT_BUNDLE) \ BIN=$(PRODUCT_BIN) -clean: +.PHONY: clean +clean: $(APP_CLEANS) @echo %% cleaning $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk new file mode 100644 index 0000000000..cdbd6e0afc --- /dev/null +++ b/makefiles/nuttx.mk @@ -0,0 +1,40 @@ +# +# Rules and definitions related to handling the NuttX export archives when +# building firmware. +# + +# +# Check that the NuttX archive for the selected board is available. +# +NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(BOARD).export) +ifeq ($(NUTTX_ARCHIVE),) +$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) +endif + +# +# The NuttX config header should always be present in the NuttX archive, and +# if it changes, everything should be rebuilt. So, use it as the trigger to +# unpack the NuttX archive. +# +NUTTX_EXPORT_DIR = $(WORK_DIR)/nuttx-export +NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)/include/nuttx/config.h +GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) + +# +# Use the linker script from the NuttX export +# +LDSCRIPT = $(NUTTX_EXPORT_DIR)/build/ld.script + +# +# Add directories from the NuttX export to the relevant search paths +# +INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)/include +LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs +LIBS += -lapps -lnuttx +LINK_DEPS += $(NUTTX_EXPORT_DIR)/libs/libapps.a \ + $(NUTTX_EXPORT_DIR)/libs/libnuttx.a + +$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) + @echo %% Unpacking $(NUTTX_ARCHIVE) + $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) touch $@ diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 94efd401d4..0c142cb1d6 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -39,5 +39,5 @@ endif # # Makefile debugging. # -Q := $(if $(V),,@) +export Q := $(if $(V),,@) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 364cde1c1d..ba3b06c7f3 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -2,7 +2,7 @@ # Definitions for a generic GNU ARM-EABI toolchain # -$(info %% Toolchain: gnu-arm-eabi) +$(info %% TOOLCHAIN gnu-arm-eabi) CROSSDEV = arm-none-eabi- @@ -131,16 +131,11 @@ LINK_DEPS += $(LDSCRIPT) # files to include to get automated dependencies DEP_INCLUDES = $(subst .o,.d,$(OBJS)) -ifeq ($(V),) -Q = @ -else -Q = -endif - # compile C source $1 to object $2 # as a side-effect, generate a dependency file define COMPILE @echo "CC: $1" + @mkdir -p $(dir $2) $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 endef @@ -148,35 +143,41 @@ endef # as a side-effect, generate a dependency file define COMPILEXX @echo "CXX: $1" + @mkdir -p $(dir $2) $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 endef # assemble $1 into $2 define ASSEMBLE @echo "AS: $1" + @mkdir -p $(dir $2) $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 endef # produce partially-linked $1 from files in $2 define PRELINK @echo "PRELINK: $1" + @mkdir -p $(dir $1) $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 endef # update the archive $1 with the files in $2 define ARCHIVE @echo "AR: $2" + @mkdir -p $(dir $1) $(Q) $(AR) $1 $2 endef # Link the objects in $2 into the binary $1 define LINK @echo "LINK: $1" - $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group + @mkdir -p $(dir $1) + $(Q) $(LD) $(LDFLAGS) -o $1 $2 --start-group $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group endef # convert $1 from a linked object to a raw binary define SYM_TO_BIN @echo "BIN: $2" + @mkdir -p $(dir $2) $(Q) $(OBJCOPY) -O binary $1 $2 endef diff --git a/src/apps/test/app.mk b/src/apps/test/app.mk new file mode 100644 index 0000000000..283425c504 --- /dev/null +++ b/src/apps/test/app.mk @@ -0,0 +1,4 @@ + +APP_NAME = test +SRCS = foo.c + diff --git a/src/apps/test/foo.c b/src/apps/test/foo.c new file mode 100644 index 0000000000..e69de29bb2 From d24599931a3d68586cc62eddd8ffc4e309ba1606 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 12:23:34 -0800 Subject: [PATCH 020/129] APP -> MODULE remove as many duplicate slashes, etc. as seems practical --- Makefile | 36 +++--- makefiles/application.mk | 162 --------------------------- makefiles/config_px4fmu_default.mk | 4 +- makefiles/firmware.mk | 168 ++++++++++++++-------------- makefiles/module.mk | 165 +++++++++++++++++++++++++++ makefiles/nuttx.mk | 20 ++-- makefiles/setup.mk | 24 ++-- makefiles/toolchain_gnu-arm-eabi.mk | 7 +- src/apps/test/app.mk | 4 - src/{apps => modules}/test/foo.c | 0 src/modules/test/module.mk | 4 + 11 files changed, 303 insertions(+), 291 deletions(-) delete mode 100644 makefiles/application.mk create mode 100644 makefiles/module.mk delete mode 100644 src/apps/test/app.mk rename src/{apps => modules}/test/foo.c (100%) create mode 100644 src/modules/test/module.mk diff --git a/Makefile b/Makefile index a86065b977..b113040d06 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ # # Get path and tool configuration # -export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -include $(PX4_BASE)/makefiles/setup.mk +export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/ +include $(PX4_BASE)makefiles/setup.mk # # Canned firmware configurations that we build. @@ -41,15 +41,15 @@ endif # # Built products # -STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4) -FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.px4) +STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)$(config).px4) +FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)$(config).build/firmware.px4) all: $(STAGED_FIRMWARES) # # Copy FIRMWARES into the image directory. # -$(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 +$(STAGED_FIRMWARES): $(IMAGE_DIR)%.px4: $(BUILD_DIR)%.build/firmware.px4 @echo %% Copying $@ $(Q) $(COPY) $< $@ @@ -57,15 +57,15 @@ $(STAGED_FIRMWARES): $(IMAGE_DIR)/%.px4: $(BUILD_DIR)/%.build/firmware.px4 # Generate FIRMWARES. # .PHONY: $(FIRMWARES) -$(BUILD_DIR)/%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)/%.build/firmware.px4,%,$@) -$(BUILD_DIR)/%.build/firmware.px4: work_dir = $(BUILD_DIR)/$(config).build -$(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: +$(BUILD_DIR)%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)%.build/firmware.px4,%,$@) +$(BUILD_DIR)%.build/firmware.px4: work_dir = $(BUILD_DIR)$(config).build/ +$(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4: @echo %%%% @echo %%%% Building $(config) in $(work_dir) @echo %%%% $(Q) mkdir -p $(work_dir) $(Q) make -C $(work_dir) \ - -f $(PX4_MK_DIR)/firmware.mk \ + -f $(PX4_MK_DIR)firmware.mk \ CONFIG=$(config) \ WORK_DIR=$(work_dir) \ firmware @@ -83,21 +83,21 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4: # # XXX PX4IO configuration name is bad - NuttX configs should probably all be "px4" # -NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)/$(board).export) +NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)$(board).export) .PHONY: archives archives: $(NUTTX_ARCHIVES) -$(ARCHIVE_DIR)/%.export: board = $(notdir $(basename $@)) -$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(board),px4io),io,nsh) -$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) +$(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@)) +$(ARCHIVE_DIR)%.export: configuration = $(if $(filter $(board),px4io),io,nsh) +$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC) $(NUTTX_APPS) @echo %% Configuring NuttX for $(board) $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean - $(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(board)/$(configuration)) + $(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration)) @echo %% Exporting NuttX for $(board) $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export $(Q) mkdir -p $(dir $@) - $(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@ + $(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@ # # Cleanup targets. 'clean' should remove all built products and force @@ -106,11 +106,11 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS) # .PHONY: clean clean: - $(Q) $(RMDIR) $(BUILD_DIR)/*.build - $(Q) $(REMOVE) -f $(IMAGE_DIR)/*.px4 + $(Q) $(RMDIR) $(BUILD_DIR)*.build + $(Q) $(REMOVE) -f $(IMAGE_DIR)*.px4 .PHONY: distclean distclean: clean - $(Q) $(REMOVE) -f $(ARCHIVE_DIR)/*.export + $(Q) $(REMOVE) -f $(ARCHIVE_DIR)*.export $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean diff --git a/makefiles/application.mk b/makefiles/application.mk deleted file mode 100644 index 24be729ccd..0000000000 --- a/makefiles/application.mk +++ /dev/null @@ -1,162 +0,0 @@ -# -# Framework makefile for PX4 applications -# -# This makefile is invoked by firmware.mk to build each of the applications -# that will subsequently be linked into the firmware image. -# -# Applications are built as prelinked objects with a limited set of exported -# symbols, as the global namespace is shared between all apps. Normally an -# application will just export one or more _main functions. -# - -# -# Variables that can be set by the application's app.mk: -# -# -# SRCS (required) -# Lists the .c, cpp and .S files that should be compiled/assembled to -# produce the application. -# -# APP_NAME (optional) -# APP_ENTRYPOINT (optional if APP_NAME is set) -# APP_STACKSIZE (optional if APP_NAME is set) -# APP_PRIORITY (optional if APP_NAME is set) -# Defines a single builtin command exported by the application. -# APP_NAME must be unique for any configuration, but need not be the -# same as the app directory name. -# -# If APP_ENTRYPOINT is set, it names the function (which must be exported) -# that will be the entrypoint for the builtin command. It defaults to -# $(APP_NAME)_main. -# -# If APP_STACKSIZE is set, it is the size in bytes of the stack to be -# allocated for the builtin command. If it is not set, it defaults -# to CONFIG_PTHREAD_STACK_DEFAULT. -# -# If APP_PRIORITY is set, it is the thread priority for the builtin -# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. -# -# APP_COMMANDS (optional) -# Defines builtin commands exported by the application. Each word in -# the list should be formatted as: -# ... -# - -# -# Variables visible to the application's app.mk: -# -# CONFIG -# BOARD -# APP_WORK_DIR -# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. -# Anything exported from config_$(CONFIG).mk -# - -################################################################################ -# No user-serviceable parts below. -################################################################################ - -ifeq ($(APP_MK),) -$(error No application makefile specified) -endif - -# -# Get path and tool config -# -include $(PX4_BASE)/makefiles/setup.mk - -# -# Get the board/toolchain config -# -include $(PX4_MK_DIR)/board_$(BOARD).mk - -# -# Get the application's config -# -include $(APP_MK) -APP_SRC_DIR := $(dir $(APP_MK)) - -# -# Things that, if they change, might affect everything -# -GLOBAL_DEPS += $(MAKEFILE_LIST) - -################################################################################ -# Builtin command definitions -################################################################################ - -ifneq ($(APP_NAME),) -APP_ENTRYPOINT ?= $(APP_NAME)_main -APP_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT -APP_PRIORITY ?= SCHED_PRIORITY_DEFAULT -APP_COMMANDS += $(APP_NAME).$(APP_PRIORITY).$(APP_STACKSIZE).$(APP_ENTRYPOINT) -endif - -ifneq ($(APP_COMMANDS),) -APP_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(APP_COMMANDS)) - -.PHONY: $(APP_COMMAND_FILES) -$(APP_COMMAND_FILES): $(GLOBAL_DEPS) - @echo %% registering: $(word 2,$(subst ., ,$(notdir $(@)))) - @mkdir -p $@ - $(Q) touch $@ -endif - -################################################################################ -# Build rules -################################################################################ - -# -# What we're going to build -# -app: $(APP_OBJ) $(APP_COMMAND_FILES) - -# -# Locate sources (allows relative source paths in app.mk) -# -define SRC_SEARCH - $(firstword $(wildcard $(APP_SRC_DIR)/$1) MISSING_$1) -endef - -ABS_SRCS := $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) -MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) -ifneq ($(MISSING_SRCS),) -$(error $(APP_MK): missing in SRCS: $(MISSING_SRCS)) -endif -ifeq ($(ABS_SRCS),) -$(error $(APP_MK): nothing to compile in SRCS) -endif - -# -# Object files we will generate from sources -# -OBJS := $(foreach src,$(ABS_SRCS),$(APP_WORK_DIR)/$(src).o) - -# -# SRCS -> OBJS rules -# - -$(OBJS): $(GLOBAL_DEPS) - -$(filter %.c.o,$(OBJS)): $(APP_WORK_DIR)/%.c.o: %.c - $(call COMPILE,$<,$@) - -$(filter %.cpp.o,$(OBJS)): $(APP_WORK_DIR)/%.cpp.o: %.cpp $(GLOBAL_DEPS) - $(call COMPILEXX,$<,$@) - -$(filter %.S.o,$(OBJS)): $(APP_WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) - $(call ASSEMBLE,$<,$@) - -# -# Built product rules -# - -$(APP_OBJ): $(OBJS) $(GLOBAL_DEPS) - $(call PRELINK,$@,$(OBJS)) - -# -# Utility rules -# - -clean: - $(Q) $(REMOVE) $(APP_PRELINK) $(OBJS) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 16b105277f..6ab0d855df 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -15,6 +15,6 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) BUILTIN_COMMANDS = perf.SCHED_PRIORITY_DEFAULT.CONFIG_PTHREAD_STACK_DEFAULT.perf_main # -# Build the test app +# Build the test module # -APPS = test +MODULES = test diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 9a98d2bc64..1b6a1cdef5 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -9,37 +9,23 @@ # # Optional: # -# APPS -# Contains a list of application paths or path fragments used -# to find applications. The names listed here are searched in +# MODULES +# Contains a list of module paths or path fragments used +# to find modules. The names listed here are searched in # the following directories: # -# $(APP_SEARCH_DIRS) +# $(MODULE_SEARCH_DIRS) # WORK_DIR -# APP_SRC -# PX4_APP_SRC +# MODULE_SRC +# PX4_MODULE_SRC # -# Application directories are expected to contain an 'app.mk' -# file which provides build configuration for the app. See -# application.mk for more details. -# -# LIBS -# Contains a list of library paths or path fragments used -# to find libraries. The names listed here are searched in the -# following directories: -# -# $(LIB_SEARCH_DIRS) -# WORK_DIR -# LIB_SRC -# PX4_LIB_SRC -# -# Library directories are expected to contain a 'lib.mk' -# file which provides build configuration for the library. See -# library.mk for more details. +# Application directories are expected to contain a module.mk +# file which provides build configuration for the module. See +# makefiles/module.mk for more details. # # BUILTIN_COMMANDS # Contains a list of built-in commands not explicitly provided -# by applications / libraries. Each entry in this list is formatted +# by modules / libraries. Each entry in this list is formatted # as ... # # PX4_BASE: @@ -59,12 +45,8 @@ # containing the files under the directory and linked into the final # image. # -# APP_SEARCH_DIRS: -# Extra directories to search first for APPS before looking in the -# usual places. -# -# LIB_SEARCH_DIRS: -# Extra directories to search first for LIBS before looking in the +# MODULE_SEARCH_DIRS: +# Extra directories to search first for MODULES before looking in the # usual places. # @@ -82,8 +64,8 @@ MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(MK_DIR)/..) -$(info %% set PX4_BASE to $(PX4_BASE)) endif +$(info PX4_BASE $(PX4_BASE)) # # Set a default target so that included makefiles or errors here don't @@ -111,7 +93,7 @@ $(error Can't find a config file called $(CONFIG) or $(PX4_MK_DIR)/config_$(CONF endif export CONFIG include $(CONFIG_FILE) -$(info %% CONFIG $(CONFIG)) +$(info CONFIG $(CONFIG)) # # Sanity-check the BOARD variable and then get the board config. @@ -128,7 +110,7 @@ $(error Config $(CONFIG) references board $(BOARD), but no board definition file endif export BOARD include $(BOARD_FILE) -$(info %% BOARD $(BOARD)) +$(info BOARD $(BOARD)) # # If WORK_DIR is not set, create a 'build' directory next to the @@ -136,9 +118,9 @@ $(info %% BOARD $(BOARD)) # PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) ifeq ($(WORK_DIR),) -export WORK_DIR := $(dir $(PARENT_MAKEFILE))/build +export WORK_DIR := $(dir $(PARENT_MAKEFILE))build/ endif -$(info %% WORK_DIR $(WORK_DIR)) +$(info WORK_DIR $(WORK_DIR)) # # Things that, if they change, might affect everything @@ -146,53 +128,71 @@ $(info %% WORK_DIR $(WORK_DIR)) GLOBAL_DEPS += $(MAKEFILE_LIST) ################################################################################ -# Applications +# Modules ################################################################################ -# where to look for applications -APP_SEARCH_DIRS += $(WORK_DIR) $(APP_SRC) $(PX4_APP_SRC) +# +# We don't actually know what a moldule is called; all we have is a path fragment +# that we can search for, and where we expect to find a module.mk file. +# +# As such, we replicate the successfully-found path inside WORK_DIR for the +# module's build products in order to keep modules separated from each other. +# +# XXX If this becomes unwieldy or breaks for other reasons, we will need to +# move to allocating directory names and keeping tabs on makefiles via +# the directory name. That will involve arithmetic (it'd probably be time +# for GMSL). -# sort and unique the apps list -APPS := $(sort $(APPS)) +# where to look for modules +MODULE_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) -# locate the first instance of an app by full path or by looking on the -# application search path -define APP_SEARCH - $(firstword $(wildcard $(1)/app.mk) \ - $(foreach search_dir,$(APP_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/app.mk)) \ - MISSING_$1) +# sort and unique the modules list +MODULES := $(sort $(MODULES)) + +# locate the first instance of a module by full path or by looking on the +# module search path +define MODULE_SEARCH + $(abspath $(firstword $(wildcard $(1)/module.mk) \ + $(foreach search_dir,$(MODULE_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/module.mk)) \ + MISSING_$1)) endef -APP_MKFILES := $(foreach app,$(APPS),$(call APP_SEARCH,$(app))) -MISSING_APPS := $(subst MISSING_,,$(filter MISSING_%,$(APP_MKFILES))) -ifneq ($(MISSING_APPS),) -$(error Can't find application(s): $(MISSING_APPS)) +# make a list of module makefiles and check that we found them all +MODULE_MKFILES := $(foreach module,$(MODULES),$(call MODULE_SEARCH,$(module))) +MISSING_MODULES := $(subst MISSING_,,$(filter MISSING_%,$(MODULE_MKFILES))) +ifneq ($(MISSING_MODULES),) +$(error Can't find module(s): $(MISSING_MODULES)) endif -APP_OBJS := $(foreach path,$(dir $(APP_MKFILES)),$(WORK_DIR)/$(path)/app.pre.o) +# make a list of the object files we expect to build from modules +MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module.pre.o) -$(APP_OBJS): relpath = $(patsubst $(WORK_DIR)/%,%,$@) -$(APP_OBJS): mkfile = $(patsubst %/app.pre.o,%/app.mk,$(relpath)) -$(APP_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) +# rules to build module objects +.PHONY: $(MODULE_OBJS) +$(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) +$(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) +$(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) @echo %% - @echo %% Building app in $(relpath) using $(mkfile) + @echo %% Building module using $(mkfile) @echo %% - $(Q) make -f $(PX4_MK_DIR)/application.mk \ - APP_WORK_DIR=$(dir $@) \ - APP_OBJ=$@ \ - APP_MK=$(mkfile) \ - app + $(Q) make -f $(PX4_MK_DIR)module.mk \ + MODULE_WORK_DIR=$(dir $@) \ + MODULE_OBJ=$@ \ + MODULE_MK=$(mkfile) \ + module -APP_CLEANS := $(foreach path,$(dir $(APP_MKFILES)),$(WORK_DIR)/$(path)/clean) +# make a list of phony clean targets for modules +MODULE_CLEANS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)/clean) -.PHONY: $(APP_CLEANS) -$(APP_CLEANS): relpath = $(patsubst $(WORK_DIR)/%,%,$@) -$(APP_CLEANS): mkfile = $(patsubst %/clean,%/app.mk,$(relpath)) -$(APP_CLEANS): +# rules to clean modules +.PHONY: $(MODULE_CLEANS) +$(MODULE_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) +$(MODULE_CLEANS): mkfile = $(patsubst %clean,%module.mk,$(relpath)) +$(MODULE_CLEANS): @echo %% cleaning using $(mkfile) - $(Q) make -f $(PX4_MK_DIR)/application.mk \ - APP_WORK_DIR=$(dir $@) \ - APP_MK=$(mkfile) \ + $(Q) make -f $(PX4_MK_DIR)module.mk \ + MODULE_WORK_DIR=$(dir $@) \ + MODULE_MK=$(mkfile) \ clean ################################################################################ @@ -217,7 +217,7 @@ ROMFS_DEPS += $(wildcard \ (ROMFS_ROOT)/*/*/*/* \ (ROMFS_ROOT)/*/*/*/*/* \ (ROMFS_ROOT)/*/*/*/*/*/*) -ROMFS_IMG = $(WORK_DIR)/romfs.img +ROMFS_IMG = $(WORK_DIR)romfs.img ROMFS_CSRC = $(ROMFS_IMG:.img=.c) ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) LIBS += $(ROMFS_OBJ) @@ -245,7 +245,7 @@ endif # NuttX export library. Instead, we have to treat it like a library. # # Builtin commands can be generated by the configuration, in which case they -# must refer to commands that already exist, or indirectly generated by applications +# must refer to commands that already exist, or indirectly generated by modules # when they are built. # # The configuration supplies builtin command information in the BUILTIN_COMMANDS @@ -257,10 +257,10 @@ endif # and the name of the function to call when starting the thread. # # -BUILTIN_CSRC = $(WORK_DIR)/builtin_commands.c +BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c -# add command definitions from apps -BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)/builtin_commands/COMMAND.*))) +# add command definitions from modules +BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) # (BUILTIN_PROTO,,) define BUILTIN_PROTO @@ -300,7 +300,7 @@ $(BUILTIN_OBJ): $(BUILTIN_CSRC) # source file. # ifeq ($(SRCS),) -EMPTY_SRC = $(WORK_DIR)/empty.c +EMPTY_SRC = $(WORK_DIR)empty.c $(EMPTY_SRC): $(Q) echo '/* this is an empty file */' > $@ @@ -314,9 +314,9 @@ endif # # What we're going to build. # -PRODUCT_BUNDLE = $(WORK_DIR)/firmware.px4 -PRODUCT_BIN = $(WORK_DIR)/firmware.bin -PRODUCT_SYM = $(WORK_DIR)/firmware.sym +PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4 +PRODUCT_BIN = $(WORK_DIR)firmware.bin +PRODUCT_SYM = $(WORK_DIR)firmware.sym .PHONY: firmware firmware: $(PRODUCT_BUNDLE) @@ -324,7 +324,7 @@ firmware: $(PRODUCT_BUNDLE) # # Object files we will generate from sources # -OBJS := $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) +OBJS := $(foreach src,$(SRCS),$(WORK_DIR)$(src).o) # # SRCS -> OBJS rules @@ -332,13 +332,13 @@ OBJS := $(foreach src,$(SRCS),$(WORK_DIR)/$(src).o) $(OBJS): $(GLOBAL_DEPS) -$(filter %.c.o,$(OBJS)): $(WORK_DIR)/%.c.o: %.c +$(filter %.c.o,$(OBJS)): $(WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) $(call COMPILE,$<,$@) -$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)/%.cpp.o: %.cpp $(GLOBAL_DEPS) +$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) $(call COMPILEXX,$<,$@) -$(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS) +$(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) $(call ASSEMBLE,$<,$@) # @@ -354,8 +354,8 @@ $(PRODUCT_BUNDLE): $(PRODUCT_BIN) $(PRODUCT_BIN): $(PRODUCT_SYM) $(call SYM_TO_BIN,$<,$@) -$(PRODUCT_SYM): $(OBJS) $(APP_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(APP_MKFILES) - $(call LINK,$@,$(OBJS) $(APP_OBJS)) +$(PRODUCT_SYM): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) + $(call LINK,$@,$(OBJS) $(MODULE_OBJS)) # # Utility rules @@ -370,7 +370,7 @@ upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) BIN=$(PRODUCT_BIN) .PHONY: clean -clean: $(APP_CLEANS) +clean: $(MODULE_CLEANS) @echo %% cleaning $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) diff --git a/makefiles/module.mk b/makefiles/module.mk new file mode 100644 index 0000000000..306a9594f4 --- /dev/null +++ b/makefiles/module.mk @@ -0,0 +1,165 @@ +# +# Framework makefile for PX4 modules +# +# This makefile is invoked by firmware.mk to build each of the modules +# that will subsequently be linked into the firmware image. +# +# Applications are built as prelinked objects with a limited set of exported +# symbols, as the global namespace is shared between all modules. Normally an +# module will just export one or more _main functions. +# + +# +# Variables that can be set by the module's module.mk: +# +# +# SRCS (required) +# Lists the .c, cpp and .S files that should be compiled/assembled to +# produce the module. +# +# MODULE_NAME (optional) +# MODULE_ENTRYPOINT (optional if MODULE_NAME is set) +# MODULE_STACKSIZE (optional if MODULE_NAME is set) +# MODULE_PRIORITY (optional if MODULE_NAME is set) +# Defines a single builtin command exported by the module. +# MODULE_NAME must be unique for any configuration, but need not be the +# same as the module directory name. +# +# If MODULE_ENTRYPOINT is set, it names the function (which must be exported) +# that will be the entrypoint for the builtin command. It defaults to +# $(MODULE_NAME)_main. +# +# If MODULE_STACKSIZE is set, it is the size in bytes of the stack to be +# allocated for the builtin command. If it is not set, it defaults +# to CONFIG_PTHREAD_STACK_DEFAULT. +# +# If MODULE_PRIORITY is set, it is the thread priority for the builtin +# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. +# +# MODULE_COMMANDS (optional) +# Defines builtin commands exported by the module. Each word in +# the list should be formatted as: +# ... +# + +# +# Variables visible to the module's module.mk: +# +# CONFIG +# BOARD +# MODULE_WORK_DIR +# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. +# Anything exported from config_$(CONFIG).mk +# + +################################################################################ +# No user-serviceable parts below. +################################################################################ + +ifeq ($(MODULE_MK),) +$(error No module makefile specified) +endif +$(info MODULE_MK $(MODULE_MK)) + +# +# Get path and tool config +# +include $(PX4_BASE)/makefiles/setup.mk + +# +# Get the board/toolchain config +# +include $(PX4_MK_DIR)/board_$(BOARD).mk + +# +# Get the module's config +# +include $(MODULE_MK) +MODULE_SRC := $(dir $(MODULE_MK)) +$(info MODULE_SRC $(MODULE_SRC)) +$(info MODULE_WORK_DIR $(MODULE_WORK_DIR)) + +# +# Things that, if they change, might affect everything +# +GLOBAL_DEPS += $(MAKEFILE_LIST) + +################################################################################ +# Builtin command definitions +################################################################################ + +ifneq ($(MODULE_NAME),) +MODULE_ENTRYPOINT ?= $(MODULE_NAME)_main +MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT +MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT +MODULE_COMMANDS += $(MODULE_NAME).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT) +endif + +ifneq ($(MODULE_COMMANDS),) +MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODULE_COMMANDS)) + +.PHONY: $(MODULE_COMMAND_FILES) +$(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) + @echo COMMAND $(word 2,$(subst ., ,$(notdir $(@)))) + @mkdir -p $@ + $(Q) touch $@ +endif + +################################################################################ +# Build rules +################################################################################ + +# +# What we're going to build +# +module: $(MODULE_OBJ) $(MODULE_COMMAND_FILES) + +# +# Locate sources (allows relative source paths in module.mk) +# +define SRC_SEARCH + $(abspath $(firstword $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) +endef + +ABS_SRCS := $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) +MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) +ifneq ($(MISSING_SRCS),) +$(error $(MODULE_MK): missing in SRCS: $(MISSING_SRCS)) +endif +ifeq ($(ABS_SRCS),) +$(error $(MODULE_MK): nothing to compile in SRCS) +endif + +# +# Object files we will generate from sources +# +OBJS := $(foreach src,$(ABS_SRCS),$(MODULE_WORK_DIR)$(src).o) + +# +# SRCS -> OBJS rules +# + +$(OBJS): $(GLOBAL_DEPS) + +$(filter %.c.o,$(OBJS)): $(MODULE_WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) + $(call COMPILE,$<,$@) + +$(filter %.cpp.o,$(OBJS)): $(MODULE_WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) + $(call COMPILEXX,$<,$@) + +$(filter %.S.o,$(OBJS)): $(MODULE_WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) + $(call ASSEMBLE,$<,$@) + +# +# Built product rules +# + +$(MODULE_OBJ): $(OBJS) $(GLOBAL_DEPS) + $(call PRELINK,$@,$(OBJS)) + +# +# Utility rules +# + +clean: + $(Q) $(REMOVE) $(MODULE_PRELINK) $(OBJS) diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk index cdbd6e0afc..bd2b980845 100644 --- a/makefiles/nuttx.mk +++ b/makefiles/nuttx.mk @@ -6,7 +6,7 @@ # # Check that the NuttX archive for the selected board is available. # -NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(BOARD).export) +NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)$(BOARD).export) ifeq ($(NUTTX_ARCHIVE),) $(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) endif @@ -16,23 +16,27 @@ endif # if it changes, everything should be rebuilt. So, use it as the trigger to # unpack the NuttX archive. # -NUTTX_EXPORT_DIR = $(WORK_DIR)/nuttx-export -NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)/include/nuttx/config.h +NUTTX_EXPORT_DIR = $(WORK_DIR)nuttx-export/ +NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)include/nuttx/config.h +$(info NUTTX_EXPORT_DIR $(NUTTX_EXPORT_DIR)) +$(info NUTTX_CONFIG_HEADER $(NUTTX_CONFIG_HEADER)) + + GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) # # Use the linker script from the NuttX export # -LDSCRIPT = $(NUTTX_EXPORT_DIR)/build/ld.script +LDSCRIPT = $(NUTTX_EXPORT_DIR)build/ld.script # # Add directories from the NuttX export to the relevant search paths # -INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)/include -LIB_DIRS += $(NUTTX_EXPORT_DIR)/libs +INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include +LIB_DIRS += $(NUTTX_EXPORT_DIR)libs LIBS += -lapps -lnuttx -LINK_DEPS += $(NUTTX_EXPORT_DIR)/libs/libapps.a \ - $(NUTTX_EXPORT_DIR)/libs/libnuttx.a +LINK_DEPS += $(NUTTX_EXPORT_DIR)libs/libapps.a \ + $(NUTTX_EXPORT_DIR)libs/libnuttx.a $(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) @echo %% Unpacking $(NUTTX_ARCHIVE) diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 0c142cb1d6..d4b279e7c4 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -5,16 +5,20 @@ # # Some useful paths. # -export PX4_APP_SRC = $(PX4_BASE)/src/apps -export PX4_LIB_SRC = $(PX4_BASE)/src/libs -export PX4_MK_DIR = $(PX4_BASE)/makefiles -export NUTTX_SRC = $(PX4_BASE)/nuttx -export NUTTX_APP_SRC = $(PX4_BASE)/apps -export MAVLINK_SRC = $(PX4_BASE)/mavlink -export ROMFS_SRC = $(PX4_BASE)/ROMFS -export IMAGE_DIR = $(PX4_BASE)/Images -export BUILD_DIR = $(PX4_BASE)/Build -export ARCHIVE_DIR = $(PX4_BASE)/Archives +# Note that in general we always keep directory paths with the separator +# at the end, and join paths without explicit separators. This reduces +# the number of duplicate slashes we have lying around in paths, +# and is consistent with joining the results of $(dir) and $(notdir). +# +export PX4_MODULE_SRC = $(abspath $(PX4_BASE)/src/modules)/ +export PX4_MK_DIR = $(abspath $(PX4_BASE)/makefiles)/ +export NUTTX_SRC = $(abspath $(PX4_BASE)/nuttx)/ +export NUTTX_APP_SRC = $(abspath $(PX4_BASE)/apps)/ +export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink)/ +export ROMFS_SRC = $(abspath $(PX4_BASE)/ROMFS)/ +export IMAGE_DIR = $(abspath $(PX4_BASE)/Images)/ +export BUILD_DIR = $(abspath $(PX4_BASE)/Build)/ +export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/ # # Tools diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index ba3b06c7f3..0a1ee18e94 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -2,7 +2,7 @@ # Definitions for a generic GNU ARM-EABI toolchain # -$(info %% TOOLCHAIN gnu-arm-eabi) +#$(info TOOLCHAIN gnu-arm-eabi) CROSSDEV = arm-none-eabi- @@ -134,7 +134,8 @@ DEP_INCLUDES = $(subst .o,.d,$(OBJS)) # compile C source $1 to object $2 # as a side-effect, generate a dependency file define COMPILE - @echo "CC: $1" + @echo "CC <- $1" + @echo "CC -> $2" @mkdir -p $(dir $2) $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 endef @@ -172,7 +173,7 @@ endef define LINK @echo "LINK: $1" @mkdir -p $(dir $1) - $(Q) $(LD) $(LDFLAGS) -o $1 $2 --start-group $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group + $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group endef # convert $1 from a linked object to a raw binary diff --git a/src/apps/test/app.mk b/src/apps/test/app.mk deleted file mode 100644 index 283425c504..0000000000 --- a/src/apps/test/app.mk +++ /dev/null @@ -1,4 +0,0 @@ - -APP_NAME = test -SRCS = foo.c - diff --git a/src/apps/test/foo.c b/src/modules/test/foo.c similarity index 100% rename from src/apps/test/foo.c rename to src/modules/test/foo.c diff --git a/src/modules/test/module.mk b/src/modules/test/module.mk new file mode 100644 index 0000000000..abf80eedf7 --- /dev/null +++ b/src/modules/test/module.mk @@ -0,0 +1,4 @@ + +MODULE_NAME = test +SRCS = foo.c + From 6b215be739528eb20b50247a0a095d27092b3be4 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 14:33:53 -0800 Subject: [PATCH 021/129] Use indirect calls for all commands (echo, make, etc.) Replace our dependency on xxd with a toolchain call, and implement the backend using objcopy evil for the default toolchain. --- makefiles/firmware.mk | 54 ++++++++++++------------- makefiles/module.mk | 6 +-- makefiles/nuttx.mk | 8 ++-- makefiles/setup.mk | 4 ++ makefiles/toolchain_gnu-arm-eabi.mk | 61 ++++++++++++++++++++--------- src/modules/test/foo.c | 4 ++ 6 files changed, 85 insertions(+), 52 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 1b6a1cdef5..23fd3136fa 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -172,10 +172,10 @@ MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module $(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) $(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) $(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) - @echo %% - @echo %% Building module using $(mkfile) - @echo %% - $(Q) make -f $(PX4_MK_DIR)module.mk \ + @$(ECHO) %% + @$(ECHO) %% Building module using $(mkfile) + @$(ECHO) %% + $(Q) $(MAKE) -f $(PX4_MK_DIR)module.mk \ MODULE_WORK_DIR=$(dir $@) \ MODULE_OBJ=$@ \ MODULE_MK=$(mkfile) \ @@ -189,8 +189,8 @@ MODULE_CLEANS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)/cle $(MODULE_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) $(MODULE_CLEANS): mkfile = $(patsubst %clean,%module.mk,$(relpath)) $(MODULE_CLEANS): - @echo %% cleaning using $(mkfile) - $(Q) make -f $(PX4_MK_DIR)module.mk \ + @$(ECHO) %% cleaning using $(mkfile) + $(Q) $(MAKE) -f $(PX4_MK_DIR)module.mk \ MODULE_WORK_DIR=$(dir $@) \ MODULE_MK=$(mkfile) \ clean @@ -210,6 +210,8 @@ include $(PX4_MK_DIR)/nuttx.mk # NuttX export library. Instead, we have to treat it like a library. # ifneq ($(ROMFS_ROOT),) + +# Add dependencies on anything in the ROMFS root ROMFS_DEPS += $(wildcard \ (ROMFS_ROOT)/* \ (ROMFS_ROOT)/*/* \ @@ -223,15 +225,13 @@ ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) LIBS += $(ROMFS_OBJ) LINK_DEPS += $(ROMFS_OBJ) -$(ROMFS_OBJ): $(ROMFS_CSRC) - $(Q) $(call COMPILE,$<,$@) - -$(ROMFS_CSRC): $(ROMFS_IMG) - @echo %% generating $@ - $(Q) (cd $(dir $<) && xxd -i $(notdir $<)) > $@ +# Turn the ROMFS image into an object file +$(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS) + $(call BIN_TO_OBJ,$<,$@,romfs_img) +# Generate the ROMFS image from the root $(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS) - @echo %% generating $@ + @$(ECHO) %% generating $@ $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" endif @@ -264,25 +264,25 @@ BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_com # (BUILTIN_PROTO,,) define BUILTIN_PROTO - echo 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; + $(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; endef # (BUILTIN_DEF,,) define BUILTIN_DEF - echo ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; + $(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; endef $(BUILTIN_CSRC): $(GLOBAL_DEPS) - @echo %% generating $@ - $(Q) echo '/* builtin command list - automatically generated, do not edit */' > $@ - $(Q) echo '#include ' >> $@ - $(Q) echo '#include ' >> $@ + @$(ECHO) %% generating $@ + $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ + $(Q) $(ECHO) '#include ' >> $@ + $(Q) $(ECHO) '#include ' >> $@ $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) - $(Q) echo 'const struct builtin_s g_builtins[] = {' >> $@ + $(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@ $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) - $(Q) echo ' {NULL, 0, 0, NULL}' >> $@ - $(Q) echo '};' >> $@ - $(Q) echo 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ + $(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@ + $(Q) $(ECHO) '};' >> $@ + $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ BUILTIN_OBJ = $(BUILTIN_CSRC:.c=.o) LIBS += $(BUILTIN_OBJ) @@ -302,7 +302,7 @@ $(BUILTIN_OBJ): $(BUILTIN_CSRC) ifeq ($(SRCS),) EMPTY_SRC = $(WORK_DIR)empty.c $(EMPTY_SRC): - $(Q) echo '/* this is an empty file */' > $@ + $(Q) $(ECHO) '/* this is an empty file */' > $@ SRCS += $(EMPTY_SRC) endif @@ -346,7 +346,7 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) # $(PRODUCT_BUNDLE): $(PRODUCT_BIN) - @echo %% Generating $@ + @$(ECHO) %% Generating $@ $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \ --git_identity $(PX4_BASE) \ --image $< > $@ @@ -363,7 +363,7 @@ $(PRODUCT_SYM): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKF .PHONY: upload upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) - $(Q) make -f $(PX4_MK_DIR)/upload.mk \ + $(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \ METHOD=serial \ PRODUCT=$(PRODUCT) \ BUNDLE=$(PRODUCT_BUNDLE) \ @@ -371,7 +371,7 @@ upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) .PHONY: clean clean: $(MODULE_CLEANS) - @echo %% cleaning + @$(ECHO) %% cleaning $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) diff --git a/makefiles/module.mk b/makefiles/module.mk index 306a9594f4..bf54362e65 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -100,9 +100,9 @@ MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODU .PHONY: $(MODULE_COMMAND_FILES) $(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) - @echo COMMAND $(word 2,$(subst ., ,$(notdir $(@)))) - @mkdir -p $@ - $(Q) touch $@ + @$(ECHO) COMMAND $(word 2,$(subst ., ,$(notdir $(@)))) + @$(MKDIR) -p $(dir $@) + $(Q) $(TOUCH) $@ endif ################################################################################ diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk index bd2b980845..e71993916a 100644 --- a/makefiles/nuttx.mk +++ b/makefiles/nuttx.mk @@ -27,7 +27,7 @@ GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) # # Use the linker script from the NuttX export # -LDSCRIPT = $(NUTTX_EXPORT_DIR)build/ld.script +LDSCRIPT += $(NUTTX_EXPORT_DIR)build/ld.script # # Add directories from the NuttX export to the relevant search paths @@ -39,6 +39,6 @@ LINK_DEPS += $(NUTTX_EXPORT_DIR)libs/libapps.a \ $(NUTTX_EXPORT_DIR)libs/libnuttx.a $(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) - @echo %% Unpacking $(NUTTX_ARCHIVE) - $(Q) unzip -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) - $(Q) touch $@ + @$(ECHO) %% Unpacking $(NUTTX_ARCHIVE) + $(Q) $(UNZIP) -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) $(TOUCH) $@ diff --git a/makefiles/setup.mk b/makefiles/setup.mk index d4b279e7c4..f67ab7bb0f 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -29,6 +29,10 @@ COPY = cp REMOVE = rm -f RMDIR = rm -rf GENROMFS = genromfs +TOUCH = touch +MKDIR = mkdir +ECHO = echo +UNZIP = unzip # # Host-specific paths, hacks and fixups diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 0a1ee18e94..1084767821 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -119,7 +119,7 @@ AFLAGS = $(CFLAGS) -D__ASSEMBLY__ LDFLAGS += --warn-common \ --gc-sections \ - -T $(LDSCRIPT) \ + $(addprefix -T,$(LDSCRIPT)) \ $(addprefix -L,$(LIB_DIRS)) LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) @@ -134,51 +134,76 @@ DEP_INCLUDES = $(subst .o,.d,$(OBJS)) # compile C source $1 to object $2 # as a side-effect, generate a dependency file define COMPILE - @echo "CC <- $1" - @echo "CC -> $2" - @mkdir -p $(dir $2) + @$(ECHO) "CC <- $1" + @$(ECHO) "CC -> $2" + @$(MKDIR) -p $(dir $2) $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 endef # compile C++ source $1 to $2 # as a side-effect, generate a dependency file define COMPILEXX - @echo "CXX: $1" - @mkdir -p $(dir $2) + @$(ECHO) "CXX: $1" + @$(MKDIR) -p $(dir $2) $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 endef # assemble $1 into $2 define ASSEMBLE - @echo "AS: $1" - @mkdir -p $(dir $2) + @$(ECHO) "AS: $1" + @$(MKDIR) -p $(dir $2) $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 endef # produce partially-linked $1 from files in $2 define PRELINK - @echo "PRELINK: $1" - @mkdir -p $(dir $1) + @$(ECHO) "PRELINK: $1" + @$(MKDIR) -p $(dir $1) $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 endef # update the archive $1 with the files in $2 define ARCHIVE - @echo "AR: $2" - @mkdir -p $(dir $1) + @$(ECHO) "AR: $2" + @$(MKDIR) -p $(dir $1) $(Q) $(AR) $1 $2 endef -# Link the objects in $2 into the binary $1 +# link the objects in $2 into the binary $1 define LINK - @echo "LINK: $1" - @mkdir -p $(dir $1) + @$(ECHO) "LINK: $1" + @$(MKDIR) -p $(dir $1) $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group endef -# convert $1 from a linked object to a raw binary +# convert $1 from a linked object to a raw binary in $2 define SYM_TO_BIN - @echo "BIN: $2" - @mkdir -p $(dir $2) + @$(ECHO) "BIN: $2" + @$(MKDIR) -p $(dir $2) $(Q) $(OBJCOPY) -O binary $1 $2 endef + +# Take the raw binary $1 and make it into an object file $2. +# The symbol $3 points to the beginning of the file, and $3_len +# gives its length. +# +# - compile an empty file to generate a suitable object file +# - relink the object and insert the binary file +# - edit symbol names to suit +# +define BIN_SYM_PREFIX + _binary_$(subst /,_,$(subst .,_,$1)) +endef +define BIN_TO_OBJ + @$(ECHO) "WRAP: $2" + @$(MKDIR) -p $(dir $2) + $(Q) $(ECHO) > $2.c + $(call COMPILE,$2.c,$2.c.o) + $(LD) -r -o $2 $2.c.o -b binary $1 + $(OBJCOPY) $2 \ + --redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \ + --redefine-sym $(call BIN_SYM_PREFIX,$1)_size=$3_len \ + --strip-symbol $(call BIN_SYM_PREFIX,$1)_end +endef + +# $(Q) $(OBJCOPY) --add-section .rodata.$3=$1 $2 diff --git a/src/modules/test/foo.c b/src/modules/test/foo.c index e69de29bb2..ff6af031f7 100644 --- a/src/modules/test/foo.c +++ b/src/modules/test/foo.c @@ -0,0 +1,4 @@ +int test_main(void) +{ + return 0; +} \ No newline at end of file From cde70da262bd8c48057024f952255ff8d9882e55 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 14:43:12 -0800 Subject: [PATCH 022/129] We don't have to get fancy with builtin_commands.c now, since we put all of the object files into the link loop (ordering is less important now) --- makefiles/firmware.mk | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 23fd3136fa..6eada63532 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -205,10 +205,6 @@ include $(PX4_MK_DIR)/nuttx.mk # ROMFS generation ################################################################################ -# -# Note that we can't just put romfs.c in SRCS, as it's depended on by the -# NuttX export library. Instead, we have to treat it like a library. -# ifneq ($(ROMFS_ROOT),) # Add dependencies on anything in the ROMFS root @@ -240,9 +236,6 @@ endif # Builtin command list generation ################################################################################ -# -# Note that we can't just put builtin_commands.c in SRCS, as it's depended on by the -# NuttX export library. Instead, we have to treat it like a library. # # Builtin commands can be generated by the configuration, in which case they # must refer to commands that already exist, or indirectly generated by modules @@ -256,12 +249,13 @@ endif # period. These fields are the command's name, its thread priority, its stack size # and the name of the function to call when starting the thread. # -# BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c # add command definitions from modules BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) +ifneq ($(BUILTIN_COMMANDS),) + # (BUILTIN_PROTO,,) define BUILTIN_PROTO $(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; @@ -284,12 +278,9 @@ $(BUILTIN_CSRC): $(GLOBAL_DEPS) $(Q) $(ECHO) '};' >> $@ $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ -BUILTIN_OBJ = $(BUILTIN_CSRC:.c=.o) -LIBS += $(BUILTIN_OBJ) -LINK_DEPS += $(BUILTIN_OBJ) +SRCS += $(BUILTIN_CSRC) -$(BUILTIN_OBJ): $(BUILTIN_CSRC) - $(Q) $(call COMPILE,$<,$@) +endif ################################################################################ # Default SRCS generation From ddc405935e006569241be6a4aa02d4a6d6d5c56e Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 15:11:57 -0800 Subject: [PATCH 023/129] Cosmetic tweaks to variable output. Comment on the need to retain the double-slash at the WORK_DIR boundary. More toolchain documentation. --- makefiles/firmware.mk | 19 ++++--- makefiles/module.mk | 15 ++++-- makefiles/nuttx.mk | 4 +- makefiles/setup.mk | 1 - makefiles/toolchain_gnu-arm-eabi.mk | 84 ++++++++++++++++++----------- 5 files changed, 79 insertions(+), 44 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 6eada63532..12fc209263 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -65,7 +65,7 @@ MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(MK_DIR)/..) endif -$(info PX4_BASE $(PX4_BASE)) +$(info % PX4_BASE = $(PX4_BASE)) # # Set a default target so that included makefiles or errors here don't @@ -93,7 +93,7 @@ $(error Can't find a config file called $(CONFIG) or $(PX4_MK_DIR)/config_$(CONF endif export CONFIG include $(CONFIG_FILE) -$(info CONFIG $(CONFIG)) +$(info % CONFIG = $(CONFIG)) # # Sanity-check the BOARD variable and then get the board config. @@ -110,7 +110,7 @@ $(error Config $(CONFIG) references board $(BOARD), but no board definition file endif export BOARD include $(BOARD_FILE) -$(info BOARD $(BOARD)) +$(info % BOARD = $(BOARD)) # # If WORK_DIR is not set, create a 'build' directory next to the @@ -120,7 +120,7 @@ PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEF ifeq ($(WORK_DIR),) export WORK_DIR := $(dir $(PARENT_MAKEFILE))build/ endif -$(info WORK_DIR $(WORK_DIR)) +$(info % WORK_DIR = $(WORK_DIR)) # # Things that, if they change, might affect everything @@ -164,7 +164,10 @@ ifneq ($(MISSING_MODULES),) $(error Can't find module(s): $(MISSING_MODULES)) endif -# make a list of the object files we expect to build from modules +# Make a list of the object files we expect to build from modules +# Note that this path will typically contain a double-slash at the WORK_DIR boundary; this must be +# preserved as it is used below to get the absolute path for the module.mk file correct. +# MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module.pre.o) # rules to build module objects @@ -252,7 +255,8 @@ endif BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c # add command definitions from modules -BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) +BUILTIN_COMMAND_FILES := $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*) +BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(BUILTIN_COMMAND_FILES))) ifneq ($(BUILTIN_COMMANDS),) @@ -266,7 +270,8 @@ define BUILTIN_DEF $(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; endef -$(BUILTIN_CSRC): $(GLOBAL_DEPS) +# Don't generate until modules have updated their command files +$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(BUILTIN_COMMAND_FILES) @$(ECHO) %% generating $@ $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ $(Q) $(ECHO) '#include ' >> $@ diff --git a/makefiles/module.mk b/makefiles/module.mk index bf54362e65..c6ef90578d 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -59,7 +59,7 @@ ifeq ($(MODULE_MK),) $(error No module makefile specified) endif -$(info MODULE_MK $(MODULE_MK)) +$(info % MODULE_MK = $(MODULE_MK)) # # Get path and tool config @@ -76,8 +76,9 @@ include $(PX4_MK_DIR)/board_$(BOARD).mk # include $(MODULE_MK) MODULE_SRC := $(dir $(MODULE_MK)) -$(info MODULE_SRC $(MODULE_SRC)) -$(info MODULE_WORK_DIR $(MODULE_WORK_DIR)) +$(info % MODULE_SRC = $(MODULE_SRC)) +$(info % MODULE_OBJ = $(MODULE_OBJ)) +$(info % MODULE_WORK_DIR = $(MODULE_WORK_DIR)) # # Things that, if they change, might affect everything @@ -98,9 +99,15 @@ endif ifneq ($(MODULE_COMMANDS),) MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODULE_COMMANDS)) +# Create the command files +# Ensure that there is only one entry for each command +# .PHONY: $(MODULE_COMMAND_FILES) +$(MODULE_COMMAND_FILES): command = $(word 2,$(subst ., ,$(notdir $(@)))) +$(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).* $(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) - @$(ECHO) COMMAND $(word 2,$(subst ., ,$(notdir $(@)))) + @$(ECHO) COMMAND: $(command) + @$(REMOVE) -f $(exclude) @$(MKDIR) -p $(dir $@) $(Q) $(TOUCH) $@ endif diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk index e71993916a..f21ba9edaa 100644 --- a/makefiles/nuttx.mk +++ b/makefiles/nuttx.mk @@ -18,8 +18,8 @@ endif # NUTTX_EXPORT_DIR = $(WORK_DIR)nuttx-export/ NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)include/nuttx/config.h -$(info NUTTX_EXPORT_DIR $(NUTTX_EXPORT_DIR)) -$(info NUTTX_CONFIG_HEADER $(NUTTX_CONFIG_HEADER)) +$(info % NUTTX_EXPORT_DIR = $(NUTTX_EXPORT_DIR)) +$(info % NUTTX_CONFIG_HEADER = $(NUTTX_CONFIG_HEADER)) GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) diff --git a/makefiles/setup.mk b/makefiles/setup.mk index f67ab7bb0f..e9e591cd7b 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -48,4 +48,3 @@ endif # Makefile debugging. # export Q := $(if $(V),,@) - diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 1084767821..ac53b03695 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -4,6 +4,8 @@ #$(info TOOLCHAIN gnu-arm-eabi) +# Toolchain commands. Normally only used inside this file. +# CROSSDEV = arm-none-eabi- CC = $(CROSSDEV)gcc @@ -19,7 +21,8 @@ OBJDUMP = $(CROSSDEV)objdump MAXOPTIMIZATION = -O3 -# base CPU flags +# Base CPU flags for each of the supported architectures. +# ARCHCPUFLAGS_CORTEXM4F = -mcpu=cortex-m4 \ -mthumb \ -march=armv7e-m \ @@ -36,12 +39,15 @@ ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ -march=armv7-m \ -mfloat-abi=soft +# Pick the right set of flags for the architecture. +# ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) ifeq ($(ARCHCPUFLAGS),) $(error Must set CONFIG_ARCH to one of CORTEXM4F, CORTEXM4 or CORTEXM3) endif # optimisation flags +# ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ -g \ -fno-strict-aliasing \ @@ -56,9 +62,13 @@ ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ # note - requires corresponding support in NuttX INSTRUMENTATIONDEFINES = -finstrument-functions \ -ffixed-r10 - +# Language-specific flags +# ARCHCFLAGS = -std=gnu99 ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x + +# Generic warnings +# ARCHWARNINGS = -Wall \ -Wextra \ -Wdouble-promotion \ @@ -74,6 +84,8 @@ ARCHWARNINGS = -Wall \ # -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code # -Wcast-align - would help catch bad casts in some cases, but generates too many false positives +# C-specific warnings +# ARCHCWARNINGS = $(ARCHWARNINGS) \ -Wbad-function-cast \ -Wstrict-prototypes \ @@ -82,12 +94,17 @@ ARCHCWARNINGS = $(ARCHWARNINGS) \ -Wmissing-prototypes \ -Wnested-externs \ -Wunsuffixed-float-constants + +# C++-specific warnings +# ARCHWARNINGSXX = $(ARCHWARNINGS) # pull in *just* libm from the toolchain ... this is grody LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) EXTRA_LIBS += $(LIBM) +# Flags we pass to the C compiler +# CFLAGS = $(ARCHCFLAGS) \ $(ARCHCWARNINGS) \ $(ARCHOPTIMIZATION) \ @@ -99,6 +116,8 @@ CFLAGS = $(ARCHCFLAGS) \ -fno-common \ $(addprefix -I,$(INCLUDE_DIRS)) +# Flags we pass to the C++ compiler +# CXXFLAGS = $(ARCHCXXFLAGS) \ $(ARCHWARNINGSXX) \ $(ARCHOPTIMIZATION) \ @@ -109,76 +128,83 @@ CXXFLAGS = $(ARCHCXXFLAGS) \ $(EXTRADEFINES) \ $(addprefix -I,$(INCLUDE_DIRS)) -CPPFLAGS = $(ARCHINCLUDES) \ - $(INSTRUMENTATIONDEFINES) \ - $(ARCHDEFINES) \ - $(EXTRADEFINES) \ - $(addprefix -I,$(INCLUDE_DIRS)) - +# Flags we pass to the assembler +# AFLAGS = $(CFLAGS) -D__ASSEMBLY__ +# Flags we pass to the linker +# LDFLAGS += --warn-common \ --gc-sections \ $(addprefix -T,$(LDSCRIPT)) \ $(addprefix -L,$(LIB_DIRS)) +# Compiler support library +# LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) -# files that the final link depends on -# XXX add libraries that we know about here... +# Files that the final link depends on +# LINK_DEPS += $(LDSCRIPT) -# files to include to get automated dependencies +# Files to include to get automated dependencies +# DEP_INCLUDES = $(subst .o,.d,$(OBJS)) -# compile C source $1 to object $2 +# Compile C source $1 to object $2 # as a side-effect, generate a dependency file +# define COMPILE - @$(ECHO) "CC <- $1" - @$(ECHO) "CC -> $2" + @$(ECHO) "CC: $1" @$(MKDIR) -p $(dir $2) $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 endef -# compile C++ source $1 to $2 +# Compile C++ source $1 to $2 # as a side-effect, generate a dependency file +# define COMPILEXX - @$(ECHO) "CXX: $1" + @$(ECHO) "CXX: $1" @$(MKDIR) -p $(dir $2) $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 endef -# assemble $1 into $2 +# Assemble $1 into $2 +# define ASSEMBLE - @$(ECHO) "AS: $1" + @$(ECHO) "AS: $1" @$(MKDIR) -p $(dir $2) $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 endef -# produce partially-linked $1 from files in $2 +# Produce partially-linked $1 from files in $2 +# define PRELINK @$(ECHO) "PRELINK: $1" @$(MKDIR) -p $(dir $1) $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 endef -# update the archive $1 with the files in $2 +# Update the archive $1 with the files in $2 +# define ARCHIVE - @$(ECHO) "AR: $2" + @$(ECHO) "AR: $2" @$(MKDIR) -p $(dir $1) $(Q) $(AR) $1 $2 endef -# link the objects in $2 into the binary $1 +# Link the objects in $2 into the binary $1 +# define LINK - @$(ECHO) "LINK: $1" + @$(ECHO) "LINK: $1" @$(MKDIR) -p $(dir $1) $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group endef -# convert $1 from a linked object to a raw binary in $2 +# Convert $1 from a linked object to a raw binary in $2 +# define SYM_TO_BIN - @$(ECHO) "BIN: $2" + @$(ECHO) "BIN: $2" @$(MKDIR) -p $(dir $2) $(Q) $(OBJCOPY) -O binary $1 $2 endef @@ -195,15 +221,13 @@ define BIN_SYM_PREFIX _binary_$(subst /,_,$(subst .,_,$1)) endef define BIN_TO_OBJ - @$(ECHO) "WRAP: $2" + @$(ECHO) "OBJ: $2" @$(MKDIR) -p $(dir $2) $(Q) $(ECHO) > $2.c $(call COMPILE,$2.c,$2.c.o) - $(LD) -r -o $2 $2.c.o -b binary $1 - $(OBJCOPY) $2 \ + $(Q) $(LD) -r -o $2 $2.c.o -b binary $1 + $(Q) $(OBJCOPY) $2 \ --redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \ --redefine-sym $(call BIN_SYM_PREFIX,$1)_size=$3_len \ --strip-symbol $(call BIN_SYM_PREFIX,$1)_end endef - -# $(Q) $(OBJCOPY) --add-section .rodata.$3=$1 $2 From b6218794c6b1d859791431535548ad8f74a6bfbb Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 16:05:59 -0800 Subject: [PATCH 024/129] Stick copyrights on the major moving parts of the build system --- Makefile | 31 +++++++++++++++++++++++++++++ makefiles/firmware.mk | 31 +++++++++++++++++++++++++++++ makefiles/module.mk | 31 +++++++++++++++++++++++++++++ makefiles/nuttx.mk | 31 +++++++++++++++++++++++++++++ makefiles/setup.mk | 31 +++++++++++++++++++++++++++++ makefiles/toolchain_gnu-arm-eabi.mk | 31 +++++++++++++++++++++++++++++ 6 files changed, 186 insertions(+) diff --git a/Makefile b/Makefile index b113040d06..8f9e81dce2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Top-level Makefile for building PX4 firmware images. # diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 12fc209263..d78c95d963 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Generic Makefile for PX4 firmware images. # diff --git a/makefiles/module.mk b/makefiles/module.mk index c6ef90578d..4f7b8def4e 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Framework makefile for PX4 modules # diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk index f21ba9edaa..c6e2c86d1b 100644 --- a/makefiles/nuttx.mk +++ b/makefiles/nuttx.mk @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Rules and definitions related to handling the NuttX export archives when # building firmware. diff --git a/makefiles/setup.mk b/makefiles/setup.mk index e9e591cd7b..8e7a00ef4c 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Path and tool setup # diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index ac53b03695..d214006bef 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -1,3 +1,34 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + # # Definitions for a generic GNU ARM-EABI toolchain # From f7b14b2e23113093d1f76565041b91f22be79246 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 23 Feb 2013 22:00:23 -0800 Subject: [PATCH 025/129] Add builtin command defintions for the commands currently in the NuttX export archive. --- makefiles/config_px4fmu_default.mk | 59 ++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 6ab0d855df..a6d766511c 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -8,13 +8,58 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) # -# Add commands from the NuttX export archive. +# Transitional support - add commands from the NuttX export archive. # -# Each entry here is ... +# In general, these should move to modules over time. # -BUILTIN_COMMANDS = perf.SCHED_PRIORITY_DEFAULT.CONFIG_PTHREAD_STACK_DEFAULT.perf_main +# 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 -# -# Build the test module -# -MODULES = test +# command priority stack entrypoint +BUILTIN_COMMANDS := \ + $(call _B, adc, , 2048, adc_main ) \ + $(call _B, ardrone_interface, SCHED_PRIORITY_MAX-15, 2048, ardrone_interface_main ) \ + $(call _B, attitude_estimator_ekf, , 2048, attitude_estimator_ekf_main) \ + $(call _B, bl_update, , 4096, bl_update_main ) \ + $(call _B, blinkm, , 2048, blinkm_main ) \ + $(call _B, bma180, , 2048, bma180_main ) \ + $(call _B, boardinfo, , 2048, boardinfo_main ) \ + $(call _B, commander, SCHED_PRIORITY_MAX-30, 2048, commander_main ) \ + $(call _B, control_demo, , 2048, control_demo_main ) \ + $(call _B, delay_test, , 2048, delay_test_main ) \ + $(call _B, eeprom, , 4096, eeprom_main ) \ + $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ + $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ + $(call _B, fmu, , 2048, fmu_main ) \ + $(call _B, gps, , 2048, gps_main ) \ + $(call _B, hil, , 2048, hil_main ) \ + $(call _B, hmc5883, , 4096, hmc5883_main ) \ + $(call _B, hott_telemetry, , 2048, hott_telemetry_main ) \ + $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ + $(call _B, l3gd20, , 2048, l3gd20_main ) \ + $(call _B, math_demo, , 8192, math_demo_main ) \ + $(call _B, mavlink, , 2048, mavlink_main ) \ + $(call _B, mavlink_onboard, , 2048, mavlink_onboard_main ) \ + $(call _B, mixer, , 4096, mixer_main ) \ + $(call _B, mpu6000, , 4096, mpu6000_main ) \ + $(call _B, ms5611, , 2048, ms5611_main ) \ + $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ + $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ + $(call _B, param, , 4096, param_main ) \ + $(call _B, perf, , 2048, perf_main ) \ + $(call _B, position_estimator, , 4096, position_estimator_main ) \ + $(call _B, preflight_check, , 2048, preflight_check_main ) \ + $(call _B, px4io, , 2048, px4io_main ) \ + $(call _B, reboot, , 2048, reboot_main ) \ + $(call _B, sdlog, SCHED_PRIORITY_MAX-30, 2048, sdlog_main ) \ + $(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \ + $(call _B, sercon, , 2048, sercon_main ) \ + $(call _B, serdis, , 2048, serdis_main ) \ + $(call _B, tests, , 12000, tests_main ) \ + $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ + $(call _B, top, SCHED_PRIORITY_DEFAULT-10, 3000, top_main ) \ + $(call _B, uorb, , 4096, uorb_main ) From fc82ed0c693635ccfaeee4f060b93b1a1c083acb Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Wed, 20 Mar 2013 13:21:00 +0100 Subject: [PATCH 026/129] Skeleton code. --- apps/drivers/ets/Makefile | 42 ++ apps/drivers/ets/ets_airspeed.cpp | 784 ++++++++++++++++++++++++++++++ 2 files changed, 826 insertions(+) create mode 100644 apps/drivers/ets/Makefile create mode 100644 apps/drivers/ets/ets_airspeed.cpp diff --git a/apps/drivers/ets/Makefile b/apps/drivers/ets/Makefile new file mode 100644 index 0000000000..9089d97af2 --- /dev/null +++ b/apps/drivers/ets/Makefile @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (C) 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# Makefile to build the Eagle Tree Airspeed V3 driver. +# + +APPNAME = ets_airspeed +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/ets/ets_airspeed.cpp b/apps/drivers/ets/ets_airspeed.cpp new file mode 100644 index 0000000000..4ac707c3cb --- /dev/null +++ b/apps/drivers/ets/ets_airspeed.cpp @@ -0,0 +1,784 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file airspeed.cpp + * @author Simon Wilks + * + * Driver for the Eagle Tree Airspeed V3 connected via I2C. + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include + +#include +#include + + +/* Configuration Constants */ +#define ETS_BUS PX4_I2C_BUS_EXPANSION +#define ETS_BASEADDR 0x70 /* 7-bit address. 8-bit address is 0xEA */ + +/* ETS Registers addresses */ + +#define ETS_READ_CMD 0x07 /* Read the data */ + +#define ETS_CONVERSION_INTERVAL 60000 /* 60ms */ + +/* oddly, ERROR is not defined for c++ */ +#ifdef ERROR +# undef ERROR +#endif +static const int ERROR = -1; + +#ifndef CONFIG_SCHED_WORKQUEUE +# error This requires CONFIG_SCHED_WORKQUEUE. +#endif + +class ETS : public device::I2C +{ +public: + ETS(int bus = ETS_BUS, int address = ETS_BASEADDR); + virtual ~ETS(); + + virtual int init(); + + virtual ssize_t read(struct file *filp, char *buffer, size_t buflen); + virtual int ioctl(struct file *filp, int cmd, unsigned long arg); + + /** + * Diagnostics - print some basic information about the driver. + */ + void print_info(); + +protected: + virtual int probe(); + +private: + work_s _work; + unsigned _num_reports; + volatile unsigned _next_report; + volatile unsigned _oldest_report; + range_finder_report *_reports; + bool _sensor_ok; + int _measure_ticks; + bool _collect_phase; + + orb_advert_t _differential_pressure_topic; + + perf_counter_t _sample_perf; + perf_counter_t _comms_errors; + perf_counter_t _buffer_overflows; + + /** + * Test whether the device supported by the driver is present at a + * specific address. + * + * @param address The I2C bus address to probe. + * @return True if the device is present. + */ + int probe_address(uint8_t address); + + /** + * Initialise the automatic measurement state machine and start it. + * + * @note This function is called at open and error time. It might make sense + * to make it more aggressive about resetting the bus in case of errors. + */ + void start(); + + /** + * Stop the automatic measurement state machine. + */ + void stop(); + + /** + * Perform a poll cycle; collect from the previous measurement + * and start a new one. + */ + void cycle(); + int measure(); + int collect(); + /** + * Static trampoline from the workq context; because we don't have a + * generic workq wrapper yet. + * + * @param arg Instance pointer for the driver that is polling. + */ + static void cycle_trampoline(void *arg); + + +}; + +/* helper macro for handling report buffer indices */ +#define INCREMENT(_x, _lim) do { _x++; if (_x >= _lim) _x = 0; } while(0) + +/* + * Driver 'main' command. + */ +extern "C" __EXPORT int ETS_main(int argc, char *argv[]); + +ETS::ETS(int bus, int address) : + I2C("ETS", AIRSPEED_SENSOR_DEVICE_PATH, bus, address, 100000), + _num_reports(0), + _next_report(0), + _oldest_report(0), + _reports(nullptr), + _sensor_ok(false), + _measure_ticks(0), + _collect_phase(false), + _differential_pressure_topic(-1), + _sample_perf(perf_alloc(PC_ELAPSED, "ETS_read")), + _comms_errors(perf_alloc(PC_COUNT, "ETS_comms_errors")), + _buffer_overflows(perf_alloc(PC_COUNT, "ETS_buffer_overflows")) +{ + // enable debug() calls + _debug_enabled = true; + + // work_cancel in the dtor will explode if we don't do this... + memset(&_work, 0, sizeof(_work)); +} + +ETS::~ETS() +{ + /* make sure we are truly inactive */ + stop(); + + /* free any existing reports */ + if (_reports != nullptr) + delete[] _reports; +} + +int +ETS::init() +{ + int ret = ERROR; + + /* do I2C init (and probe) first */ + if (I2C::init() != OK) + goto out; + + /* allocate basic report buffers */ + _num_reports = 2; + _reports = new struct range_finder_report[_num_reports]; + + if (_reports == nullptr) + goto out; + + _oldest_report = _next_report = 0; + + /* get a publish handle on the airspeed topic */ + memset(&_reports[0], 0, sizeof(_reports[0])); + _differential_pressure_topic = orb_advertise(ORB_ID(_differential_pressure), &_reports[0]); + + if (_differential_pressure_topic < 0) + debug("failed to create airspeed sensor object. Did you start uOrb?"); + + ret = OK; + /* sensor is ok, but we don't really know if it is within range */ + _sensor_ok = true; +out: + return ret; +} + +int +ETS::probe() +{ + return measure(); +} + +int +ETS::ioctl(struct file *filp, int cmd, unsigned long arg) +{ + switch (cmd) { + + case SENSORIOCSPOLLRATE: { + switch (arg) { + + /* switching to manual polling */ + case SENSOR_POLLRATE_MANUAL: + stop(); + _measure_ticks = 0; + return OK; + + /* external signalling (DRDY) not supported */ + case SENSOR_POLLRATE_EXTERNAL: + + /* zero would be bad */ + case 0: + return -EINVAL; + + /* set default/max polling rate */ + case SENSOR_POLLRATE_MAX: + case SENSOR_POLLRATE_DEFAULT: { + /* do we need to start internal polling? */ + bool want_start = (_measure_ticks == 0); + + /* set interval for next measurement to minimum legal value */ + _measure_ticks = USEC2TICK(ETS_CONVERSION_INTERVAL); + + /* if we need to start the poll state machine, do it */ + if (want_start) + start(); + + return OK; + } + + /* adjust to a legal polling interval in Hz */ + default: { + /* do we need to start internal polling? */ + bool want_start = (_measure_ticks == 0); + + /* convert hz to tick interval via microseconds */ + unsigned ticks = USEC2TICK(1000000 / arg); + + /* check against maximum rate */ + if (ticks < USEC2TICK(ETS_CONVERSION_INTERVAL)) + return -EINVAL; + + /* update interval for next measurement */ + _measure_ticks = ticks; + + /* if we need to start the poll state machine, do it */ + if (want_start) + start(); + + return OK; + } + } + } + + case SENSORIOCGPOLLRATE: + if (_measure_ticks == 0) + return SENSOR_POLLRATE_MANUAL; + + return (1000 / _measure_ticks); + + case SENSORIOCSQUEUEDEPTH: { + /* add one to account for the sentinel in the ring */ + arg++; + + /* lower bound is mandatory, upper bound is a sanity check */ + if ((arg < 2) || (arg > 100)) + return -EINVAL; + + /* allocate new buffer */ + struct range_finder_report *buf = new struct range_finder_report[arg]; + + if (nullptr == buf) + return -ENOMEM; + + /* reset the measurement state machine with the new buffer, free the old */ + stop(); + delete[] _reports; + _num_reports = arg; + _reports = buf; + start(); + + return OK; + } + + case SENSORIOCGQUEUEDEPTH: + return _num_reports - 1; + + case SENSORIOCRESET: + /* XXX implement this */ + return -EINVAL; + + default: + /* give it to the superclass */ + return I2C::ioctl(filp, cmd, arg); + } +} + +ssize_t +ETS::read(struct file *filp, char *buffer, size_t buflen) +{ + unsigned count = buflen / sizeof(struct range_finder_report); + int ret = 0; + + /* buffer must be large enough */ + if (count < 1) + return -ENOSPC; + + /* if automatic measurement is enabled */ + if (_measure_ticks > 0) { + + /* + * While there is space in the caller's buffer, and reports, copy them. + * Note that we may be pre-empted by the workq thread while we are doing this; + * we are careful to avoid racing with them. + */ + while (count--) { + if (_oldest_report != _next_report) { + memcpy(buffer, _reports + _oldest_report, sizeof(*_reports)); + ret += sizeof(_reports[0]); + INCREMENT(_oldest_report, _num_reports); + } + } + + /* if there was no data, warn the caller */ + return ret ? ret : -EAGAIN; + } + + /* manual measurement - run one conversion */ + /* XXX really it'd be nice to lock against other readers here */ + do { + _oldest_report = _next_report = 0; + + /* trigger a measurement */ + if (OK != measure()) { + ret = -EIO; + break; + } + + /* wait for it to complete */ + usleep(ETS_CONVERSION_INTERVAL); + + /* run the collection phase */ + if (OK != collect()) { + ret = -EIO; + break; + } + + /* state machine will have generated a report, copy it out */ + memcpy(buffer, _reports, sizeof(*_reports)); + ret = sizeof(*_reports); + + } while (0); + + return ret; +} + +int +ETS::measure() +{ + int ret; + + /* + * Send the command to begin a measurement. + */ + uint8_t cmd = ETS_READ_CMD; + ret = transfer(&cmd, 1, nullptr, 0); + + if (OK != ret) + { + perf_count(_comms_errors); + log("i2c::transfer returned %d", ret); + return ret; + } + ret = OK; + + return ret; +} + +int +ETS::collect() +{ + int ret = -EIO; + + /* read from the sensor */ + uint8_t val[2] = {0, 0}; + + perf_begin(_sample_perf); + + ret = transfer(nullptr, 0, &val[0], 2); + + if (ret < 0) + { + log("error reading from sensor: %d", ret); + return ret; + } + + uint16_t distance = val[0] << 8 | val[1]; + float si_units = (distance * 1.0f)/ 100.0f; /* cm to m */ + /* this should be fairly close to the end of the measurement, so the best approximation of the time */ + _reports[_next_report].timestamp = hrt_absolute_time(); + _reports[_next_report].distance = si_units; + _reports[_next_report].valid = si_units > get_minimum_distance() && si_units < get_maximum_distance() ? 1 : 0; + + /* publish it */ + orb_publish(ORB_ID(_differential_pressure), _differential_pressure_topic, &_reports[_next_report]); + + /* post a report to the ring - note, not locked */ + INCREMENT(_next_report, _num_reports); + + /* if we are running up against the oldest report, toss it */ + if (_next_report == _oldest_report) { + perf_count(_buffer_overflows); + INCREMENT(_oldest_report, _num_reports); + } + + /* notify anyone waiting for data */ + poll_notify(POLLIN); + + ret = OK; + +out: + perf_end(_sample_perf); + return ret; + + return ret; +} + +void +ETS::start() +{ + /* reset the report ring and state machine */ + _collect_phase = false; + _oldest_report = _next_report = 0; + + /* schedule a cycle to start things */ + work_queue(HPWORK, &_work, (worker_t)&ETS::cycle_trampoline, this, 1); + + /* notify about state change */ + struct subsystem_info_s info = { + true, + true, + true, + SUBSYSTEM_TYPE_DIFFPRESSURE}; + static orb_advert_t pub = -1; + + if (pub > 0) { + orb_publish(ORB_ID(subsystem_info), pub, &info); + } else { + pub = orb_advertise(ORB_ID(subsystem_info), &info); + } +} + +void +ETS::stop() +{ + work_cancel(HPWORK, &_work); +} + +void +ETS::cycle_trampoline(void *arg) +{ + ETS *dev = (ETS *)arg; + + dev->cycle(); +} + +void +ETS::cycle() +{ + /* collection phase? */ + if (_collect_phase) { + + /* perform collection */ + if (OK != collect()) { + log("collection error"); + /* restart the measurement state machine */ + start(); + return; + } + + /* next phase is measurement */ + _collect_phase = false; + + /* + * Is there a collect->measure gap? + */ + if (_measure_ticks > USEC2TICK(ETS_CONVERSION_INTERVAL)) { + + /* schedule a fresh cycle call when we are ready to measure again */ + work_queue(HPWORK, + &_work, + (worker_t)&ETS::cycle_trampoline, + this, + _measure_ticks - USEC2TICK(ETS_CONVERSION_INTERVAL)); + + return; + } + } + + /* measurement phase */ + if (OK != measure()) + log("measure error"); + + /* next phase is collection */ + _collect_phase = true; + + /* schedule a fresh cycle call when the measurement is done */ + work_queue(HPWORK, + &_work, + (worker_t)&ETS::cycle_trampoline, + this, + USEC2TICK(ETS_CONVERSION_INTERVAL)); +} + +void +ETS::print_info() +{ + perf_print_counter(_sample_perf); + perf_print_counter(_comms_errors); + perf_print_counter(_buffer_overflows); + printf("poll interval: %u ticks\n", _measure_ticks); + printf("report queue: %u (%u/%u @ %p)\n", + _num_reports, _oldest_report, _next_report, _reports); +} + +/** + * Local functions in support of the shell command. + */ +namespace ETS +{ + +/* oddly, ERROR is not defined for c++ */ +#ifdef ERROR +# undef ERROR +#endif +const int ERROR = -1; + +ETS *g_dev; + +void start(); +void stop(); +void test(); +void reset(); +void info(); + +/** + * Start the driver. + */ +void +start() +{ + int fd; + + if (g_dev != nullptr) + errx(1, "already started"); + + /* create the driver */ + g_dev = new ETS(ETS_BUS); + + if (g_dev == nullptr) + goto fail; + + if (OK != g_dev->init()) + goto fail; + + /* set the poll rate to default, starts automatic data collection */ + fd = open(AIRSPEED_SENSOR_DEVICE_PATH, O_RDONLY); + + if (fd < 0) + goto fail; + + if (ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT) < 0) + goto fail; + + exit(0); + +fail: + + if (g_dev != nullptr) + { + delete g_dev; + g_dev = nullptr; + } + + errx(1, "driver start failed"); +} + +/** + * Stop the driver + */ +void stop() +{ + if (g_dev != nullptr) + { + delete g_dev; + g_dev = nullptr; + } + else + { + errx(1, "driver not running"); + } + exit(0); +} + +/** + * Perform some basic functional tests on the driver; + * make sure we can collect data from the sensor in polled + * and automatic modes. + */ +void +test() +{ + struct range_finder_report report; + ssize_t sz; + int ret; + + int fd = open(RANGE_FINDER_DEVICE_PATH, O_RDONLY); + + if (fd < 0) + err(1, "%s open failed (try 'ETS start' if the driver is not running", RANGE_FINDER_DEVICE_PATH); + + /* do a simple demand read */ + sz = read(fd, &report, sizeof(report)); + + if (sz != sizeof(report)) + err(1, "immediate read failed"); + + warnx("single read"); + warnx("measurement: %0.2f m", (double)report.distance); + warnx("time: %lld", report.timestamp); + + /* start the sensor polling at 2Hz */ + if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) + errx(1, "failed to set 2Hz poll rate"); + + /* read the sensor 5x and report each value */ + for (unsigned i = 0; i < 5; i++) { + struct pollfd fds; + + /* wait for data to be ready */ + fds.fd = fd; + fds.events = POLLIN; + ret = poll(&fds, 1, 2000); + + if (ret != 1) + errx(1, "timed out waiting for sensor data"); + + /* now go get it */ + sz = read(fd, &report, sizeof(report)); + + if (sz != sizeof(report)) + err(1, "periodic read failed"); + + warnx("periodic read %u", i); + warnx("measurement: %0.3f", (double)report.distance); + warnx("time: %lld", report.timestamp); + } + + errx(0, "PASS"); +} + +/** + * Reset the driver. + */ +void +reset() +{ + int fd = open(RANGE_FINDER_DEVICE_PATH, O_RDONLY); + + if (fd < 0) + err(1, "failed "); + + if (ioctl(fd, SENSORIOCRESET, 0) < 0) + err(1, "driver reset failed"); + + if (ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT) < 0) + err(1, "driver poll restart failed"); + + exit(0); +} + +/** + * Print a little info about the driver. + */ +void +info() +{ + if (g_dev == nullptr) + errx(1, "driver not running"); + + printf("state @ %p\n", g_dev); + g_dev->print_info(); + + exit(0); +} + +} // namespace + +int +ETS_main(int argc, char *argv[]) +{ + /* + * Start/load the driver. + */ + if (!strcmp(argv[1], "start")) + ETS::start(); + + /* + * Stop the driver + */ + if (!strcmp(argv[1], "stop")) + ETS::stop(); + + /* + * Test the driver/device. + */ + if (!strcmp(argv[1], "test")) + ETS::test(); + + /* + * Reset the driver. + */ + if (!strcmp(argv[1], "reset")) + ETS::reset(); + + /* + * Print driver information. + */ + if (!strcmp(argv[1], "info") || !strcmp(argv[1], "status")) + ETS::info(); + + errx(1, "unrecognized command, try 'start', 'test', 'reset' or 'info'"); +} From 08bed2c31fe60333ecb289f525072cf912e942d0 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 20 Mar 2013 23:22:48 -0700 Subject: [PATCH 027/129] Add extra cleaning power. --- makefiles/firmware.mk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 917e8da347..9128da8c50 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -158,12 +158,17 @@ $(info % WORK_DIR = $(WORK_DIR)) # GLOBAL_DEPS += $(MAKEFILE_LIST) +# +# Extra things we should clean +# +EXTRA_CLEANS = + ################################################################################ # Modules ################################################################################ # -# We don't actually know what a moldule is called; all we have is a path fragment +# We don't actually know what a module is called; all we have is a path fragment # that we can search for, and where we expect to find a module.mk file. # # As such, we replicate the successfully-found path inside WORK_DIR for the @@ -269,6 +274,8 @@ $(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS) @$(ECHO) %% generating $@ $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" +EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG) + endif ################################################################################ @@ -321,6 +328,8 @@ $(BUILTIN_CSRC): $(GLOBAL_DEPS) $(BUILTIN_COMMAND_FILES) SRCS += $(BUILTIN_CSRC) +EXTRA_CLEANS += $(BUILTIN_CSRC) + endif ################################################################################ @@ -405,7 +414,7 @@ upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) clean: $(MODULE_CLEANS) @$(ECHO) %% cleaning $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) - $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) + $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) # From a457a452393308047e9b958906048049ac798081 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 20 Mar 2013 23:55:30 -0700 Subject: [PATCH 028/129] Pass the module name in to the module makefile. Refer to the module command name with MODULE_COMMAND to avoid confusion with the module's actual name. --- makefiles/firmware.mk | 1 + makefiles/module.mk | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 9128da8c50..dad57d531e 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -218,6 +218,7 @@ $(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) MODULE_WORK_DIR=$(dir $@) \ MODULE_OBJ=$@ \ MODULE_MK=$(mkfile) \ + MODULE_NAME=$(lastword $(subst /, ,$(@D))) \ module # make a list of phony clean targets for modules diff --git a/makefiles/module.mk b/makefiles/module.mk index 4f7b8def4e..8b01d0a126 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -45,20 +45,22 @@ # # # SRCS (required) +# # Lists the .c, cpp and .S files that should be compiled/assembled to # produce the module. # -# MODULE_NAME (optional) -# MODULE_ENTRYPOINT (optional if MODULE_NAME is set) -# MODULE_STACKSIZE (optional if MODULE_NAME is set) -# MODULE_PRIORITY (optional if MODULE_NAME is set) +# MODULE_COMMAND (optional) +# MODULE_ENTRYPOINT (optional if MODULE_COMMAND is set) +# MODULE_STACKSIZE (optional if MODULE_COMMAND is set) +# MODULE_PRIORITY (optional if MODULE_COMMAND is set) +# # Defines a single builtin command exported by the module. -# MODULE_NAME must be unique for any configuration, but need not be the +# MODULE_COMMAND must be unique for any configuration, but need not be the # same as the module directory name. # # If MODULE_ENTRYPOINT is set, it names the function (which must be exported) # that will be the entrypoint for the builtin command. It defaults to -# $(MODULE_NAME)_main. +# $(MODULE_COMMAND)_main. # # If MODULE_STACKSIZE is set, it is the size in bytes of the stack to be # allocated for the builtin command. If it is not set, it defaults @@ -67,11 +69,13 @@ # If MODULE_PRIORITY is set, it is the thread priority for the builtin # command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. # -# MODULE_COMMANDS (optional) +# MODULE_COMMANDS (optional if MODULE_COMMAND is not set) +# # Defines builtin commands exported by the module. Each word in # the list should be formatted as: # ... # +# # # Variables visible to the module's module.mk: @@ -79,6 +83,8 @@ # CONFIG # BOARD # MODULE_WORK_DIR +# MODULE_OBJ +# MODULE_MK # Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. # Anything exported from config_$(CONFIG).mk # @@ -107,6 +113,7 @@ include $(PX4_MK_DIR)/board_$(BOARD).mk # include $(MODULE_MK) MODULE_SRC := $(dir $(MODULE_MK)) +$(info % MODULE_NAME = $(MODULE_NAME)) $(info % MODULE_SRC = $(MODULE_SRC)) $(info % MODULE_OBJ = $(MODULE_OBJ)) $(info % MODULE_WORK_DIR = $(MODULE_WORK_DIR)) @@ -120,11 +127,11 @@ GLOBAL_DEPS += $(MAKEFILE_LIST) # Builtin command definitions ################################################################################ -ifneq ($(MODULE_NAME),) -MODULE_ENTRYPOINT ?= $(MODULE_NAME)_main +ifneq ($(MODULE_COMMAND),) +MODULE_ENTRYPOINT ?= $(MODULE_COMMAND)_main MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT -MODULE_COMMANDS += $(MODULE_NAME).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT) +MODULE_COMMANDS += $(MODULE_COMMAND).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT) endif ifneq ($(MODULE_COMMANDS),) From 335a645330fa1a525b552277a528d9a76deea56f Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 31 Mar 2013 15:46:07 -0700 Subject: [PATCH 029/129] Add some help text. --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Makefile b/Makefile index 8f9e81dce2..d0ffeb7402 100644 --- a/Makefile +++ b/Makefile @@ -145,3 +145,42 @@ distclean: clean $(Q) $(REMOVE) -f $(ARCHIVE_DIR)*.export $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean +# +# Print some help text +# +.PHONY: help +help: + @echo "" + @echo " PX4 firmware builder" + @echo " ====================" + @echo "" + @echo " Available targets:" + @echo " ------------------" + @echo "" + @echo " archives" + @echo " Build the NuttX RTOS archives that are used by the firmware build." + @echo "" + @echo " all" + @echo " Build all firmware configs: $(CONFIGS)" + @echo " A limited set of configs can be built with:" + @echo "" + @echo " CONFIGS=" + @echo "" + @for config in $(CONFIGS); do \ + echo " $$config"; \ + echo " Build just the $$config firmware configuration."; \ + echo ""; \ + done + @echo " clean" + @echo " Remove all firmware build pieces." + @echo "" + @echo " distclean" + @echo " Remove all compilation products, including NuttX RTOS archives." + @echo "" + @echo " Common options:" + @echo " ---------------" + @echo "" + @echo " V=1" + @echo " If V is set, more verbose output is printed during the build. This can" + @echo " help when diagnosing issues with the build or toolchain." + @echo "" From 8224adf52a126105c72e41db2ba35b1aaed3e301 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 31 Mar 2013 15:46:17 -0700 Subject: [PATCH 030/129] Should never have been here. --- apps/examples/cdcacm/.context | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 apps/examples/cdcacm/.context diff --git a/apps/examples/cdcacm/.context b/apps/examples/cdcacm/.context deleted file mode 100644 index e69de29bb2..0000000000 From 4f99200b0ff102c01f415a57e9f173a863483d2a Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Thu, 11 Apr 2013 08:36:54 +0200 Subject: [PATCH 031/129] Initial implementation that can read values from the ETS. --- apps/drivers/{ets => ets_airspeed}/Makefile | 0 .../{ets => ets_airspeed}/ets_airspeed.cpp | 123 +++++++++--------- apps/px4io/controls.c | 2 +- apps/uORB/objects_common.cpp | 3 + nuttx/configs/px4fmu/nsh/appconfig | 1 + 5 files changed, 67 insertions(+), 62 deletions(-) rename apps/drivers/{ets => ets_airspeed}/Makefile (100%) rename apps/drivers/{ets => ets_airspeed}/ets_airspeed.cpp (82%) diff --git a/apps/drivers/ets/Makefile b/apps/drivers/ets_airspeed/Makefile similarity index 100% rename from apps/drivers/ets/Makefile rename to apps/drivers/ets_airspeed/Makefile diff --git a/apps/drivers/ets/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp similarity index 82% rename from apps/drivers/ets/ets_airspeed.cpp rename to apps/drivers/ets_airspeed/ets_airspeed.cpp index 4ac707c3cb..790e949e0f 100644 --- a/apps/drivers/ets/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -65,20 +65,22 @@ #include #include +#include #include #include /* Configuration Constants */ -#define ETS_BUS PX4_I2C_BUS_EXPANSION -#define ETS_BASEADDR 0x70 /* 7-bit address. 8-bit address is 0xEA */ +#define ETS_AIRSPEED_BUS PX4_I2C_BUS_ESC +#define ETS_AIRSPEED_ADDRESS 0x75 -/* ETS Registers addresses */ +/* ETS_AIRSPEED Registers addresses */ -#define ETS_READ_CMD 0x07 /* Read the data */ +#define ETS_AIRSPEED_READ_CMD 0x07 /* Read the data */ -#define ETS_CONVERSION_INTERVAL 60000 /* 60ms */ +/* Max measurement rate is 100Hz */ +#define ETS_AIRSPEED_CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ /* oddly, ERROR is not defined for c++ */ #ifdef ERROR @@ -90,11 +92,11 @@ static const int ERROR = -1; # error This requires CONFIG_SCHED_WORKQUEUE. #endif -class ETS : public device::I2C +class ETS_AIRSPEED : public device::I2C { public: - ETS(int bus = ETS_BUS, int address = ETS_BASEADDR); - virtual ~ETS(); + ETS_AIRSPEED(int bus = ETS_AIRSPEED_BUS, int address = ETS_AIRSPEED_ADDRESS); + virtual ~ETS_AIRSPEED(); virtual int init(); @@ -114,7 +116,7 @@ private: unsigned _num_reports; volatile unsigned _next_report; volatile unsigned _oldest_report; - range_finder_report *_reports; + airspeed_report *_reports; bool _sensor_ok; int _measure_ticks; bool _collect_phase; @@ -171,10 +173,10 @@ private: /* * Driver 'main' command. */ -extern "C" __EXPORT int ETS_main(int argc, char *argv[]); +extern "C" __EXPORT int ets_airspeed_main(int argc, char *argv[]); -ETS::ETS(int bus, int address) : - I2C("ETS", AIRSPEED_SENSOR_DEVICE_PATH, bus, address, 100000), +ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : + I2C("ETS_AIRSPEED", AIRSPEED_DEVICE_PATH, bus, address, 100000), _num_reports(0), _next_report(0), _oldest_report(0), @@ -183,9 +185,9 @@ ETS::ETS(int bus, int address) : _measure_ticks(0), _collect_phase(false), _differential_pressure_topic(-1), - _sample_perf(perf_alloc(PC_ELAPSED, "ETS_read")), - _comms_errors(perf_alloc(PC_COUNT, "ETS_comms_errors")), - _buffer_overflows(perf_alloc(PC_COUNT, "ETS_buffer_overflows")) + _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), + _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), + _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")) { // enable debug() calls _debug_enabled = true; @@ -194,7 +196,7 @@ ETS::ETS(int bus, int address) : memset(&_work, 0, sizeof(_work)); } -ETS::~ETS() +ETS_AIRSPEED::~ETS_AIRSPEED() { /* make sure we are truly inactive */ stop(); @@ -205,7 +207,7 @@ ETS::~ETS() } int -ETS::init() +ETS_AIRSPEED::init() { int ret = ERROR; @@ -215,7 +217,7 @@ ETS::init() /* allocate basic report buffers */ _num_reports = 2; - _reports = new struct range_finder_report[_num_reports]; + _reports = new struct airspeed_report[_num_reports]; if (_reports == nullptr) goto out; @@ -224,7 +226,7 @@ ETS::init() /* get a publish handle on the airspeed topic */ memset(&_reports[0], 0, sizeof(_reports[0])); - _differential_pressure_topic = orb_advertise(ORB_ID(_differential_pressure), &_reports[0]); + _differential_pressure_topic = orb_advertise(ORB_ID(sensor_differential_pressure), &_reports[0]); if (_differential_pressure_topic < 0) debug("failed to create airspeed sensor object. Did you start uOrb?"); @@ -237,13 +239,13 @@ out: } int -ETS::probe() +ETS_AIRSPEED::probe() { return measure(); } int -ETS::ioctl(struct file *filp, int cmd, unsigned long arg) +ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) { switch (cmd) { @@ -270,7 +272,7 @@ ETS::ioctl(struct file *filp, int cmd, unsigned long arg) bool want_start = (_measure_ticks == 0); /* set interval for next measurement to minimum legal value */ - _measure_ticks = USEC2TICK(ETS_CONVERSION_INTERVAL); + _measure_ticks = USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL); /* if we need to start the poll state machine, do it */ if (want_start) @@ -288,7 +290,7 @@ ETS::ioctl(struct file *filp, int cmd, unsigned long arg) unsigned ticks = USEC2TICK(1000000 / arg); /* check against maximum rate */ - if (ticks < USEC2TICK(ETS_CONVERSION_INTERVAL)) + if (ticks < USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)) return -EINVAL; /* update interval for next measurement */ @@ -318,7 +320,7 @@ ETS::ioctl(struct file *filp, int cmd, unsigned long arg) return -EINVAL; /* allocate new buffer */ - struct range_finder_report *buf = new struct range_finder_report[arg]; + struct airspeed_report *buf = new struct airspeed_report[arg]; if (nullptr == buf) return -ENOMEM; @@ -347,9 +349,9 @@ ETS::ioctl(struct file *filp, int cmd, unsigned long arg) } ssize_t -ETS::read(struct file *filp, char *buffer, size_t buflen) +ETS_AIRSPEED::read(struct file *filp, char *buffer, size_t buflen) { - unsigned count = buflen / sizeof(struct range_finder_report); + unsigned count = buflen / sizeof(struct airspeed_report); int ret = 0; /* buffer must be large enough */ @@ -388,7 +390,7 @@ ETS::read(struct file *filp, char *buffer, size_t buflen) } /* wait for it to complete */ - usleep(ETS_CONVERSION_INTERVAL); + usleep(ETS_AIRSPEED_CONVERSION_INTERVAL); /* run the collection phase */ if (OK != collect()) { @@ -406,14 +408,14 @@ ETS::read(struct file *filp, char *buffer, size_t buflen) } int -ETS::measure() +ETS_AIRSPEED::measure() { int ret; /* * Send the command to begin a measurement. */ - uint8_t cmd = ETS_READ_CMD; + uint8_t cmd = ETS_AIRSPEED_READ_CMD; ret = transfer(&cmd, 1, nullptr, 0); if (OK != ret) @@ -428,7 +430,7 @@ ETS::measure() } int -ETS::collect() +ETS_AIRSPEED::collect() { int ret = -EIO; @@ -449,11 +451,10 @@ ETS::collect() float si_units = (distance * 1.0f)/ 100.0f; /* cm to m */ /* this should be fairly close to the end of the measurement, so the best approximation of the time */ _reports[_next_report].timestamp = hrt_absolute_time(); - _reports[_next_report].distance = si_units; - _reports[_next_report].valid = si_units > get_minimum_distance() && si_units < get_maximum_distance() ? 1 : 0; + _reports[_next_report].speed = si_units; /* publish it */ - orb_publish(ORB_ID(_differential_pressure), _differential_pressure_topic, &_reports[_next_report]); + orb_publish(ORB_ID(sensor_differential_pressure), _differential_pressure_topic, &_reports[_next_report]); /* post a report to the ring - note, not locked */ INCREMENT(_next_report, _num_reports); @@ -477,14 +478,14 @@ out: } void -ETS::start() +ETS_AIRSPEED::start() { /* reset the report ring and state machine */ _collect_phase = false; _oldest_report = _next_report = 0; /* schedule a cycle to start things */ - work_queue(HPWORK, &_work, (worker_t)&ETS::cycle_trampoline, this, 1); + work_queue(HPWORK, &_work, (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, 1); /* notify about state change */ struct subsystem_info_s info = { @@ -502,21 +503,21 @@ ETS::start() } void -ETS::stop() +ETS_AIRSPEED::stop() { work_cancel(HPWORK, &_work); } void -ETS::cycle_trampoline(void *arg) +ETS_AIRSPEED::cycle_trampoline(void *arg) { - ETS *dev = (ETS *)arg; + ETS_AIRSPEED *dev = (ETS_AIRSPEED *)arg; dev->cycle(); } void -ETS::cycle() +ETS_AIRSPEED::cycle() { /* collection phase? */ if (_collect_phase) { @@ -535,14 +536,14 @@ ETS::cycle() /* * Is there a collect->measure gap? */ - if (_measure_ticks > USEC2TICK(ETS_CONVERSION_INTERVAL)) { + if (_measure_ticks > USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)) { /* schedule a fresh cycle call when we are ready to measure again */ work_queue(HPWORK, &_work, - (worker_t)&ETS::cycle_trampoline, + (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, - _measure_ticks - USEC2TICK(ETS_CONVERSION_INTERVAL)); + _measure_ticks - USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)); return; } @@ -558,13 +559,13 @@ ETS::cycle() /* schedule a fresh cycle call when the measurement is done */ work_queue(HPWORK, &_work, - (worker_t)&ETS::cycle_trampoline, + (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, - USEC2TICK(ETS_CONVERSION_INTERVAL)); + USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)); } void -ETS::print_info() +ETS_AIRSPEED::print_info() { perf_print_counter(_sample_perf); perf_print_counter(_comms_errors); @@ -577,7 +578,7 @@ ETS::print_info() /** * Local functions in support of the shell command. */ -namespace ETS +namespace ets_airspeed { /* oddly, ERROR is not defined for c++ */ @@ -586,7 +587,7 @@ namespace ETS #endif const int ERROR = -1; -ETS *g_dev; +ETS_AIRSPEED *g_dev; void start(); void stop(); @@ -606,7 +607,7 @@ start() errx(1, "already started"); /* create the driver */ - g_dev = new ETS(ETS_BUS); + g_dev = new ETS_AIRSPEED(ETS_AIRSPEED_BUS); if (g_dev == nullptr) goto fail; @@ -615,7 +616,7 @@ start() goto fail; /* set the poll rate to default, starts automatic data collection */ - fd = open(AIRSPEED_SENSOR_DEVICE_PATH, O_RDONLY); + fd = open(AIRSPEED_DEVICE_PATH, O_RDONLY); if (fd < 0) goto fail; @@ -661,14 +662,14 @@ void stop() void test() { - struct range_finder_report report; + struct airspeed_report report; ssize_t sz; int ret; - int fd = open(RANGE_FINDER_DEVICE_PATH, O_RDONLY); + int fd = open(AIRSPEED_DEVICE_PATH, O_RDONLY); if (fd < 0) - err(1, "%s open failed (try 'ETS start' if the driver is not running", RANGE_FINDER_DEVICE_PATH); + err(1, "%s open failed (try 'ets_airspeed start' if the driver is not running", AIRSPEED_DEVICE_PATH); /* do a simple demand read */ sz = read(fd, &report, sizeof(report)); @@ -677,7 +678,7 @@ test() err(1, "immediate read failed"); warnx("single read"); - warnx("measurement: %0.2f m", (double)report.distance); + warnx("measurement: %0.2f m", (double)report.speed); warnx("time: %lld", report.timestamp); /* start the sensor polling at 2Hz */ @@ -703,7 +704,7 @@ test() err(1, "periodic read failed"); warnx("periodic read %u", i); - warnx("measurement: %0.3f", (double)report.distance); + warnx("measurement: %0.3f", (double)report.speed); warnx("time: %lld", report.timestamp); } @@ -716,7 +717,7 @@ test() void reset() { - int fd = open(RANGE_FINDER_DEVICE_PATH, O_RDONLY); + int fd = open(AIRSPEED_DEVICE_PATH, O_RDONLY); if (fd < 0) err(1, "failed "); @@ -748,37 +749,37 @@ info() } // namespace int -ETS_main(int argc, char *argv[]) +ets_airspeed_main(int argc, char *argv[]) { /* * Start/load the driver. */ if (!strcmp(argv[1], "start")) - ETS::start(); + ets_airspeed::start(); /* * Stop the driver */ if (!strcmp(argv[1], "stop")) - ETS::stop(); + ets_airspeed::stop(); /* * Test the driver/device. */ if (!strcmp(argv[1], "test")) - ETS::test(); + ets_airspeed::test(); /* * Reset the driver. */ if (!strcmp(argv[1], "reset")) - ETS::reset(); + ets_airspeed::reset(); /* * Print driver information. */ if (!strcmp(argv[1], "info") || !strcmp(argv[1], "status")) - ETS::info(); + ets_airspeed::info(); errx(1, "unrecognized command, try 'start', 'test', 'reset' or 'info'"); } diff --git a/apps/px4io/controls.c b/apps/px4io/controls.c index e80a41f15c..9a0f0e5c1b 100644 --- a/apps/px4io/controls.c +++ b/apps/px4io/controls.c @@ -70,7 +70,7 @@ controls_init(void) unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_OPTIONS] = 0; - r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MIN] = 1000; + r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MIN] = 950; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_CENTER] = 1500; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MAX] = 2000; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_DEADZONE] = 30; diff --git a/apps/uORB/objects_common.cpp b/apps/uORB/objects_common.cpp index 1363751401..cd21d556c5 100644 --- a/apps/uORB/objects_common.cpp +++ b/apps/uORB/objects_common.cpp @@ -56,6 +56,9 @@ ORB_DEFINE(sensor_baro, struct baro_report); #include ORB_DEFINE(sensor_range_finder, struct range_finder_report); +#include +ORB_DEFINE(sensor_differential_pressure, struct airspeed_report); + #include ORB_DEFINE(output_pwm, struct pwm_output_values); diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 80cf6f312c..b5f35f5140 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -127,6 +127,7 @@ CONFIGURED_APPS += drivers/px4fmu CONFIGURED_APPS += drivers/hil CONFIGURED_APPS += drivers/gps CONFIGURED_APPS += drivers/mb12xx +CONFIGURED_APPS += drivers/ets_airspeed # Testing stuff CONFIGURED_APPS += px4/sensors_bringup From c8ac1d0b0a97f5fc926a48e64e0e116387453dcd Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Thu, 11 Apr 2013 08:37:25 +0200 Subject: [PATCH 032/129] Add in the missing header. --- apps/drivers/drv_airspeed.h | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 apps/drivers/drv_airspeed.h diff --git a/apps/drivers/drv_airspeed.h b/apps/drivers/drv_airspeed.h new file mode 100644 index 0000000000..a98f568070 --- /dev/null +++ b/apps/drivers/drv_airspeed.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file Airspeed driver interface. + */ + +#ifndef _DRV_AIRSPEED_H +#define _DRV_AIRSPEED_H + +#include +#include + +#include "drv_sensor.h" +#include "drv_orb_dev.h" + +#define AIRSPEED_DEVICE_PATH "/dev/airspeed" + +/** + * Airspeed report structure. Reads from the device must be in multiples of this + * structure. + */ +struct airspeed_report { + uint64_t timestamp; + uint8_t speed; /** in meters/sec */ +}; + +/* + * ObjDev tag for raw range finder data. + */ +ORB_DECLARE(sensor_differential_pressure); + +/* + * ioctl() definitions + * + * Airspeed drivers also implement the generic sensor driver + * interfaces from drv_sensor.h + */ + +#define _AIRSPEEDIOCBASE (0x7700) +#define __AIRSPEEDIOC(_n) (_IOC(_AIRSPEEDIOCBASE, _n)) + + +#endif /* _DRV_AIRSPEED_H */ From 42f4a9e8800c4d5d2823b4f477c556547fe0d3d0 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Sat, 13 Apr 2013 08:47:12 +0200 Subject: [PATCH 033/129] Switch to differential pressure topic --- apps/drivers/drv_airspeed.h | 14 +- apps/drivers/ets_airspeed/ets_airspeed.cpp | 150 ++++++++++++++------- apps/systemlib/airspeed.c | 2 +- apps/uORB/objects_common.cpp | 3 - 4 files changed, 110 insertions(+), 59 deletions(-) diff --git a/apps/drivers/drv_airspeed.h b/apps/drivers/drv_airspeed.h index a98f568070..269ee45591 100644 --- a/apps/drivers/drv_airspeed.h +++ b/apps/drivers/drv_airspeed.h @@ -47,18 +47,18 @@ #define AIRSPEED_DEVICE_PATH "/dev/airspeed" /** - * Airspeed report structure. Reads from the device must be in multiples of this + * Airspeed report structure. Reads from the device must be in multiples of this * structure. */ -struct airspeed_report { - uint64_t timestamp; - uint8_t speed; /** in meters/sec */ -}; +//struct airspeed_report { +// uint64_t timestamp; +// uint8_t diff_pressure; /** differential pressure in Pa */ +//}; /* * ObjDev tag for raw range finder data. */ -ORB_DECLARE(sensor_differential_pressure); +//ORB_DECLARE(sensor_differential_pressure); /* * ioctl() definitions @@ -67,7 +67,7 @@ ORB_DECLARE(sensor_differential_pressure); * interfaces from drv_sensor.h */ -#define _AIRSPEEDIOCBASE (0x7700) +#define _AIRSPEEDIOCBASE (0x7700) #define __AIRSPEEDIOC(_n) (_IOC(_AIRSPEEDIOCBASE, _n)) diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 790e949e0f..0b535b0b5f 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -63,24 +63,28 @@ #include #include +#include -#include #include +#include #include +#include +#include /* for baro readings */ #include - /* Configuration Constants */ -#define ETS_AIRSPEED_BUS PX4_I2C_BUS_ESC -#define ETS_AIRSPEED_ADDRESS 0x75 +#define I2C_BUS PX4_I2C_BUS_ESC +#define I2C_ADDRESS 0x75 /* ETS_AIRSPEED Registers addresses */ - -#define ETS_AIRSPEED_READ_CMD 0x07 /* Read the data */ +#define READ_CMD 0x07 /* Read the data */ /* Max measurement rate is 100Hz */ -#define ETS_AIRSPEED_CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ +#define CONVERSION_INTERVAL (1000000 / 10) /* microseconds */ + +#define DIFF_PRESSURE_SCALE 1.0 +#define DIFF_PRESSURE_OFFSET 1673 /* oddly, ERROR is not defined for c++ */ #ifdef ERROR @@ -92,10 +96,13 @@ static const int ERROR = -1; # error This requires CONFIG_SCHED_WORKQUEUE. #endif +static int _sensor_sub = -1; + + class ETS_AIRSPEED : public device::I2C { public: - ETS_AIRSPEED(int bus = ETS_AIRSPEED_BUS, int address = ETS_AIRSPEED_ADDRESS); + ETS_AIRSPEED(int bus = I2C_BUS, int address = I2C_ADDRESS); virtual ~ETS_AIRSPEED(); virtual int init(); @@ -112,20 +119,21 @@ protected: virtual int probe(); private: - work_s _work; - unsigned _num_reports; - volatile unsigned _next_report; - volatile unsigned _oldest_report; - airspeed_report *_reports; - bool _sensor_ok; - int _measure_ticks; - bool _collect_phase; + work_s _work; + unsigned _num_reports; + volatile unsigned _next_report; + volatile unsigned _oldest_report; + differential_pressure_s *_reports; + bool _sensor_ok; + int _measure_ticks; + bool _collect_phase; - orb_advert_t _differential_pressure_topic; + orb_advert_t _airspeed_pub; + + perf_counter_t _sample_perf; + perf_counter_t _comms_errors; + perf_counter_t _buffer_overflows; - perf_counter_t _sample_perf; - perf_counter_t _comms_errors; - perf_counter_t _buffer_overflows; /** * Test whether the device supported by the driver is present at a @@ -184,7 +192,7 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : _sensor_ok(false), _measure_ticks(0), _collect_phase(false), - _differential_pressure_topic(-1), + _airspeed_pub(-1), _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")) @@ -217,7 +225,7 @@ ETS_AIRSPEED::init() /* allocate basic report buffers */ _num_reports = 2; - _reports = new struct airspeed_report[_num_reports]; + _reports = new struct differential_pressure_s[_num_reports]; if (_reports == nullptr) goto out; @@ -226,11 +234,18 @@ ETS_AIRSPEED::init() /* get a publish handle on the airspeed topic */ memset(&_reports[0], 0, sizeof(_reports[0])); - _differential_pressure_topic = orb_advertise(ORB_ID(sensor_differential_pressure), &_reports[0]); + _airspeed_pub = orb_advertise(ORB_ID(differential_pressure), &_reports[0]); - if (_differential_pressure_topic < 0) + if (_airspeed_pub < 0) debug("failed to create airspeed sensor object. Did you start uOrb?"); + _sensor_sub = orb_subscribe(ORB_ID(sensor_combined)); + + if (_sensor_sub < 0) { + debug("failed to subscribe to sensor_combined object."); + return ret; + } + ret = OK; /* sensor is ok, but we don't really know if it is within range */ _sensor_ok = true; @@ -272,7 +287,7 @@ ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) bool want_start = (_measure_ticks == 0); /* set interval for next measurement to minimum legal value */ - _measure_ticks = USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL); + _measure_ticks = USEC2TICK(CONVERSION_INTERVAL); /* if we need to start the poll state machine, do it */ if (want_start) @@ -290,7 +305,7 @@ ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) unsigned ticks = USEC2TICK(1000000 / arg); /* check against maximum rate */ - if (ticks < USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)) + if (ticks < USEC2TICK(CONVERSION_INTERVAL)) return -EINVAL; /* update interval for next measurement */ @@ -320,7 +335,7 @@ ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) return -EINVAL; /* allocate new buffer */ - struct airspeed_report *buf = new struct airspeed_report[arg]; + struct differential_pressure_s *buf = new struct differential_pressure_s[arg]; if (nullptr == buf) return -ENOMEM; @@ -351,7 +366,7 @@ ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) ssize_t ETS_AIRSPEED::read(struct file *filp, char *buffer, size_t buflen) { - unsigned count = buflen / sizeof(struct airspeed_report); + unsigned count = buflen / sizeof(struct differential_pressure_s); int ret = 0; /* buffer must be large enough */ @@ -390,7 +405,7 @@ ETS_AIRSPEED::read(struct file *filp, char *buffer, size_t buflen) } /* wait for it to complete */ - usleep(ETS_AIRSPEED_CONVERSION_INTERVAL); + usleep(CONVERSION_INTERVAL); /* run the collection phase */ if (OK != collect()) { @@ -415,7 +430,7 @@ ETS_AIRSPEED::measure() /* * Send the command to begin a measurement. */ - uint8_t cmd = ETS_AIRSPEED_READ_CMD; + uint8_t cmd = READ_CMD; ret = transfer(&cmd, 1, nullptr, 0); if (OK != ret) @@ -441,20 +456,48 @@ ETS_AIRSPEED::collect() ret = transfer(nullptr, 0, &val[0], 2); - if (ret < 0) - { + if (ret < 0) { log("error reading from sensor: %d", ret); return ret; } - uint16_t distance = val[0] << 8 | val[1]; - float si_units = (distance * 1.0f)/ 100.0f; /* cm to m */ - /* this should be fairly close to the end of the measurement, so the best approximation of the time */ - _reports[_next_report].timestamp = hrt_absolute_time(); - _reports[_next_report].speed = si_units; + uint16_t diff_pres_pa = val[1] << 8 | val[0]; + //log("val: %0.3f", (float)(diff_pressure)); + + /* adjust if necessary */ + diff_pres_pa = DIFF_PRESSURE_SCALE * (diff_pres_pa - DIFF_PRESSURE_OFFSET); + //log("measurement: %0.2f m/s", calc_indicated_airspeed((float)_reports[_next_report].diff_pressure)); + + struct sensor_combined_s raw; + memset(&raw, 0, sizeof(raw)); + + bool updated; + orb_check(_sensor_sub, &updated); + if (updated) { + orb_copy(ORB_ID(sensor_combined), _sensor_sub, &raw); + printf("baro temp %3.6f\n", raw.baro_pres_mbar); + } + unlock(); + //if (raw.baro_temp_celcius > 0) + // log("baro temp %3.3f\n", (uint8_t) raw.baro_temp_celcius); + + float airspeed_true = calc_true_airspeed(diff_pres_pa + raw.baro_pres_mbar*1e2f, + raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa + // XXX HACK - true temperature is much less than indicated temperature in baro, + // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB + + float airspeed_indicated = calc_indicated_airspeed(diff_pres_pa); - /* publish it */ - orb_publish(ORB_ID(sensor_differential_pressure), _differential_pressure_topic, &_reports[_next_report]); + _reports[_next_report].timestamp = hrt_absolute_time(); + _reports[_next_report].static_pressure_mbar = raw.baro_pres_mbar; + _reports[_next_report].differential_pressure_mbar = diff_pres_pa * 1e-2f; + _reports[_next_report].temperature_celcius = raw.baro_temp_celcius; + _reports[_next_report].indicated_airspeed_m_s = airspeed_indicated; + _reports[_next_report].true_airspeed_m_s = airspeed_true; + _reports[_next_report].voltage = 0; + + /* announce the airspeed if needed, just publish else */ + orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &_reports[_next_report]); /* post a report to the ring - note, not locked */ INCREMENT(_next_report, _num_reports); @@ -472,7 +515,6 @@ ETS_AIRSPEED::collect() out: perf_end(_sample_perf); - return ret; return ret; } @@ -536,14 +578,14 @@ ETS_AIRSPEED::cycle() /* * Is there a collect->measure gap? */ - if (_measure_ticks > USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)) { + if (_measure_ticks > USEC2TICK(CONVERSION_INTERVAL)) { /* schedule a fresh cycle call when we are ready to measure again */ work_queue(HPWORK, &_work, (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, - _measure_ticks - USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)); + _measure_ticks - USEC2TICK(CONVERSION_INTERVAL)); return; } @@ -561,7 +603,7 @@ ETS_AIRSPEED::cycle() &_work, (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, - USEC2TICK(ETS_AIRSPEED_CONVERSION_INTERVAL)); + USEC2TICK(CONVERSION_INTERVAL)); } void @@ -607,7 +649,7 @@ start() errx(1, "already started"); /* create the driver */ - g_dev = new ETS_AIRSPEED(ETS_AIRSPEED_BUS); + g_dev = new ETS_AIRSPEED(I2C_BUS); if (g_dev == nullptr) goto fail; @@ -662,7 +704,7 @@ void stop() void test() { - struct airspeed_report report; + struct differential_pressure_s report; ssize_t sz; int ret; @@ -678,7 +720,18 @@ test() err(1, "immediate read failed"); warnx("single read"); - warnx("measurement: %0.2f m", (double)report.speed); + warnx("diff pressure: %0.3f mbar", report.differential_pressure_mbar); + warnx("indicated airspeed: %0.1f m/s", report.indicated_airspeed_m_s); + warnx("true airspeed: %0.1f m/s", report.true_airspeed_m_s); + + struct sensor_combined_s raw; + memset(&raw, 0, sizeof(raw)); + int sensor_sub = orb_subscribe(ORB_ID(sensor_combined)); + orb_copy(ORB_ID(sensor_combined), sensor_sub, &raw); + + //if (raw.baro_temp_celcius > 0) + // log("baro temp %3.3f\n", (uint8_t) raw.baro_temp_celcius); + warnx("temp: %3.5f", raw.baro_temp_celcius); warnx("time: %lld", report.timestamp); /* start the sensor polling at 2Hz */ @@ -704,8 +757,9 @@ test() err(1, "periodic read failed"); warnx("periodic read %u", i); - warnx("measurement: %0.3f", (double)report.speed); - warnx("time: %lld", report.timestamp); + warnx("diff pressure: %0.3f mbar", report.differential_pressure_mbar); + warnx("indicated airspeed: %0.1f m/s", report.indicated_airspeed_m_s); + warnx("true airspeed: %0.1f m/s", report.true_airspeed_m_s); warnx("time: %lld", report.timestamp); } errx(0, "PASS"); diff --git a/apps/systemlib/airspeed.c b/apps/systemlib/airspeed.c index 264287b10f..15bb833a99 100644 --- a/apps/systemlib/airspeed.c +++ b/apps/systemlib/airspeed.c @@ -97,7 +97,7 @@ float calc_true_airspeed(float total_pressure, float static_pressure, float temp float density = get_air_density(static_pressure, temperature_celsius); if (density < 0.0001f || !isfinite(density)) { density = CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C; - printf("[airspeed] Invalid air density, using density at sea level\n"); +// printf("[airspeed] Invalid air density, using density at sea level\n"); } float pressure_difference = total_pressure - static_pressure; diff --git a/apps/uORB/objects_common.cpp b/apps/uORB/objects_common.cpp index cd21d556c5..1363751401 100644 --- a/apps/uORB/objects_common.cpp +++ b/apps/uORB/objects_common.cpp @@ -56,9 +56,6 @@ ORB_DEFINE(sensor_baro, struct baro_report); #include ORB_DEFINE(sensor_range_finder, struct range_finder_report); -#include -ORB_DEFINE(sensor_differential_pressure, struct airspeed_report); - #include ORB_DEFINE(output_pwm, struct pwm_output_values); From c5a453cd18949d2d4673c0b343e22c22a8d2854d Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Sat, 13 Apr 2013 09:09:21 +0200 Subject: [PATCH 034/129] Remove some testing code. --- apps/drivers/ets_airspeed/ets_airspeed.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 0b535b0b5f..58d016a307 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -477,7 +477,6 @@ ETS_AIRSPEED::collect() orb_copy(ORB_ID(sensor_combined), _sensor_sub, &raw); printf("baro temp %3.6f\n", raw.baro_pres_mbar); } - unlock(); //if (raw.baro_temp_celcius > 0) // log("baro temp %3.3f\n", (uint8_t) raw.baro_temp_celcius); From df6976c8d640b395220d46f5b1fd7ecfc8ae3e04 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Fri, 19 Apr 2013 16:20:40 +0200 Subject: [PATCH 035/129] Split diff pressure and airspeed. --- apps/commander/commander.c | 10 +-- apps/drivers/ets_airspeed/ets_airspeed.cpp | 71 ++++------------------ apps/sdlog/sdlog.c | 17 +++++- apps/sensors/sensors.cpp | 59 ++++++++++++------ apps/uORB/objects_common.cpp | 3 + apps/uORB/topics/differential_pressure.h | 11 ++-- apps/uORB/topics/sensor_combined.h | 2 + 7 files changed, 80 insertions(+), 93 deletions(-) diff --git a/apps/commander/commander.c b/apps/commander/commander.c index 7c0a25f862..fcfffcfef7 100644 --- a/apps/commander/commander.c +++ b/apps/commander/commander.c @@ -801,7 +801,7 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) struct differential_pressure_s differential_pressure; int calibration_counter = 0; - float airspeed_offset = 0.0f; + float diff_pres_offset = 0.0f; while (calibration_counter < calibration_count) { @@ -812,7 +812,7 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) if (poll_ret) { orb_copy(ORB_ID(differential_pressure), sub_differential_pressure, &differential_pressure); - airspeed_offset += differential_pressure.voltage; + diff_pres_offset += differential_pressure.differential_pressure_pa; calibration_counter++; } else if (poll_ret == 0) { @@ -822,11 +822,11 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) } } - airspeed_offset = airspeed_offset / calibration_count; + diff_pres_offset = diff_pres_offset / calibration_count; - if (isfinite(airspeed_offset)) { + if (isfinite(diff_pres_offset)) { - if (param_set(param_find("SENS_VAIR_OFF"), &(airspeed_offset))) { + if (param_set(param_find("SENS_VAIR_OFF"), &(diff_pres_offset))) { mavlink_log_critical(mavlink_fd, "Setting offs failed!"); } diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 58d016a307..860baa760c 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -61,16 +61,16 @@ #include -#include -#include #include +#include +#include +#include #include #include #include #include -#include /* for baro readings */ #include /* Configuration Constants */ @@ -83,9 +83,6 @@ /* Max measurement rate is 100Hz */ #define CONVERSION_INTERVAL (1000000 / 10) /* microseconds */ -#define DIFF_PRESSURE_SCALE 1.0 -#define DIFF_PRESSURE_OFFSET 1673 - /* oddly, ERROR is not defined for c++ */ #ifdef ERROR # undef ERROR @@ -96,9 +93,6 @@ static const int ERROR = -1; # error This requires CONFIG_SCHED_WORKQUEUE. #endif -static int _sensor_sub = -1; - - class ETS_AIRSPEED : public device::I2C { public: @@ -127,6 +121,7 @@ private: bool _sensor_ok; int _measure_ticks; bool _collect_phase; + int _differential_pressure_offset; orb_advert_t _airspeed_pub; @@ -195,7 +190,8 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : _airspeed_pub(-1), _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), - _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")) + _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")), + _differential_pressure_offset(0) { // enable debug() calls _debug_enabled = true; @@ -239,12 +235,7 @@ ETS_AIRSPEED::init() if (_airspeed_pub < 0) debug("failed to create airspeed sensor object. Did you start uOrb?"); - _sensor_sub = orb_subscribe(ORB_ID(sensor_combined)); - - if (_sensor_sub < 0) { - debug("failed to subscribe to sensor_combined object."); - return ret; - } + param_get(param_find("SENS_VAIR_OFF"), &_differential_pressure_offset); ret = OK; /* sensor is ok, but we don't really know if it is within range */ @@ -462,38 +453,13 @@ ETS_AIRSPEED::collect() } uint16_t diff_pres_pa = val[1] << 8 | val[0]; - //log("val: %0.3f", (float)(diff_pressure)); /* adjust if necessary */ - diff_pres_pa = DIFF_PRESSURE_SCALE * (diff_pres_pa - DIFF_PRESSURE_OFFSET); + diff_pres_pa -= _differential_pressure_offset; //log("measurement: %0.2f m/s", calc_indicated_airspeed((float)_reports[_next_report].diff_pressure)); - - struct sensor_combined_s raw; - memset(&raw, 0, sizeof(raw)); - - bool updated; - orb_check(_sensor_sub, &updated); - if (updated) { - orb_copy(ORB_ID(sensor_combined), _sensor_sub, &raw); - printf("baro temp %3.6f\n", raw.baro_pres_mbar); - } - //if (raw.baro_temp_celcius > 0) - // log("baro temp %3.3f\n", (uint8_t) raw.baro_temp_celcius); - - float airspeed_true = calc_true_airspeed(diff_pres_pa + raw.baro_pres_mbar*1e2f, - raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa - // XXX HACK - true temperature is much less than indicated temperature in baro, - // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB - - float airspeed_indicated = calc_indicated_airspeed(diff_pres_pa); _reports[_next_report].timestamp = hrt_absolute_time(); - _reports[_next_report].static_pressure_mbar = raw.baro_pres_mbar; - _reports[_next_report].differential_pressure_mbar = diff_pres_pa * 1e-2f; - _reports[_next_report].temperature_celcius = raw.baro_temp_celcius; - _reports[_next_report].indicated_airspeed_m_s = airspeed_indicated; - _reports[_next_report].true_airspeed_m_s = airspeed_true; - _reports[_next_report].voltage = 0; + _reports[_next_report].differential_pressure_pa = diff_pres_pa; /* announce the airspeed if needed, just publish else */ orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &_reports[_next_report]); @@ -512,7 +478,6 @@ ETS_AIRSPEED::collect() ret = OK; -out: perf_end(_sample_perf); return ret; @@ -719,19 +684,7 @@ test() err(1, "immediate read failed"); warnx("single read"); - warnx("diff pressure: %0.3f mbar", report.differential_pressure_mbar); - warnx("indicated airspeed: %0.1f m/s", report.indicated_airspeed_m_s); - warnx("true airspeed: %0.1f m/s", report.true_airspeed_m_s); - - struct sensor_combined_s raw; - memset(&raw, 0, sizeof(raw)); - int sensor_sub = orb_subscribe(ORB_ID(sensor_combined)); - orb_copy(ORB_ID(sensor_combined), sensor_sub, &raw); - - //if (raw.baro_temp_celcius > 0) - // log("baro temp %3.3f\n", (uint8_t) raw.baro_temp_celcius); - warnx("temp: %3.5f", raw.baro_temp_celcius); - warnx("time: %lld", report.timestamp); + warnx("diff pressure: %0.3f pa", (double) report.differential_pressure_pa); /* start the sensor polling at 2Hz */ if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) @@ -756,9 +709,7 @@ test() err(1, "periodic read failed"); warnx("periodic read %u", i); - warnx("diff pressure: %0.3f mbar", report.differential_pressure_mbar); - warnx("indicated airspeed: %0.1f m/s", report.indicated_airspeed_m_s); - warnx("true airspeed: %0.1f m/s", report.true_airspeed_m_s); warnx("time: %lld", report.timestamp); + warnx("diff pressure: %0.3f pa", (double) report.differential_pressure_pa); } errx(0, "PASS"); diff --git a/apps/sdlog/sdlog.c b/apps/sdlog/sdlog.c index df8745d9f5..46b232c34d 100644 --- a/apps/sdlog/sdlog.c +++ b/apps/sdlog/sdlog.c @@ -71,6 +71,7 @@ #include #include #include +#include #include @@ -444,6 +445,7 @@ int sdlog_thread_main(int argc, char *argv[]) struct optical_flow_s flow; struct battery_status_s batt; struct differential_pressure_s diff_pressure; + struct airspeed_s airspeed; } buf; memset(&buf, 0, sizeof(buf)); @@ -462,6 +464,7 @@ int sdlog_thread_main(int argc, char *argv[]) int flow_sub; int batt_sub; int diff_pressure_sub; + int airspeed_sub; } subs; /* --- MANAGEMENT - LOGGING COMMAND --- */ @@ -563,6 +566,13 @@ int sdlog_thread_main(int argc, char *argv[]) fds[fdsc_count].events = POLLIN; fdsc_count++; + /* --- AIRSPEED --- */ + /* subscribe to ORB for airspeed */ + subs.airspeed_sub = orb_subscribe(ORB_ID(airspeed)); + fds[fdsc_count].fd = subs.airspeed_sub; + fds[fdsc_count].events = POLLIN; + fdsc_count++; + /* WARNING: If you get the error message below, * then the number of registered messages (fdsc) * differs from the number of messages in the above list. @@ -655,6 +665,7 @@ int sdlog_thread_main(int argc, char *argv[]) orb_copy(ORB_ID(vehicle_vicon_position), subs.vicon_pos_sub, &buf.vicon_pos); orb_copy(ORB_ID(optical_flow), subs.flow_sub, &buf.flow); orb_copy(ORB_ID(differential_pressure), subs.diff_pressure_sub, &buf.diff_pressure); + orb_copy(ORB_ID(airspeed), subs.airspeed_sub, &buf.airspeed); orb_copy(ORB_ID(battery_status), subs.batt_sub, &buf.batt); /* if skipping is on or logging is disabled, ignore */ @@ -691,9 +702,9 @@ int sdlog_thread_main(int argc, char *argv[]) .vicon = {buf.vicon_pos.x, buf.vicon_pos.y, buf.vicon_pos.z, buf.vicon_pos.roll, buf.vicon_pos.pitch, buf.vicon_pos.yaw}, .control_effective = {buf.act_controls_effective.control_effective[0], buf.act_controls_effective.control_effective[1], buf.act_controls_effective.control_effective[2], buf.act_controls_effective.control_effective[3]}, .flow = {buf.flow.flow_raw_x, buf.flow.flow_raw_y, buf.flow.flow_comp_x_m, buf.flow.flow_comp_y_m, buf.flow.ground_distance_m, buf.flow.quality}, - .diff_pressure = buf.diff_pressure.differential_pressure_mbar, - .ind_airspeed = buf.diff_pressure.indicated_airspeed_m_s, - .true_airspeed = buf.diff_pressure.true_airspeed_m_s + .diff_pressure = buf.diff_pressure.differential_pressure_pa, + .ind_airspeed = buf.airspeed.indicated_airspeed_m_s, + .true_airspeed = buf.airspeed.true_airspeed_m_s }; /* put into buffer for later IO */ diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp index d725c7727f..2cf3b92ef7 100644 --- a/apps/sensors/sensors.cpp +++ b/apps/sensors/sensors.cpp @@ -77,6 +77,7 @@ #include #include #include +#include #define GYRO_HEALTH_COUNTER_LIMIT_ERROR 20 /* 40 ms downtime at 500 Hz update rate */ #define ACC_HEALTH_COUNTER_LIMIT_ERROR 20 /* 40 ms downtime at 500 Hz update rate */ @@ -156,6 +157,8 @@ private: int _mag_sub; /**< raw mag data subscription */ int _rc_sub; /**< raw rc channels data subscription */ int _baro_sub; /**< raw baro data subscription */ + int _airspeed_sub; /**< airspeed subscription */ + int _differential_pressure_sub; /**< raw differential pressure subscription */ int _vstatus_sub; /**< vehicle status subscription */ int _params_sub; /**< notification of parameter updates */ int _manual_control_sub; /**< notification of manual control updates */ @@ -165,6 +168,7 @@ private: orb_advert_t _rc_pub; /**< raw r/c control topic */ orb_advert_t _battery_pub; /**< battery status */ orb_advert_t _airspeed_pub; /**< airspeed */ + orb_advert_t _differential_pressure_pub; /**< differential_pressure */ perf_counter_t _loop_perf; /**< loop performance counter */ @@ -172,6 +176,7 @@ private: struct battery_status_s _battery_status; /**< battery status */ struct baro_report _barometer; /**< barometer data */ struct differential_pressure_s _differential_pressure; + struct airspeed_s _airspeed; struct { float min[_rc_max_chan_count]; @@ -330,6 +335,14 @@ private: */ void baro_poll(struct sensor_combined_s &raw); + /** + * Poll the differential pressure sensor for updated data. + * + * @param raw Combined sensor data structure into which + * data should be returned. + */ + void differential_pressure_poll(struct sensor_combined_s &raw); + /** * Check for changes in vehicle status. */ @@ -398,6 +411,7 @@ Sensors::Sensors() : _rc_pub(-1), _battery_pub(-1), _airspeed_pub(-1), + _differential_pressure_pub(-1), /* performance counters */ _loop_perf(perf_alloc(PC_ELAPSED, "sensor task update")) @@ -887,6 +901,27 @@ Sensors::baro_poll(struct sensor_combined_s &raw) } } +void +Sensors::differential_pressure_poll(struct sensor_combined_s &raw) +{ + bool updated; + orb_check(_differential_pressure_sub, &updated); + + if (updated) { + orb_copy(ORB_ID(differential_pressure), _differential_pressure_sub, &_differential_pressure); + + float airspeed_true = calc_true_airspeed(_differential_pressure.differential_pressure_pa + raw.baro_pres_mbar*1e2f, + raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa + // XXX HACK - true temperature is much less than indicated temperature in baro, + // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB + + float airspeed_indicated = calc_indicated_airspeed(_differential_pressure.differential_pressure_pa); + + raw.differential_pressure_pa = _differential_pressure.differential_pressure_pa; + raw.differential_pressure_counter++; + } +} + void Sensors::vehicle_status_poll() { @@ -1045,31 +1080,18 @@ Sensors::adc_poll(struct sensor_combined_s &raw) */ if (voltage > 0.4f) { - float diff_pres_pa = (voltage - _parameters.airspeed_offset) * 1000.0f; //for MPXV7002DP sensor - - float airspeed_true = calc_true_airspeed(diff_pres_pa + _barometer.pressure*1e2f, - _barometer.pressure*1e2f, _barometer.temperature - 5.0f); //factor 1e2 for conversion from mBar to Pa - // XXX HACK - true temperature is much less than indicated temperature in baro, - // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB - - float airspeed_indicated = calc_indicated_airspeed(diff_pres_pa); - - //printf("voltage: %.4f, diff_pres_pa %.4f, baro press %.4f Pa, v_ind %.4f, v_true %.4f\n", (double)voltage, (double)diff_pres_pa, (double)_barometer.pressure*1e2f, (double)airspeed_indicated, (double)airspeed_true); + float diff_pres_pa = voltage * 1000.0f - _parameters.airspeed_offset; //for MPXV7002DP sensor _differential_pressure.timestamp = hrt_absolute_time(); - _differential_pressure.static_pressure_mbar = _barometer.pressure; - _differential_pressure.differential_pressure_mbar = diff_pres_pa*1e-2f; - _differential_pressure.temperature_celcius = _barometer.temperature; - _differential_pressure.indicated_airspeed_m_s = airspeed_indicated; - _differential_pressure.true_airspeed_m_s = airspeed_true; + _differential_pressure.differential_pressure_pa = diff_pres_pa; _differential_pressure.voltage = voltage; /* announce the airspeed if needed, just publish else */ - if (_airspeed_pub > 0) { - orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &_differential_pressure); + if (_differential_pressure_pub > 0) { + orb_publish(ORB_ID(differential_pressure), _differential_pressure_pub, &_differential_pressure); } else { - _airspeed_pub = orb_advertise(ORB_ID(differential_pressure), &_differential_pressure); + _differential_pressure_pub = orb_advertise(ORB_ID(differential_pressure), &_differential_pressure); } } } @@ -1334,6 +1356,7 @@ Sensors::task_main() gyro_poll(raw); mag_poll(raw); baro_poll(raw); + differential_pressure_poll(raw); parameter_update_poll(true /* forced */); diff --git a/apps/uORB/objects_common.cpp b/apps/uORB/objects_common.cpp index 1363751401..4197f6fb2d 100644 --- a/apps/uORB/objects_common.cpp +++ b/apps/uORB/objects_common.cpp @@ -122,6 +122,9 @@ ORB_DEFINE(optical_flow, struct optical_flow_s); #include "topics/omnidirectional_flow.h" ORB_DEFINE(omnidirectional_flow, struct omnidirectional_flow_s); +#include "topics/airspeed.h" +ORB_DEFINE(airspeed, struct airspeed_s); + #include "topics/differential_pressure.h" ORB_DEFINE(differential_pressure, struct differential_pressure_s); diff --git a/apps/uORB/topics/differential_pressure.h b/apps/uORB/topics/differential_pressure.h index d5e4bf37ef..ac52206192 100644 --- a/apps/uORB/topics/differential_pressure.h +++ b/apps/uORB/topics/differential_pressure.h @@ -49,16 +49,13 @@ */ /** - * Differential pressure and airspeed + * Differential pressure. */ struct differential_pressure_s { uint64_t timestamp; /**< microseconds since system boot, needed to integrate */ - float static_pressure_mbar; /**< Static / environment pressure */ - float differential_pressure_mbar; /**< Differential pressure reading */ - float temperature_celcius; /**< ambient temperature in celcius, -1 if unknown */ - float indicated_airspeed_m_s; /**< indicated airspeed in meters per second, -1 if unknown */ - float true_airspeed_m_s; /**< true airspeed in meters per second, -1 if unknown */ - float voltage; /**< Voltage from the airspeed sensor (voltage divider already compensated) */ + float differential_pressure_pa; /**< Differential pressure reading */ + float voltage; /**< Voltage from analog airspeed sensors (voltage divider already compensated) */ + }; /** diff --git a/apps/uORB/topics/sensor_combined.h b/apps/uORB/topics/sensor_combined.h index 961ee8b4a6..ad88e4b6e1 100644 --- a/apps/uORB/topics/sensor_combined.h +++ b/apps/uORB/topics/sensor_combined.h @@ -103,6 +103,8 @@ struct sensor_combined_s { float mcu_temp_celcius; /**< Internal temperature measurement of MCU */ uint32_t baro_counter; /**< Number of raw baro measurements taken */ + float differential_pressure_pa; /**< Airspeed sensor differential pressure */ + uint32_t differential_pressure_counter; /**< Number of raw differential pressure measurements taken */ }; /** From 696e48fbf38de9d0ac12494cb2749ba3b04f852f Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Fri, 19 Apr 2013 18:28:06 +0200 Subject: [PATCH 036/129] Cleanup variable names and such --- apps/commander/commander.c | 30 ++++++++-------- apps/drivers/ets_airspeed/ets_airspeed.cpp | 8 ++--- apps/sdlog/sdlog.c | 12 +++---- apps/sensors/sensor_params.c | 2 +- apps/sensors/sensors.cpp | 40 +++++++++++----------- apps/uORB/topics/sensor_combined.h | 2 +- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/apps/commander/commander.c b/apps/commander/commander.c index fcfffcfef7..2980ab118e 100644 --- a/apps/commander/commander.c +++ b/apps/commander/commander.c @@ -797,8 +797,8 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) const int calibration_count = 2500; - int sub_differential_pressure = orb_subscribe(ORB_ID(differential_pressure)); - struct differential_pressure_s differential_pressure; + int diff_pres_sub = orb_subscribe(ORB_ID(differential_pressure)); + struct differential_pressure_s diff_pres; int calibration_counter = 0; float diff_pres_offset = 0.0f; @@ -806,13 +806,13 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) while (calibration_counter < calibration_count) { /* wait blocking for new data */ - struct pollfd fds[1] = { { .fd = sub_differential_pressure, .events = POLLIN } }; + struct pollfd fds[1] = { { .fd = diff_pres_sub, .events = POLLIN } }; int poll_ret = poll(fds, 1, 1000); if (poll_ret) { - orb_copy(ORB_ID(differential_pressure), sub_differential_pressure, &differential_pressure); - diff_pres_offset += differential_pressure.differential_pressure_pa; + orb_copy(ORB_ID(differential_pressure), diff_pres_sub, &diff_pres); + diff_pres_offset += diff_pres.differential_pressure_pa; calibration_counter++; } else if (poll_ret == 0) { @@ -826,7 +826,7 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) if (isfinite(diff_pres_offset)) { - if (param_set(param_find("SENS_VAIR_OFF"), &(diff_pres_offset))) { + if (param_set(param_find("SENS_DPRES_OFF"), &(diff_pres_offset))) { mavlink_log_critical(mavlink_fd, "Setting offs failed!"); } @@ -856,7 +856,7 @@ void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) status->flag_preflight_airspeed_calibration = false; state_machine_publish(status_pub, status, mavlink_fd); - close(sub_differential_pressure); + close(diff_pres_sub); } @@ -1477,10 +1477,10 @@ int commander_thread_main(int argc, char *argv[]) struct sensor_combined_s sensors; memset(&sensors, 0, sizeof(sensors)); - int differential_pressure_sub = orb_subscribe(ORB_ID(differential_pressure)); - struct differential_pressure_s differential_pressure; - memset(&differential_pressure, 0, sizeof(differential_pressure)); - uint64_t last_differential_pressure_time = 0; + int diff_pres_sub = orb_subscribe(ORB_ID(differential_pressure)); + struct differential_pressure_s diff_pres; + memset(&diff_pres, 0, sizeof(diff_pres)); + uint64_t last_diff_pres_time = 0; /* Subscribe to command topic */ int cmd_sub = orb_subscribe(ORB_ID(vehicle_command)); @@ -1535,11 +1535,11 @@ int commander_thread_main(int argc, char *argv[]) orb_copy(ORB_ID(sensor_combined), sensor_sub, &sensors); } - orb_check(differential_pressure_sub, &new_data); + orb_check(diff_pres_sub, &new_data); if (new_data) { - orb_copy(ORB_ID(differential_pressure), differential_pressure_sub, &differential_pressure); - last_differential_pressure_time = differential_pressure.timestamp; + orb_copy(ORB_ID(differential_pressure), diff_pres_sub, &diff_pres); + last_diff_pres_time = diff_pres.timestamp; } orb_check(cmd_sub, &new_data); @@ -1754,7 +1754,7 @@ int commander_thread_main(int argc, char *argv[]) } /* Check for valid airspeed/differential pressure measurements */ - if (hrt_absolute_time() - last_differential_pressure_time < 2000000) { + if (hrt_absolute_time() - last_diff_pres_time < 2000000) { current_status.flag_airspeed_valid = true; } else { diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 860baa760c..943848d438 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -121,7 +121,7 @@ private: bool _sensor_ok; int _measure_ticks; bool _collect_phase; - int _differential_pressure_offset; + int _diff_pres_offset; orb_advert_t _airspeed_pub; @@ -191,7 +191,7 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")), - _differential_pressure_offset(0) + _diff_pres_offset(0) { // enable debug() calls _debug_enabled = true; @@ -235,7 +235,7 @@ ETS_AIRSPEED::init() if (_airspeed_pub < 0) debug("failed to create airspeed sensor object. Did you start uOrb?"); - param_get(param_find("SENS_VAIR_OFF"), &_differential_pressure_offset); + param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset); ret = OK; /* sensor is ok, but we don't really know if it is within range */ @@ -455,7 +455,7 @@ ETS_AIRSPEED::collect() uint16_t diff_pres_pa = val[1] << 8 | val[0]; /* adjust if necessary */ - diff_pres_pa -= _differential_pressure_offset; + diff_pres_pa -= _diff_pres_offset; //log("measurement: %0.2f m/s", calc_indicated_airspeed((float)_reports[_next_report].diff_pressure)); _reports[_next_report].timestamp = hrt_absolute_time(); diff --git a/apps/sdlog/sdlog.c b/apps/sdlog/sdlog.c index 46b232c34d..84a9eb6ac5 100644 --- a/apps/sdlog/sdlog.c +++ b/apps/sdlog/sdlog.c @@ -444,7 +444,7 @@ int sdlog_thread_main(int argc, char *argv[]) struct vehicle_vicon_position_s vicon_pos; struct optical_flow_s flow; struct battery_status_s batt; - struct differential_pressure_s diff_pressure; + struct differential_pressure_s diff_pres; struct airspeed_s airspeed; } buf; memset(&buf, 0, sizeof(buf)); @@ -463,7 +463,7 @@ int sdlog_thread_main(int argc, char *argv[]) int vicon_pos_sub; int flow_sub; int batt_sub; - int diff_pressure_sub; + int diff_pres_sub; int airspeed_sub; } subs; @@ -561,8 +561,8 @@ int sdlog_thread_main(int argc, char *argv[]) /* --- DIFFERENTIAL PRESSURE --- */ /* subscribe to ORB for flow measurements */ - subs.diff_pressure_sub = orb_subscribe(ORB_ID(differential_pressure)); - fds[fdsc_count].fd = subs.diff_pressure_sub; + subs.diff_pres_sub = orb_subscribe(ORB_ID(differential_pressure)); + fds[fdsc_count].fd = subs.diff_pres_sub; fds[fdsc_count].events = POLLIN; fdsc_count++; @@ -664,7 +664,7 @@ int sdlog_thread_main(int argc, char *argv[]) orb_copy(ORB_ID(vehicle_attitude), subs.att_sub, &buf.att); orb_copy(ORB_ID(vehicle_vicon_position), subs.vicon_pos_sub, &buf.vicon_pos); orb_copy(ORB_ID(optical_flow), subs.flow_sub, &buf.flow); - orb_copy(ORB_ID(differential_pressure), subs.diff_pressure_sub, &buf.diff_pressure); + orb_copy(ORB_ID(differential_pressure), subs.diff_pres_sub, &buf.diff_pres); orb_copy(ORB_ID(airspeed), subs.airspeed_sub, &buf.airspeed); orb_copy(ORB_ID(battery_status), subs.batt_sub, &buf.batt); @@ -702,7 +702,7 @@ int sdlog_thread_main(int argc, char *argv[]) .vicon = {buf.vicon_pos.x, buf.vicon_pos.y, buf.vicon_pos.z, buf.vicon_pos.roll, buf.vicon_pos.pitch, buf.vicon_pos.yaw}, .control_effective = {buf.act_controls_effective.control_effective[0], buf.act_controls_effective.control_effective[1], buf.act_controls_effective.control_effective[2], buf.act_controls_effective.control_effective[3]}, .flow = {buf.flow.flow_raw_x, buf.flow.flow_raw_y, buf.flow.flow_comp_x_m, buf.flow.flow_comp_y_m, buf.flow.ground_distance_m, buf.flow.quality}, - .diff_pressure = buf.diff_pressure.differential_pressure_pa, + .diff_pressure = buf.diff_pres.differential_pressure_pa, .ind_airspeed = buf.airspeed.indicated_airspeed_m_s, .true_airspeed = buf.airspeed.true_airspeed_m_s }; diff --git a/apps/sensors/sensor_params.c b/apps/sensors/sensor_params.c index a1ef9d136e..da2dfcca67 100644 --- a/apps/sensors/sensor_params.c +++ b/apps/sensors/sensor_params.c @@ -64,7 +64,7 @@ PARAM_DEFINE_FLOAT(SENS_ACC_XSCALE, 1.0f); PARAM_DEFINE_FLOAT(SENS_ACC_YSCALE, 1.0f); PARAM_DEFINE_FLOAT(SENS_ACC_ZSCALE, 1.0f); -PARAM_DEFINE_FLOAT(SENS_VAIR_OFF, 2.5f); +PARAM_DEFINE_FLOAT(SENS_DPRES_OFF, 2.5f); PARAM_DEFINE_FLOAT(RC1_MIN, 1000.0f); PARAM_DEFINE_FLOAT(RC1_TRIM, 1500.0f); diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp index 2cf3b92ef7..ab8818b40c 100644 --- a/apps/sensors/sensors.cpp +++ b/apps/sensors/sensors.cpp @@ -158,7 +158,7 @@ private: int _rc_sub; /**< raw rc channels data subscription */ int _baro_sub; /**< raw baro data subscription */ int _airspeed_sub; /**< airspeed subscription */ - int _differential_pressure_sub; /**< raw differential pressure subscription */ + int _diff_pres_sub; /**< raw differential pressure subscription */ int _vstatus_sub; /**< vehicle status subscription */ int _params_sub; /**< notification of parameter updates */ int _manual_control_sub; /**< notification of manual control updates */ @@ -168,14 +168,14 @@ private: orb_advert_t _rc_pub; /**< raw r/c control topic */ orb_advert_t _battery_pub; /**< battery status */ orb_advert_t _airspeed_pub; /**< airspeed */ - orb_advert_t _differential_pressure_pub; /**< differential_pressure */ + orb_advert_t _diff_pres_pub; /**< differential_pressure */ perf_counter_t _loop_perf; /**< loop performance counter */ struct rc_channels_s _rc; /**< r/c channel data */ struct battery_status_s _battery_status; /**< battery status */ struct baro_report _barometer; /**< barometer data */ - struct differential_pressure_s _differential_pressure; + struct differential_pressure_s _diff_pres; struct airspeed_s _airspeed; struct { @@ -341,7 +341,7 @@ private: * @param raw Combined sensor data structure into which * data should be returned. */ - void differential_pressure_poll(struct sensor_combined_s &raw); + void diff_pres_poll(struct sensor_combined_s &raw); /** * Check for changes in vehicle status. @@ -411,7 +411,7 @@ Sensors::Sensors() : _rc_pub(-1), _battery_pub(-1), _airspeed_pub(-1), - _differential_pressure_pub(-1), + _diff_pres_pub(-1), /* performance counters */ _loop_perf(perf_alloc(PC_ELAPSED, "sensor task update")) @@ -496,8 +496,8 @@ Sensors::Sensors() : _parameter_handles.mag_scale[1] = param_find("SENS_MAG_YSCALE"); _parameter_handles.mag_scale[2] = param_find("SENS_MAG_ZSCALE"); - /*Airspeed offset */ - _parameter_handles.airspeed_offset = param_find("SENS_VAIR_OFF"); + /* Differential pressure offset */ + _parameter_handles.airspeed_offset = param_find("SENS_DPRES_OFF"); _parameter_handles.battery_voltage_scaling = param_find("BAT_V_SCALING"); @@ -902,22 +902,22 @@ Sensors::baro_poll(struct sensor_combined_s &raw) } void -Sensors::differential_pressure_poll(struct sensor_combined_s &raw) +Sensors::diff_pres_poll(struct sensor_combined_s &raw) { bool updated; - orb_check(_differential_pressure_sub, &updated); + orb_check(_diff_pres_sub, &updated); if (updated) { - orb_copy(ORB_ID(differential_pressure), _differential_pressure_sub, &_differential_pressure); + orb_copy(ORB_ID(differential_pressure), _diff_pres_sub, &_diff_pres); - float airspeed_true = calc_true_airspeed(_differential_pressure.differential_pressure_pa + raw.baro_pres_mbar*1e2f, + float airspeed_true = calc_true_airspeed(_diff_pres.differential_pressure_pa + raw.baro_pres_mbar*1e2f, raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa // XXX HACK - true temperature is much less than indicated temperature in baro, // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB - float airspeed_indicated = calc_indicated_airspeed(_differential_pressure.differential_pressure_pa); + float airspeed_indicated = calc_indicated_airspeed(_diff_pres.differential_pressure_pa); - raw.differential_pressure_pa = _differential_pressure.differential_pressure_pa; + raw.differential_pressure_pa = _diff_pres.differential_pressure_pa; raw.differential_pressure_counter++; } } @@ -1082,16 +1082,16 @@ Sensors::adc_poll(struct sensor_combined_s &raw) float diff_pres_pa = voltage * 1000.0f - _parameters.airspeed_offset; //for MPXV7002DP sensor - _differential_pressure.timestamp = hrt_absolute_time(); - _differential_pressure.differential_pressure_pa = diff_pres_pa; - _differential_pressure.voltage = voltage; + _diff_pres.timestamp = hrt_absolute_time(); + _diff_pres.differential_pressure_pa = diff_pres_pa; + _diff_pres.voltage = voltage; /* announce the airspeed if needed, just publish else */ - if (_differential_pressure_pub > 0) { - orb_publish(ORB_ID(differential_pressure), _differential_pressure_pub, &_differential_pressure); + if (_diff_pres_pub > 0) { + orb_publish(ORB_ID(differential_pressure), _diff_pres_pub, &_diff_pres); } else { - _differential_pressure_pub = orb_advertise(ORB_ID(differential_pressure), &_differential_pressure); + _diff_pres_pub = orb_advertise(ORB_ID(differential_pressure), &_diff_pres); } } } @@ -1356,7 +1356,7 @@ Sensors::task_main() gyro_poll(raw); mag_poll(raw); baro_poll(raw); - differential_pressure_poll(raw); + diff_pres_poll(raw); parameter_update_poll(true /* forced */); diff --git a/apps/uORB/topics/sensor_combined.h b/apps/uORB/topics/sensor_combined.h index ad88e4b6e1..9a76b51829 100644 --- a/apps/uORB/topics/sensor_combined.h +++ b/apps/uORB/topics/sensor_combined.h @@ -103,7 +103,7 @@ struct sensor_combined_s { float mcu_temp_celcius; /**< Internal temperature measurement of MCU */ uint32_t baro_counter; /**< Number of raw baro measurements taken */ - float differential_pressure_pa; /**< Airspeed sensor differential pressure */ + float differential_pressure_pa; /**< Airspeed sensor differential pressure */ uint32_t differential_pressure_counter; /**< Number of raw differential pressure measurements taken */ }; From 853ba612b132f0a8f41fae1dbadc68ef3960f0d0 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Fri, 19 Apr 2013 18:28:47 +0200 Subject: [PATCH 037/129] Add missing uORB topic --- apps/uORB/topics/airspeed.h | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 apps/uORB/topics/airspeed.h diff --git a/apps/uORB/topics/airspeed.h b/apps/uORB/topics/airspeed.h new file mode 100644 index 0000000000..a3da3758fd --- /dev/null +++ b/apps/uORB/topics/airspeed.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * + * Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file airspeed.h + * + * Definition of airspeed topic + */ + +#ifndef TOPIC_AIRSPEED_H_ +#define TOPIC_AIRSPEED_H_ + +#include "../uORB.h" +#include + +/** + * @addtogroup topics + * @{ + */ + +/** + * Airspeed + */ +struct airspeed_s { + uint64_t timestamp; /**< microseconds since system boot, needed to integrate */ + float indicated_airspeed_m_s; /**< indicated airspeed in meters per second, -1 if unknown */ + float true_airspeed_m_s; /**< true airspeed in meters per second, -1 if unknown */ +}; + +/** + * @} + */ + +/* register this as object request broker structure */ +ORB_DECLARE(airspeed); + +#endif From 48f815860b5900f3770486d88aea9084c75441e0 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Sun, 21 Apr 2013 01:29:07 +0200 Subject: [PATCH 038/129] Debugging, cleanup and added airspeed to HoTT telemetry. --- apps/drivers/ets_airspeed/ets_airspeed.cpp | 31 ++++++++++++++++------ apps/hott_telemetry/messages.c | 12 +++++++++ apps/sensors/sensor_params.c | 2 +- apps/sensors/sensors.cpp | 30 +++++++++++++++------ apps/uORB/topics/differential_pressure.h | 7 ++--- 5 files changed, 62 insertions(+), 20 deletions(-) diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 943848d438..276f4bf593 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -81,7 +81,11 @@ #define READ_CMD 0x07 /* Read the data */ /* Max measurement rate is 100Hz */ -#define CONVERSION_INTERVAL (1000000 / 10) /* microseconds */ +#define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ + +/* The Eagle Tree Airspeed V3 can only provide accurate readings + for speeds from 15km/h upwards. */ +#define MIN_ACCURATE_DIFF_PRES_PA 12 /* oddly, ERROR is not defined for c++ */ #ifdef ERROR @@ -222,6 +226,8 @@ ETS_AIRSPEED::init() /* allocate basic report buffers */ _num_reports = 2; _reports = new struct differential_pressure_s[_num_reports]; + for (int i = 0; i < _num_reports; i++) + _reports[i].max_differential_pressure_pa = 0; if (_reports == nullptr) goto out; @@ -235,8 +241,6 @@ ETS_AIRSPEED::init() if (_airspeed_pub < 0) debug("failed to create airspeed sensor object. Did you start uOrb?"); - param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset); - ret = OK; /* sensor is ok, but we don't really know if it is within range */ _sensor_ok = true; @@ -454,13 +458,24 @@ ETS_AIRSPEED::collect() uint16_t diff_pres_pa = val[1] << 8 | val[0]; - /* adjust if necessary */ - diff_pres_pa -= _diff_pres_offset; - //log("measurement: %0.2f m/s", calc_indicated_airspeed((float)_reports[_next_report].diff_pressure)); + param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset); + if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) { + diff_pres_pa = 0; + } else { + diff_pres_pa -= _diff_pres_offset; + } + + // XXX we may want to smooth out the readings to remove noise. + _reports[_next_report].timestamp = hrt_absolute_time(); _reports[_next_report].differential_pressure_pa = diff_pres_pa; + // Track maximum differential pressure measured (so we can work out top speed). + if (diff_pres_pa > _reports[_next_report].max_differential_pressure_pa) { + _reports[_next_report].max_differential_pressure_pa = diff_pres_pa; + } + /* announce the airspeed if needed, just publish else */ orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &_reports[_next_report]); @@ -684,7 +699,7 @@ test() err(1, "immediate read failed"); warnx("single read"); - warnx("diff pressure: %0.3f pa", (double) report.differential_pressure_pa); + warnx("diff pressure: %d pa", report.differential_pressure_pa); /* start the sensor polling at 2Hz */ if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) @@ -709,7 +724,7 @@ test() err(1, "periodic read failed"); warnx("periodic read %u", i); - warnx("diff pressure: %0.3f pa", (double) report.differential_pressure_pa); + warnx("diff pressure: %d pa", report.differential_pressure_pa); } errx(0, "PASS"); diff --git a/apps/hott_telemetry/messages.c b/apps/hott_telemetry/messages.c index 8bfb997737..0e466e8209 100644 --- a/apps/hott_telemetry/messages.c +++ b/apps/hott_telemetry/messages.c @@ -42,9 +42,11 @@ #include #include #include +#include #include #include +static int airspeed_sub = -1; static int battery_sub = -1; static int sensor_sub = -1; @@ -52,6 +54,7 @@ void messages_init(void) { battery_sub = orb_subscribe(ORB_ID(battery_status)); sensor_sub = orb_subscribe(ORB_ID(sensor_combined)); + airspeed_sub = orb_subscribe(ORB_ID(airspeed)); } void build_eam_response(uint8_t *buffer, int *size) @@ -81,6 +84,15 @@ void build_eam_response(uint8_t *buffer, int *size) msg.altitude_L = (uint8_t)alt & 0xff; msg.altitude_H = (uint8_t)(alt >> 8) & 0xff; + /* get a local copy of the current sensor values */ + struct airspeed_s airspeed; + memset(&airspeed, 0, sizeof(airspeed)); + orb_copy(ORB_ID(airspeed), airspeed_sub, &airspeed); + + uint16_t speed = (uint16_t)(airspeed.indicated_airspeed_m_s * 3.6); + msg.speed_L = (uint8_t)speed & 0xff; + msg.speed_H = (uint8_t)(speed >> 8) & 0xff; + msg.stop = STOP_BYTE; memcpy(buffer, &msg, *size); diff --git a/apps/sensors/sensor_params.c b/apps/sensors/sensor_params.c index da2dfcca67..0bab992a78 100644 --- a/apps/sensors/sensor_params.c +++ b/apps/sensors/sensor_params.c @@ -64,7 +64,7 @@ PARAM_DEFINE_FLOAT(SENS_ACC_XSCALE, 1.0f); PARAM_DEFINE_FLOAT(SENS_ACC_YSCALE, 1.0f); PARAM_DEFINE_FLOAT(SENS_ACC_ZSCALE, 1.0f); -PARAM_DEFINE_FLOAT(SENS_DPRES_OFF, 2.5f); +PARAM_DEFINE_INT32(SENS_DPRES_OFF, 1667); PARAM_DEFINE_FLOAT(RC1_MIN, 1000.0f); PARAM_DEFINE_FLOAT(RC1_TRIM, 1500.0f); diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp index ab8818b40c..fcd1d869f9 100644 --- a/apps/sensors/sensors.cpp +++ b/apps/sensors/sensors.cpp @@ -192,7 +192,7 @@ private: float mag_scale[3]; float accel_offset[3]; float accel_scale[3]; - float airspeed_offset; + int diff_pres_offset_pa; int rc_type; @@ -241,7 +241,7 @@ private: param_t accel_scale[3]; param_t mag_offset[3]; param_t mag_scale[3]; - param_t airspeed_offset; + param_t diff_pres_offset_pa; param_t rc_map_roll; param_t rc_map_pitch; @@ -497,7 +497,7 @@ Sensors::Sensors() : _parameter_handles.mag_scale[2] = param_find("SENS_MAG_ZSCALE"); /* Differential pressure offset */ - _parameter_handles.airspeed_offset = param_find("SENS_DPRES_OFF"); + _parameter_handles.diff_pres_offset_pa = param_find("SENS_DPRES_OFF"); _parameter_handles.battery_voltage_scaling = param_find("BAT_V_SCALING"); @@ -707,7 +707,7 @@ Sensors::parameters_update() param_get(_parameter_handles.mag_scale[2], &(_parameters.mag_scale[2])); /* Airspeed offset */ - param_get(_parameter_handles.airspeed_offset, &(_parameters.airspeed_offset)); + param_get(_parameter_handles.diff_pres_offset_pa, &(_parameters.diff_pres_offset_pa)); /* scaling of ADC ticks to battery voltage */ if (param_get(_parameter_handles.battery_voltage_scaling, &(_parameters.battery_voltage_scaling)) != OK) { @@ -910,15 +910,26 @@ Sensors::diff_pres_poll(struct sensor_combined_s &raw) if (updated) { orb_copy(ORB_ID(differential_pressure), _diff_pres_sub, &_diff_pres); + raw.differential_pressure_pa = _diff_pres.differential_pressure_pa; + raw.differential_pressure_counter++; + float airspeed_true = calc_true_airspeed(_diff_pres.differential_pressure_pa + raw.baro_pres_mbar*1e2f, raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa // XXX HACK - true temperature is much less than indicated temperature in baro, // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB float airspeed_indicated = calc_indicated_airspeed(_diff_pres.differential_pressure_pa); - - raw.differential_pressure_pa = _diff_pres.differential_pressure_pa; - raw.differential_pressure_counter++; + + _airspeed.indicated_airspeed_m_s = airspeed_indicated; + _airspeed.true_airspeed_m_s = airspeed_true; + + /* announce the airspeed if needed, just publish else */ + if (_airspeed_pub > 0) { + orb_publish(ORB_ID(airspeed), _airspeed_pub, &_airspeed); + + } else { + _airspeed_pub = orb_advertise(ORB_ID(airspeed), &_airspeed); + } } } @@ -1080,7 +1091,7 @@ Sensors::adc_poll(struct sensor_combined_s &raw) */ if (voltage > 0.4f) { - float diff_pres_pa = voltage * 1000.0f - _parameters.airspeed_offset; //for MPXV7002DP sensor + float diff_pres_pa = voltage * 1000.0f - _parameters.diff_pres_offset_pa; //for MPXV7002DP sensor _diff_pres.timestamp = hrt_absolute_time(); _diff_pres.differential_pressure_pa = diff_pres_pa; @@ -1330,6 +1341,7 @@ Sensors::task_main() _mag_sub = orb_subscribe(ORB_ID(sensor_mag)); _rc_sub = orb_subscribe(ORB_ID(input_rc)); _baro_sub = orb_subscribe(ORB_ID(sensor_baro)); + _diff_pres_sub = orb_subscribe(ORB_ID(differential_pressure)); _vstatus_sub = orb_subscribe(ORB_ID(vehicle_status)); _params_sub = orb_subscribe(ORB_ID(parameter_update)); _manual_control_sub = orb_subscribe(ORB_ID(manual_control_setpoint)); @@ -1405,6 +1417,8 @@ Sensors::task_main() /* check battery voltage */ adc_poll(raw); + diff_pres_poll(raw); + /* Inform other processes that new data is available to copy */ if (_publishing) orb_publish(ORB_ID(sensor_combined), _sensor_pub, &raw); diff --git a/apps/uORB/topics/differential_pressure.h b/apps/uORB/topics/differential_pressure.h index ac52206192..8ce85213be 100644 --- a/apps/uORB/topics/differential_pressure.h +++ b/apps/uORB/topics/differential_pressure.h @@ -52,9 +52,10 @@ * Differential pressure. */ struct differential_pressure_s { - uint64_t timestamp; /**< microseconds since system boot, needed to integrate */ - float differential_pressure_pa; /**< Differential pressure reading */ - float voltage; /**< Voltage from analog airspeed sensors (voltage divider already compensated) */ + uint64_t timestamp; /**< microseconds since system boot, needed to integrate */ + uint16_t differential_pressure_pa; /**< Differential pressure reading */ + uint16_t max_differential_pressure_pa; /**< Maximum differential pressure reading */ + float voltage; /**< Voltage from analog airspeed sensors (voltage divider already compensated) */ }; From 715e3e2ebe0546edfa8c053ff90f4f1fdc521da7 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Mon, 22 Apr 2013 08:51:49 +0200 Subject: [PATCH 039/129] Cleanup --- apps/drivers/drv_airspeed.h | 14 -------------- apps/drivers/ets_airspeed/ets_airspeed.cpp | 17 ++++++++++------- apps/sensors/sensors.cpp | 18 +++++++++--------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/apps/drivers/drv_airspeed.h b/apps/drivers/drv_airspeed.h index 269ee45591..54213c0754 100644 --- a/apps/drivers/drv_airspeed.h +++ b/apps/drivers/drv_airspeed.h @@ -46,20 +46,6 @@ #define AIRSPEED_DEVICE_PATH "/dev/airspeed" -/** - * Airspeed report structure. Reads from the device must be in multiples of this - * structure. - */ -//struct airspeed_report { -// uint64_t timestamp; -// uint8_t diff_pressure; /** differential pressure in Pa */ -//}; - -/* - * ObjDev tag for raw range finder data. - */ -//ORB_DECLARE(sensor_differential_pressure); - /* * ioctl() definitions * diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 276f4bf593..88e0fbb13f 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -74,20 +74,22 @@ #include /* Configuration Constants */ -#define I2C_BUS PX4_I2C_BUS_ESC +#define I2C_BUS PX4_I2C_BUS_ESC // XXX Replace with PX4_I2C_BUS_EXPANSION before submitting. #define I2C_ADDRESS 0x75 /* ETS_AIRSPEED Registers addresses */ #define READ_CMD 0x07 /* Read the data */ -/* Max measurement rate is 100Hz */ +/* Measurement rate is 100Hz */ #define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ -/* The Eagle Tree Airspeed V3 can only provide accurate readings - for speeds from 15km/h upwards. */ +/** + * The Eagle Tree Airspeed V3 can only provide accurate readings + * for speeds from 15km/h upwards. + */ #define MIN_ACCURATE_DIFF_PRES_PA 12 -/* oddly, ERROR is not defined for c++ */ +/* Oddly, ERROR is not defined for C++ */ #ifdef ERROR # undef ERROR #endif @@ -109,8 +111,8 @@ public: virtual int ioctl(struct file *filp, int cmd, unsigned long arg); /** - * Diagnostics - print some basic information about the driver. - */ + * Diagnostics - print some basic information about the driver. + */ void print_info(); protected: @@ -163,6 +165,7 @@ private: void cycle(); int measure(); int collect(); + /** * Static trampoline from the workq context; because we don't have a * generic workq wrapper yet. diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp index fcd1d869f9..8b6f184737 100644 --- a/apps/sensors/sensors.cpp +++ b/apps/sensors/sensors.cpp @@ -99,6 +99,12 @@ #define BAT_VOL_LOWPASS_2 0.01f #define VOLTAGE_BATTERY_IGNORE_THRESHOLD_VOLTS 3.5f +/** + * HACK - true temperature is much less than indicated temperature in baro, + * subtract 5 degrees in an attempt to account for the electrical upheating of the PCB + */ +#define PCB_TEMP_ESTIMATE_DEG 5.0f + #define PPM_INPUT_TIMEOUT_INTERVAL 50000 /**< 50 ms timeout / 20 Hz */ #define limit_minus_one_to_one(arg) (arg < -1.0f) ? -1.0f : ((arg > 1.0f) ? 1.0f : arg) @@ -913,15 +919,9 @@ Sensors::diff_pres_poll(struct sensor_combined_s &raw) raw.differential_pressure_pa = _diff_pres.differential_pressure_pa; raw.differential_pressure_counter++; - float airspeed_true = calc_true_airspeed(_diff_pres.differential_pressure_pa + raw.baro_pres_mbar*1e2f, - raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - 5.0f); //factor 1e2 for conversion from mBar to Pa - // XXX HACK - true temperature is much less than indicated temperature in baro, - // subtract 5 degrees in an attempt to account for the electrical upheating of the PCB - - float airspeed_indicated = calc_indicated_airspeed(_diff_pres.differential_pressure_pa); - - _airspeed.indicated_airspeed_m_s = airspeed_indicated; - _airspeed.true_airspeed_m_s = airspeed_true; + _airspeed.indicated_airspeed_m_s = calc_indicated_airspeed(_diff_pres.differential_pressure_pa); + _airspeed.true_airspeed_m_s = calc_true_airspeed(_diff_pres.differential_pressure_pa + raw.baro_pres_mbar*1e2f, + raw.baro_pres_mbar*1e2f, raw.baro_temp_celcius - PCB_TEMP_ESTIMATE_DEG); /* announce the airspeed if needed, just publish else */ if (_airspeed_pub > 0) { From ad212ee628cd08c5c063757e4a5a2edc82392f3b Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Mon, 22 Apr 2013 15:00:15 +0200 Subject: [PATCH 040/129] More cleanups --- apps/drivers/ets_airspeed/ets_airspeed.cpp | 65 +++++++++++++++------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 88e0fbb13f..cede0534d1 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -73,22 +73,23 @@ #include #include -/* Configuration Constants */ -#define I2C_BUS PX4_I2C_BUS_ESC // XXX Replace with PX4_I2C_BUS_EXPANSION before submitting. -#define I2C_ADDRESS 0x75 +/* Default I2C bus */ +#define PX4_I2C_BUS_DEFAULT PX4_I2C_BUS_EXPANSION -/* ETS_AIRSPEED Registers addresses */ -#define READ_CMD 0x07 /* Read the data */ +/* I2C bus address */ +#define I2C_ADDRESS 0x75 /* 7-bit address. 8-bit address is 0xEA */ + +/* Register address */ +#define READ_CMD 0x07 /* Read the data */ -/* Measurement rate is 100Hz */ -#define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ - /** - * The Eagle Tree Airspeed V3 can only provide accurate readings - * for speeds from 15km/h upwards. + * The Eagle Tree Airspeed V3 cannot provide accurate reading below speeds of 15km/h. */ #define MIN_ACCURATE_DIFF_PRES_PA 12 +/* Measurement rate is 100Hz */ +#define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */ + /* Oddly, ERROR is not defined for C++ */ #ifdef ERROR # undef ERROR @@ -102,7 +103,7 @@ static const int ERROR = -1; class ETS_AIRSPEED : public device::I2C { public: - ETS_AIRSPEED(int bus = I2C_BUS, int address = I2C_ADDRESS); + ETS_AIRSPEED(int bus, int address = I2C_ADDRESS); virtual ~ETS_AIRSPEED(); virtual int init(); @@ -194,11 +195,11 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : _sensor_ok(false), _measure_ticks(0), _collect_phase(false), + _diff_pres_offset(0), _airspeed_pub(-1), _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), - _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")), - _diff_pres_offset(0) + _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")) { // enable debug() calls _debug_enabled = true; @@ -229,7 +230,7 @@ ETS_AIRSPEED::init() /* allocate basic report buffers */ _num_reports = 2; _reports = new struct differential_pressure_s[_num_reports]; - for (int i = 0; i < _num_reports; i++) + for (unsigned i = 0; i < _num_reports; i++) _reports[i].max_differential_pressure_pa = 0; if (_reports == nullptr) @@ -613,7 +614,7 @@ const int ERROR = -1; ETS_AIRSPEED *g_dev; -void start(); +void start(int i2c_bus); void stop(); void test(); void reset(); @@ -623,7 +624,7 @@ void info(); * Start the driver. */ void -start() +start(int i2c_bus) { int fd; @@ -631,7 +632,7 @@ start() errx(1, "already started"); /* create the driver */ - g_dev = new ETS_AIRSPEED(I2C_BUS); + g_dev = new ETS_AIRSPEED(i2c_bus); if (g_dev == nullptr) goto fail; @@ -664,7 +665,8 @@ fail: /** * Stop the driver */ -void stop() +void +stop() { if (g_dev != nullptr) { @@ -770,14 +772,36 @@ info() } // namespace + +static void +ets_airspeed_usage() +{ + fprintf(stderr, "usage: ets_airspeed [options] command\n"); + fprintf(stderr, "options:\n"); + fprintf(stderr, "\t-b --bus i2cbus (%d)\n", PX4_I2C_BUS_DEFAULT); + fprintf(stderr, "command:\n"); + fprintf(stderr, "\tstart|stop|reset|test|info\n"); +} + int ets_airspeed_main(int argc, char *argv[]) { + int i2c_bus = PX4_I2C_BUS_DEFAULT; + + int i; + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) { + if (argc > i + 1) { + i2c_bus = atoi(argv[i + 1]); + } + } + } + /* * Start/load the driver. */ if (!strcmp(argv[1], "start")) - ets_airspeed::start(); + ets_airspeed::start(i2c_bus); /* * Stop the driver @@ -803,5 +827,6 @@ ets_airspeed_main(int argc, char *argv[]) if (!strcmp(argv[1], "info") || !strcmp(argv[1], "status")) ets_airspeed::info(); - errx(1, "unrecognized command, try 'start', 'test', 'reset' or 'info'"); + ets_airspeed_usage(); + exit(0); } From 24630f15b6d0b465bd62f1105def4e96ffc92e10 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Mon, 22 Apr 2013 21:30:20 +0200 Subject: [PATCH 041/129] Yet more cleanups. --- apps/drivers/drv_airspeed.h | 1 + apps/drivers/ets_airspeed/Makefile | 2 +- apps/drivers/ets_airspeed/ets_airspeed.cpp | 8 ++++---- apps/px4io/controls.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/drivers/drv_airspeed.h b/apps/drivers/drv_airspeed.h index 54213c0754..bffc35c62c 100644 --- a/apps/drivers/drv_airspeed.h +++ b/apps/drivers/drv_airspeed.h @@ -33,6 +33,7 @@ /** * @file Airspeed driver interface. + * @author Simon Wilks */ #ifndef _DRV_AIRSPEED_H diff --git a/apps/drivers/ets_airspeed/Makefile b/apps/drivers/ets_airspeed/Makefile index 9089d97af2..f6639b470c 100644 --- a/apps/drivers/ets_airspeed/Makefile +++ b/apps/drivers/ets_airspeed/Makefile @@ -37,6 +37,6 @@ APPNAME = ets_airspeed PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +STACKSIZE = 1024 include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index cede0534d1..5bff4c7203 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ /** - * @file airspeed.cpp + * @file ets_airspeed.cpp * @author Simon Wilks * * Driver for the Eagle Tree Airspeed V3 connected via I2C. @@ -197,9 +197,9 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : _collect_phase(false), _diff_pres_offset(0), _airspeed_pub(-1), - _sample_perf(perf_alloc(PC_ELAPSED, "ETS_AIRSPEED_read")), - _comms_errors(perf_alloc(PC_COUNT, "ETS_AIRSPEED_comms_errors")), - _buffer_overflows(perf_alloc(PC_COUNT, "ETS_AIRSPEED_buffer_overflows")) + _sample_perf(perf_alloc(PC_ELAPSED, "ets_airspeed_read")), + _comms_errors(perf_alloc(PC_COUNT, "ets_airspeed_comms_errors")), + _buffer_overflows(perf_alloc(PC_COUNT, "ets_airspeed_buffer_overflows")) { // enable debug() calls _debug_enabled = true; diff --git a/apps/px4io/controls.c b/apps/px4io/controls.c index e519830710..dc36f6c934 100644 --- a/apps/px4io/controls.c +++ b/apps/px4io/controls.c @@ -70,7 +70,7 @@ controls_init(void) unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_OPTIONS] = 0; - r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MIN] = 950; + r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MIN] = 1000; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_CENTER] = 1500; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_MAX] = 2000; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_DEADZONE] = 30; From 5b60991c63b0c6b87632369fde73236263670448 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Tue, 23 Apr 2013 08:49:33 +0200 Subject: [PATCH 042/129] Style fix: ETS_AIRSPEED > ETSAirspeed --- apps/drivers/ets_airspeed/ets_airspeed.cpp | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/drivers/ets_airspeed/ets_airspeed.cpp b/apps/drivers/ets_airspeed/ets_airspeed.cpp index 5bff4c7203..e50395e479 100644 --- a/apps/drivers/ets_airspeed/ets_airspeed.cpp +++ b/apps/drivers/ets_airspeed/ets_airspeed.cpp @@ -100,11 +100,11 @@ static const int ERROR = -1; # error This requires CONFIG_SCHED_WORKQUEUE. #endif -class ETS_AIRSPEED : public device::I2C +class ETSAirspeed : public device::I2C { public: - ETS_AIRSPEED(int bus, int address = I2C_ADDRESS); - virtual ~ETS_AIRSPEED(); + ETSAirspeed(int bus, int address = I2C_ADDRESS); + virtual ~ETSAirspeed(); virtual int init(); @@ -186,8 +186,8 @@ private: */ extern "C" __EXPORT int ets_airspeed_main(int argc, char *argv[]); -ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : - I2C("ETS_AIRSPEED", AIRSPEED_DEVICE_PATH, bus, address, 100000), +ETSAirspeed::ETSAirspeed(int bus, int address) : + I2C("ETSAirspeed", AIRSPEED_DEVICE_PATH, bus, address, 100000), _num_reports(0), _next_report(0), _oldest_report(0), @@ -208,7 +208,7 @@ ETS_AIRSPEED::ETS_AIRSPEED(int bus, int address) : memset(&_work, 0, sizeof(_work)); } -ETS_AIRSPEED::~ETS_AIRSPEED() +ETSAirspeed::~ETSAirspeed() { /* make sure we are truly inactive */ stop(); @@ -219,7 +219,7 @@ ETS_AIRSPEED::~ETS_AIRSPEED() } int -ETS_AIRSPEED::init() +ETSAirspeed::init() { int ret = ERROR; @@ -253,13 +253,13 @@ out: } int -ETS_AIRSPEED::probe() +ETSAirspeed::probe() { return measure(); } int -ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) +ETSAirspeed::ioctl(struct file *filp, int cmd, unsigned long arg) { switch (cmd) { @@ -363,7 +363,7 @@ ETS_AIRSPEED::ioctl(struct file *filp, int cmd, unsigned long arg) } ssize_t -ETS_AIRSPEED::read(struct file *filp, char *buffer, size_t buflen) +ETSAirspeed::read(struct file *filp, char *buffer, size_t buflen) { unsigned count = buflen / sizeof(struct differential_pressure_s); int ret = 0; @@ -422,7 +422,7 @@ ETS_AIRSPEED::read(struct file *filp, char *buffer, size_t buflen) } int -ETS_AIRSPEED::measure() +ETSAirspeed::measure() { int ret; @@ -444,7 +444,7 @@ ETS_AIRSPEED::measure() } int -ETS_AIRSPEED::collect() +ETSAirspeed::collect() { int ret = -EIO; @@ -503,14 +503,14 @@ ETS_AIRSPEED::collect() } void -ETS_AIRSPEED::start() +ETSAirspeed::start() { /* reset the report ring and state machine */ _collect_phase = false; _oldest_report = _next_report = 0; /* schedule a cycle to start things */ - work_queue(HPWORK, &_work, (worker_t)&ETS_AIRSPEED::cycle_trampoline, this, 1); + work_queue(HPWORK, &_work, (worker_t)&ETSAirspeed::cycle_trampoline, this, 1); /* notify about state change */ struct subsystem_info_s info = { @@ -528,21 +528,21 @@ ETS_AIRSPEED::start() } void -ETS_AIRSPEED::stop() +ETSAirspeed::stop() { work_cancel(HPWORK, &_work); } void -ETS_AIRSPEED::cycle_trampoline(void *arg) +ETSAirspeed::cycle_trampoline(void *arg) { - ETS_AIRSPEED *dev = (ETS_AIRSPEED *)arg; + ETSAirspeed *dev = (ETSAirspeed *)arg; dev->cycle(); } void -ETS_AIRSPEED::cycle() +ETSAirspeed::cycle() { /* collection phase? */ if (_collect_phase) { @@ -566,7 +566,7 @@ ETS_AIRSPEED::cycle() /* schedule a fresh cycle call when we are ready to measure again */ work_queue(HPWORK, &_work, - (worker_t)&ETS_AIRSPEED::cycle_trampoline, + (worker_t)&ETSAirspeed::cycle_trampoline, this, _measure_ticks - USEC2TICK(CONVERSION_INTERVAL)); @@ -584,13 +584,13 @@ ETS_AIRSPEED::cycle() /* schedule a fresh cycle call when the measurement is done */ work_queue(HPWORK, &_work, - (worker_t)&ETS_AIRSPEED::cycle_trampoline, + (worker_t)&ETSAirspeed::cycle_trampoline, this, USEC2TICK(CONVERSION_INTERVAL)); } void -ETS_AIRSPEED::print_info() +ETSAirspeed::print_info() { perf_print_counter(_sample_perf); perf_print_counter(_comms_errors); @@ -612,7 +612,7 @@ namespace ets_airspeed #endif const int ERROR = -1; -ETS_AIRSPEED *g_dev; +ETSAirspeed *g_dev; void start(int i2c_bus); void stop(); @@ -632,7 +632,7 @@ start(int i2c_bus) errx(1, "already started"); /* create the driver */ - g_dev = new ETS_AIRSPEED(i2c_bus); + g_dev = new ETSAirspeed(i2c_bus); if (g_dev == nullptr) goto fail; From e37f471ac4ce52e724b0d89714d9db6e1d16ee8e Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Thu, 25 Apr 2013 23:59:46 +0400 Subject: [PATCH 043/129] 6-point accelerometer calibration implemented --- apps/commander/accelerometer_calibration.c | 414 +++++++++++++++++++++ apps/commander/accelerometer_calibration.h | 19 + apps/commander/commander.c | 125 +------ 3 files changed, 435 insertions(+), 123 deletions(-) create mode 100644 apps/commander/accelerometer_calibration.c create mode 100644 apps/commander/accelerometer_calibration.h diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c new file mode 100644 index 0000000000..f950398815 --- /dev/null +++ b/apps/commander/accelerometer_calibration.c @@ -0,0 +1,414 @@ +/* + * accelerometer_calibration.c + * + * Copyright (C) 2013 Anton Babushkin. All rights reserved. + * Author: Anton Babushkin + * + * Transform acceleration vector to true orientation and scale + * + * * * * Model * * * + * accel_corr = accel_T * (accel_raw - accel_offs) + * + * accel_corr[3] - fully corrected acceleration vector in body frame + * accel_T[3][3] - accelerometers transform matrix, rotation and scaling transform + * accel_raw[3] - raw acceleration vector + * accel_offs[3] - acceleration offset vector + * + * * * * Calibration * * * + * + * Reference vectors + * accel_corr_ref[6][3] = [ g 0 0 ] // nose up + * | -g 0 0 | // nose down + * | 0 g 0 | // left side down + * | 0 -g 0 | // right side down + * | 0 0 g | // on back + * [ 0 0 -g ] // level + * accel_raw_ref[6][3] + * + * accel_corr_ref[i] = accel_T * (accel_raw_ref[i] - accel_offs), i = 0...5 + * + * 6 reference vectors * 3 axes = 18 equations + * 9 (accel_T) + 3 (accel_offs) = 12 unknown constants + * + * Find accel_offs + * + * accel_offs[i] = (accel_raw_ref[i*2][i] + accel_raw_ref[i*2+1][i]) / 2 + * + * + * Find accel_T + * + * 9 unknown constants + * need 9 equations -> use 3 of 6 measurements -> 3 * 3 = 9 equations + * + * accel_corr_ref[i*2] = accel_T * (accel_raw_ref[i*2] - accel_offs), i = 0...2 + * + * Solve separate system for each row of accel_T: + * + * accel_corr_ref[j*2][i] = accel_T[i] * (accel_raw_ref[j*2] - accel_offs), j = 0...2 + * + * A * x = b + * + * x = [ accel_T[0][i] ] + * | accel_T[1][i] | + * [ accel_T[2][i] ] + * + * b = [ accel_corr_ref[0][i] ] // One measurement per axis is enough + * | accel_corr_ref[2][i] | + * [ accel_corr_ref[4][i] ] + * + * a[i][j] = accel_raw_ref[i][j] - accel_offs[j], i = 0;2;4, j = 0...2 + * + * Matrix A is common for all three systems: + * A = [ a[0][0] a[0][1] a[0][2] ] + * | a[2][0] a[2][1] a[2][2] | + * [ a[4][0] a[4][1] a[4][2] ] + * + * x = A^-1 * b + * + * accel_T = A^-1 * g + * g = 9.80665 + */ + +#include "accelerometer_calibration.h" + +#include +#include +#include +#include +#include +#include + +void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd) { + /* announce change */ + mavlink_log_info(mavlink_fd, "accelerometer calibration started"); + /* set to accel calibration mode */ + status->flag_preflight_accel_calibration = true; + state_machine_publish(status_pub, status, mavlink_fd); + + float accel_offs_scaled[3]; + float accel_scale[3]; + int res = do_accel_calibration_mesurements(mavlink_fd, accel_offs_scaled, accel_scale); + if (res == OK) { + /* measurements complete successfully, set parameters */ + if (param_set(param_find("SENS_ACC_XOFF"), &(accel_offs_scaled[0])) + || param_set(param_find("SENS_ACC_YOFF"), &(accel_offs_scaled[1])) + || param_set(param_find("SENS_ACC_ZOFF"), &(accel_offs_scaled[2])) + || param_set(param_find("SENS_ACC_XSCALE"), &(accel_scale[0])) + || param_set(param_find("SENS_ACC_YSCALE"), &(accel_scale[1])) + || param_set(param_find("SENS_ACC_ZSCALE"), &(accel_scale[2]))) { + mavlink_log_critical(mavlink_fd, "Setting offs or scale failed!"); + } + + int fd = open(ACCEL_DEVICE_PATH, 0); + struct accel_scale ascale = { + accel_offs_scaled[0], + accel_scale[0], + accel_offs_scaled[1], + accel_scale[1], + accel_offs_scaled[2], + accel_scale[2], + }; + + if (OK != ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&ascale)) + warn("WARNING: failed to set scale / offsets for accel"); + + close(fd); + + /* auto-save to EEPROM */ + int save_ret = param_save_default(); + + if (save_ret != 0) { + warn("WARNING: auto-save of params to storage failed"); + } + + mavlink_log_info(mavlink_fd, "accel calibration done"); + + tune_confirm(); + sleep(2); + tune_confirm(); + sleep(2); + /* third beep by cal end routine */ + } else { + /* measurements error */ + mavlink_log_info(mavlink_fd, "accel calibration aborted"); + tune_error(); + sleep(2); + } + + /* exit accel calibration mode */ + status->flag_preflight_accel_calibration = false; + state_machine_publish(status_pub, status, mavlink_fd); +} + +int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], float accel_scale[3]) { + const int samples_num = 2500; + + int sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined)); + + int16_t accel_raw_ref[6][3]; + bool data_collected[6] = { false, false, false, false, false, false }; + const char *orientation_strs[6] = { "x+", "x-", "y+", "y-", "z+", "z-" }; + while (true) { + bool done = true; + char str[80]; + int str_ptr; + str_ptr = sprintf(str, "keep vehicle still:"); + for (int i = 0; i < 6; i++) { + if (!data_collected[i]) { + str_ptr += sprintf(&(str[str_ptr]), " %s", orientation_strs[i]); + done = false; + } + } + if (done) { + mavlink_log_info(mavlink_fd, "all accel measurements complete"); + break; + } else { + mavlink_log_info(mavlink_fd, str); + int orient = detect_orientation(mavlink_fd, sensor_combined_sub); + if (orient < 0) { + sprintf(str, "orientation detection error: %i", orient); + mavlink_log_info(mavlink_fd, str); + return ERROR; + } + mavlink_log_info(mavlink_fd, "accel measurement started"); + read_accelerometer_raw_avg(sensor_combined_sub, &(accel_raw_ref[orient][0]), samples_num); + //mavlink_log_info(mavlink_fd, "accel measurement complete"); + str_ptr = sprintf(str, "complete: %i [ %i %i %i ]", orient, accel_raw_ref[orient][0], accel_raw_ref[orient][1], accel_raw_ref[orient][2]); + mavlink_log_info(mavlink_fd, str); + data_collected[orient] = true; + tune_confirm(); + } + } + close(sensor_combined_sub); + + /* calculate offsets and rotation+scale matrix */ + int16_t accel_offs[3]; + float accel_T[3][3]; + int res = calculate_calibration_values(accel_raw_ref, accel_T, accel_offs, CONSTANTS_ONE_G); + if (res != 0) { + mavlink_log_info(mavlink_fd, "calibration values calculation error"); + return ERROR; + } + + char str[80]; + sprintf(str, "accel offsets: [ %i %i %i ]", accel_offs[0], accel_offs[1], accel_offs[2]); + mavlink_log_info(mavlink_fd, str); + //mavlink_log_info(mavlink_fd, "accel transform matrix:"); + for (int i = 0; i < 3; i++) { + //sprintf(str, "\t[ %0.6f %0.6f %0.6f ]", accel_T[i][0], accel_T[i][1], accel_T[i][2]); + //mavlink_log_info(mavlink_fd, str); + } + + /* convert raw accel offset to scaled and transform matrix to scales + * rotation part of transform matrix is not used by now */ + for (int i = 0; i < 3; i++) { + accel_offs_scaled[i] = accel_offs[i] * accel_T[i][i]; + accel_scale[i] = accel_T[i][i]; + } + + return OK; +} + +/* + * Wait for vehicle become still and detect it's orientation. + * + * @return 0..5 according to orientation when vehicle is still and ready for measurements, + * ERROR if vehicle is not still after 10s or orientation error is more than 20% + */ +int detect_orientation(int mavlink_fd, int sub_sensor_combined) { + struct sensor_combined_s sensor; + /* exponential moving average of accel */ + float accel_ema[3] = { 0.0f, 0.0f, 0.0f }; + /* max-hold dispersion of accel */ + float accel_disp[3] = { 0.0f, 0.0f, 0.0f }; + float accel_len2 = 0.0f; + /* EMA time constant in seconds*/ + float ema_len = 0.2f; + /* set "still" threshold to 0.005 m/s^2 */ + float still_thr2 = pow(0.05f / CONSTANTS_ONE_G, 2); + /* set accel error threshold to 20% of accel vector length */ + float accel_err_thr = 0.2f; + /* still time required in us */ + int64_t still_time = 2000000; + struct pollfd fds[1] = { { .fd = sub_sensor_combined, .events = POLLIN } }; + + hrt_abstime t_start = hrt_absolute_time(); + /* set deadline to 20s */ + hrt_abstime timeout = 20000000; + hrt_abstime t_timeout = t_start + timeout; + hrt_abstime t = t_start; + hrt_abstime t_prev = t_start; + hrt_abstime t_still = 0; + while (true) { + /* wait blocking for new data */ + int poll_ret = poll(fds, 1, 1000); + if (poll_ret) { + orb_copy(ORB_ID(sensor_combined), sub_sensor_combined, &sensor); + t = hrt_absolute_time(); + float dt = (t - t_prev) / 1000000.0f; + t_prev = t; + float w = dt / ema_len; + for (int i = 0; i < 3; i++) { + accel_ema[i] = accel_ema[i] * (1.0f - w) + sensor.accelerometer_raw[i] * w; + float d = (float) sensor.accelerometer_raw[i] - accel_ema[i]; + d = d * d; + accel_disp[i] = accel_disp[i] * (1.0f - w); + if (d > accel_disp[i]) + accel_disp[i] = d; + } + accel_len2 = accel_ema[0] * accel_ema[0] + accel_ema[1] * accel_ema[1] + accel_ema[2] * accel_ema[2]; + float still_thr_raw2 = still_thr2 * accel_len2; + if ( accel_disp[0] < still_thr_raw2 && + accel_disp[1] < still_thr_raw2 && + accel_disp[2] < still_thr_raw2 ) { + /* is still now */ + if (t_still == 0) { + /* first time */ + mavlink_log_info(mavlink_fd, "still"); + t_still = t; + t_timeout = t + timeout; + } else { + /* still since t_still */ + if ((int64_t) t - (int64_t) t_still > still_time) { + /* vehicle is still, exit from the loop to detection of its orientation */ + break; + } + } + } else { + /* not still, reset still start time */ + if (t_still != 0) { + mavlink_log_info(mavlink_fd, "moving"); + t_still = 0; + } + } + } else if (poll_ret == 0) { + /* any poll failure for 1s is a reason to abort */ + mavlink_log_info(mavlink_fd, "ERROR: poll failure"); + return -3; + } + if (t > t_timeout) { + mavlink_log_info(mavlink_fd, "ERROR: timeout"); + return -1; + } + } + float accel_len = sqrt(accel_len2); + float accel_err_thr_raw = accel_len * accel_err_thr; + char str[80]; + sprintf(str, "ema: [ %.1f %.1f %.1f ]", accel_ema[0], accel_ema[1], accel_ema[2]); + mavlink_log_info(mavlink_fd, str); + sprintf(str, "disp: [ %.1f %.1f %.1f ]", accel_disp[0], accel_disp[1], accel_disp[2]); + mavlink_log_info(mavlink_fd, str); + if ( fabs(accel_ema[0] - accel_len) < accel_err_thr_raw && + fabs(accel_ema[1]) < accel_err_thr_raw && + fabs(accel_ema[2]) < accel_err_thr_raw ) + return 0; // [ g, 0, 0 ] + if ( fabs(accel_ema[0] + accel_len) < accel_err_thr_raw && + fabs(accel_ema[1]) < accel_err_thr_raw && + fabs(accel_ema[2]) < accel_err_thr_raw ) + return 1; // [ -g, 0, 0 ] + if ( fabs(accel_ema[0]) < accel_err_thr_raw && + fabs(accel_ema[1] - accel_len) < accel_err_thr_raw && + fabs(accel_ema[2]) < accel_err_thr_raw ) + return 2; // [ 0, g, 0 ] + if ( fabs(accel_ema[0]) < accel_err_thr_raw && + fabs(accel_ema[1] + accel_len) < accel_err_thr_raw && + fabs(accel_ema[2]) < accel_err_thr_raw ) + return 3; // [ 0, -g, 0 ] + if ( abs(accel_ema[0]) < accel_err_thr_raw && + abs(accel_ema[1]) < accel_err_thr_raw && + abs(accel_ema[2] - accel_len) < accel_err_thr_raw ) + return 4; // [ 0, 0, g ] + if ( abs(accel_ema[0]) < accel_err_thr_raw && + abs(accel_ema[1]) < accel_err_thr_raw && + abs(accel_ema[2] + accel_len) < accel_err_thr_raw ) + return 5; // [ 0, 0, -g ] + mavlink_log_info(mavlink_fd, "ERROR: invalid orientation"); + return -2; // Can't detect orientation +} + +/* + * Read specified number of accelerometer samples, calculate average and dispersion. + */ +int read_accelerometer_raw_avg(int sensor_combined_sub, int16_t accel_avg[3], int samples_num) { + struct pollfd fds[1] = { { .fd = sensor_combined_sub, .events = POLLIN } }; + int count = 0; + int32_t accel_sum[3] = { 0, 0, 0 }; + while (count < samples_num) { + int poll_ret = poll(fds, 1, 1000); + if (poll_ret == 1) { + struct sensor_combined_s sensor; + orb_copy(ORB_ID(sensor_combined), sensor_combined_sub, &sensor); + for (int i = 0; i < 3; i++) { + accel_sum[i] += sensor.accelerometer_raw[i]; + } + count++; + } else { + return ERROR; + } + } + for (int i = 0; i < 3; i++) { + accel_avg[i] = (accel_sum[i] + count / 2) / count; + } + /* calculate dispersion */ + return OK; +} + +/* + * Convert raw values from accelerometers to m/s^2. + */ +void acceleration_raw_to_m_s2(float accel_corr[3], int16_t accel_raw[3], + float accel_T[3][3], int16_t accel_offs[3]) { + for (int i = 0; i < 3; i++) { + accel_corr[i] = 0.0f; + for (int j = 0; j < 3; j++) { + accel_corr[i] += accel_T[i][j] * (accel_raw[j] - accel_offs[j]); + } + } +} + +int mat_invert3(float src[3][3], float dst[3][3]) { + float det = src[0][0] * (src[1][1] * src[2][2] - src[1][2] * src[2][1]) - + src[0][1] * (src[1][0] * src[2][2] - src[1][2] * src[2][0]) + + src[0][2] * (src[1][0] * src[2][1] - src[1][1] * src[2][0]); + if (det == 0.0) + return -1; // Singular matrix + dst[0][0] = (src[1][1] * src[2][2] - src[1][2] * src[2][1]) / det; + dst[1][0] = (src[1][2] * src[2][0] - src[1][0] * src[2][2]) / det; + dst[2][0] = (src[1][0] * src[2][1] - src[1][1] * src[2][0]) / det; + dst[0][1] = (src[0][2] * src[2][1] - src[0][1] * src[2][2]) / det; + dst[1][1] = (src[0][0] * src[2][2] - src[0][2] * src[2][0]) / det; + dst[2][1] = (src[0][1] * src[2][0] - src[0][0] * src[2][1]) / det; + dst[0][2] = (src[0][1] * src[1][2] - src[0][2] * src[1][1]) / det; + dst[1][2] = (src[0][2] * src[1][0] - src[0][0] * src[1][2]) / det; + dst[2][2] = (src[0][0] * src[1][1] - src[0][1] * src[1][0]) / det; + return 0; +} + +int calculate_calibration_values(int16_t accel_raw_ref[6][3], + float accel_T[3][3], int16_t accel_offs[3], float g) { + /* calculate raw offsets */ + for (int i = 0; i < 3; i++) { + accel_offs[i] = (int16_t) (((int32_t) (accel_raw_ref[i * 2][i]) + + (int32_t) (accel_raw_ref[i * 2 + 1][i])) / 2); + } + /* fill matrix A for linear equations system*/ + float mat_A[3][3]; + memset(mat_A, 0, sizeof(mat_A)); + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + float a = (accel_raw_ref[i * 2][j] - accel_offs[j]); + mat_A[i][j] = a; + } + } + /* calculate inverse matrix for A */ + float mat_A_inv[3][3]; + mat_invert3(mat_A, mat_A_inv); + for (int i = 0; i < 3; i++) { + /* copy results to accel_T */ + for (int j = 0; j < 3; j++) { + /* simplify matrices mult because b has only one non-zero element == g at index i */ + accel_T[j][i] = mat_A_inv[j][i] * g; + } + } + return 0; +} diff --git a/apps/commander/accelerometer_calibration.h b/apps/commander/accelerometer_calibration.h new file mode 100644 index 0000000000..acf45b6b6e --- /dev/null +++ b/apps/commander/accelerometer_calibration.h @@ -0,0 +1,19 @@ +/* + * accelerometer_calibration.h + * + * Created on: 25.04.2013 + * Author: ton + */ + +#ifndef ACCELEROMETER_CALIBRATION_H_ +#define ACCELEROMETER_CALIBRATION_H_ + +#include +#include + +void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd); +int detect_orientation(int mavlink_fd, int sub_sensor_combined); +int mat_invert3(float src[3][3], float dst[3][3]); +int calculate_calibration_values(int16_t accel_raw_ref[6][3], float accel_T[3][3], int16_t accel_offs[3], float g); + +#endif /* ACCELEROMETER_CALIBRATION_H_ */ diff --git a/apps/commander/commander.c b/apps/commander/commander.c index 7c0a25f862..0f18d6cef5 100644 --- a/apps/commander/commander.c +++ b/apps/commander/commander.c @@ -94,7 +94,7 @@ #include #include "calibration_routines.h" - +#include "accelerometer_calibration.h" PARAM_DEFINE_INT32(SYS_FAILSAVE_LL, 0); /**< Go into low-level failsafe after 0 ms */ //PARAM_DEFINE_INT32(SYS_FAILSAVE_HL, 0); /**< Go into high-level failsafe after 0 ms */ @@ -158,7 +158,6 @@ static int led_off(int led); static void do_gyro_calibration(int status_pub, struct vehicle_status_s *status); static void do_mag_calibration(int status_pub, struct vehicle_status_s *status); static void do_rc_calibration(int status_pub, struct vehicle_status_s *status); -static void do_accel_calibration(int status_pub, struct vehicle_status_s *status); static void handle_command(int status_pub, struct vehicle_status_s *current_status, struct vehicle_command_s *cmd); int trigger_audio_alarm(uint8_t old_mode, uint8_t old_state, uint8_t new_mode, uint8_t new_state); @@ -666,126 +665,6 @@ void do_gyro_calibration(int status_pub, struct vehicle_status_s *status) close(sub_sensor_combined); } -void do_accel_calibration(int status_pub, struct vehicle_status_s *status) -{ - /* announce change */ - - mavlink_log_info(mavlink_fd, "keep it level and still"); - /* set to accel calibration mode */ - status->flag_preflight_accel_calibration = true; - state_machine_publish(status_pub, status, mavlink_fd); - - const int calibration_count = 2500; - - int sub_sensor_combined = orb_subscribe(ORB_ID(sensor_combined)); - struct sensor_combined_s raw; - - int calibration_counter = 0; - float accel_offset[3] = {0.0f, 0.0f, 0.0f}; - - int fd = open(ACCEL_DEVICE_PATH, 0); - struct accel_scale ascale_null = { - 0.0f, - 1.0f, - 0.0f, - 1.0f, - 0.0f, - 1.0f, - }; - - if (OK != ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&ascale_null)) - warn("WARNING: failed to set scale / offsets for accel"); - - close(fd); - - while (calibration_counter < calibration_count) { - - /* wait blocking for new data */ - struct pollfd fds[1] = { { .fd = sub_sensor_combined, .events = POLLIN } }; - - int poll_ret = poll(fds, 1, 1000); - - if (poll_ret) { - orb_copy(ORB_ID(sensor_combined), sub_sensor_combined, &raw); - accel_offset[0] += raw.accelerometer_m_s2[0]; - accel_offset[1] += raw.accelerometer_m_s2[1]; - accel_offset[2] += raw.accelerometer_m_s2[2]; - calibration_counter++; - - } else if (poll_ret == 0) { - /* any poll failure for 1s is a reason to abort */ - mavlink_log_info(mavlink_fd, "acceleration calibration aborted"); - return; - } - } - - accel_offset[0] = accel_offset[0] / calibration_count; - accel_offset[1] = accel_offset[1] / calibration_count; - accel_offset[2] = accel_offset[2] / calibration_count; - - if (isfinite(accel_offset[0]) && isfinite(accel_offset[1]) && isfinite(accel_offset[2])) { - - /* add the removed length from x / y to z, since we induce a scaling issue else */ - float total_len = sqrtf(accel_offset[0] * accel_offset[0] + accel_offset[1] * accel_offset[1] + accel_offset[2] * accel_offset[2]); - - /* if length is correct, zero results here */ - accel_offset[2] = accel_offset[2] + total_len; - - float scale = 9.80665f / total_len; - - if (param_set(param_find("SENS_ACC_XOFF"), &(accel_offset[0])) - || param_set(param_find("SENS_ACC_YOFF"), &(accel_offset[1])) - || param_set(param_find("SENS_ACC_ZOFF"), &(accel_offset[2])) - || param_set(param_find("SENS_ACC_XSCALE"), &(scale)) - || param_set(param_find("SENS_ACC_YSCALE"), &(scale)) - || param_set(param_find("SENS_ACC_ZSCALE"), &(scale))) { - mavlink_log_critical(mavlink_fd, "Setting offs or scale failed!"); - } - - fd = open(ACCEL_DEVICE_PATH, 0); - struct accel_scale ascale = { - accel_offset[0], - scale, - accel_offset[1], - scale, - accel_offset[2], - scale, - }; - - if (OK != ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&ascale)) - warn("WARNING: failed to set scale / offsets for accel"); - - close(fd); - - /* auto-save to EEPROM */ - int save_ret = param_save_default(); - - if (save_ret != 0) { - warn("WARNING: auto-save of params to storage failed"); - } - - //char buf[50]; - //sprintf(buf, "[cmd] accel cal: x:%8.4f y:%8.4f z:%8.4f\n", (double)accel_offset[0], (double)accel_offset[1], (double)accel_offset[2]); - //mavlink_log_info(mavlink_fd, buf); - mavlink_log_info(mavlink_fd, "accel calibration done"); - - tune_confirm(); - sleep(2); - tune_confirm(); - sleep(2); - /* third beep by cal end routine */ - - } else { - mavlink_log_info(mavlink_fd, "accel calibration FAILED (NaN)"); - } - - /* exit accel calibration mode */ - status->flag_preflight_accel_calibration = false; - state_machine_publish(status_pub, status, mavlink_fd); - - close(sub_sensor_combined); -} - void do_airspeed_calibration(int status_pub, struct vehicle_status_s *status) { /* announce change */ @@ -1040,7 +919,7 @@ void handle_command(int status_pub, struct vehicle_status_s *current_vehicle_sta if (current_status.state_machine == SYSTEM_STATE_PREFLIGHT) { mavlink_log_info(mavlink_fd, "CMD starting accel cal"); tune_confirm(); - do_accel_calibration(status_pub, ¤t_status); + do_accel_calibration(status_pub, ¤t_status, mavlink_fd); tune_confirm(); mavlink_log_info(mavlink_fd, "CMD finished accel cal"); do_state_update(status_pub, ¤t_status, mavlink_fd, SYSTEM_STATE_STANDBY); From 593e3252dd90b2437862aba1c8a54b5c6edb5600 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Fri, 26 Apr 2013 13:52:25 +0400 Subject: [PATCH 044/129] Added hysteresis to still detector --- apps/commander/accelerometer_calibration.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c index f950398815..9e7a3b99e0 100644 --- a/apps/commander/accelerometer_calibration.c +++ b/apps/commander/accelerometer_calibration.c @@ -274,7 +274,9 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { break; } } - } else { + } else if ( accel_disp[0] > still_thr_raw2 * 2.0f || + accel_disp[1] > still_thr_raw2 * 2.0f || + accel_disp[2] > still_thr_raw2 * 2.0f) { /* not still, reset still start time */ if (t_still != 0) { mavlink_log_info(mavlink_fd, "moving"); From 26f9a1d42c6402a283a679e66236f247fd274cd2 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Fri, 26 Apr 2013 15:25:17 +0400 Subject: [PATCH 045/129] abs/fabs bugfix, logging cleanup --- apps/commander/accelerometer_calibration.c | 80 ++++++++-------------- 1 file changed, 29 insertions(+), 51 deletions(-) diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c index 9e7a3b99e0..f607b6da69 100644 --- a/apps/commander/accelerometer_calibration.c +++ b/apps/commander/accelerometer_calibration.c @@ -80,7 +80,7 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd) { /* announce change */ - mavlink_log_info(mavlink_fd, "accelerometer calibration started"); + mavlink_log_info(mavlink_fd, "accel calibration started"); /* set to accel calibration mode */ status->flag_preflight_accel_calibration = true; state_machine_publish(status_pub, status, mavlink_fd); @@ -96,7 +96,7 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m || param_set(param_find("SENS_ACC_XSCALE"), &(accel_scale[0])) || param_set(param_find("SENS_ACC_YSCALE"), &(accel_scale[1])) || param_set(param_find("SENS_ACC_ZSCALE"), &(accel_scale[2]))) { - mavlink_log_critical(mavlink_fd, "Setting offs or scale failed!"); + mavlink_log_critical(mavlink_fd, "ERROR: setting offs or scale failed"); } int fd = open(ACCEL_DEVICE_PATH, 0); @@ -122,7 +122,6 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m } mavlink_log_info(mavlink_fd, "accel calibration done"); - tune_confirm(); sleep(2); tune_confirm(); @@ -142,12 +141,11 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], float accel_scale[3]) { const int samples_num = 2500; - - int sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined)); - int16_t accel_raw_ref[6][3]; bool data_collected[6] = { false, false, false, false, false, false }; const char *orientation_strs[6] = { "x+", "x-", "y+", "y-", "z+", "z-" }; + + int sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined)); while (true) { bool done = true; char str[80]; @@ -159,25 +157,21 @@ int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], done = false; } } - if (done) { - mavlink_log_info(mavlink_fd, "all accel measurements complete"); + if (done) break; - } else { - mavlink_log_info(mavlink_fd, str); - int orient = detect_orientation(mavlink_fd, sensor_combined_sub); - if (orient < 0) { - sprintf(str, "orientation detection error: %i", orient); - mavlink_log_info(mavlink_fd, str); - return ERROR; - } - mavlink_log_info(mavlink_fd, "accel measurement started"); - read_accelerometer_raw_avg(sensor_combined_sub, &(accel_raw_ref[orient][0]), samples_num); - //mavlink_log_info(mavlink_fd, "accel measurement complete"); - str_ptr = sprintf(str, "complete: %i [ %i %i %i ]", orient, accel_raw_ref[orient][0], accel_raw_ref[orient][1], accel_raw_ref[orient][2]); - mavlink_log_info(mavlink_fd, str); - data_collected[orient] = true; - tune_confirm(); - } + mavlink_log_info(mavlink_fd, str); + + int orient = detect_orientation(mavlink_fd, sensor_combined_sub); + if (orient < 0) + return ERROR; + + sprintf(str, "meas started: %s", orientation_strs[orient]); + mavlink_log_info(mavlink_fd, str); + read_accelerometer_raw_avg(sensor_combined_sub, &(accel_raw_ref[orient][0]), samples_num); + str_ptr = sprintf(str, "meas result for %s: [ %i %i %i ]", orientation_strs[orient], accel_raw_ref[orient][0], accel_raw_ref[orient][1], accel_raw_ref[orient][2]); + mavlink_log_info(mavlink_fd, str); + data_collected[orient] = true; + tune_confirm(); } close(sensor_combined_sub); @@ -186,26 +180,16 @@ int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], float accel_T[3][3]; int res = calculate_calibration_values(accel_raw_ref, accel_T, accel_offs, CONSTANTS_ONE_G); if (res != 0) { - mavlink_log_info(mavlink_fd, "calibration values calculation error"); + mavlink_log_info(mavlink_fd, "ERROR: calibration values calc error"); return ERROR; } - char str[80]; - sprintf(str, "accel offsets: [ %i %i %i ]", accel_offs[0], accel_offs[1], accel_offs[2]); - mavlink_log_info(mavlink_fd, str); - //mavlink_log_info(mavlink_fd, "accel transform matrix:"); - for (int i = 0; i < 3; i++) { - //sprintf(str, "\t[ %0.6f %0.6f %0.6f ]", accel_T[i][0], accel_T[i][1], accel_T[i][2]); - //mavlink_log_info(mavlink_fd, str); - } - /* convert raw accel offset to scaled and transform matrix to scales * rotation part of transform matrix is not used by now */ for (int i = 0; i < 3; i++) { accel_offs_scaled[i] = accel_offs[i] * accel_T[i][i]; accel_scale[i] = accel_T[i][i]; } - return OK; } @@ -226,8 +210,8 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { float ema_len = 0.2f; /* set "still" threshold to 0.005 m/s^2 */ float still_thr2 = pow(0.05f / CONSTANTS_ONE_G, 2); - /* set accel error threshold to 20% of accel vector length */ - float accel_err_thr = 0.2f; + /* set accel error threshold to 30% of accel vector length */ + float accel_err_thr = 0.3f; /* still time required in us */ int64_t still_time = 2000000; struct pollfd fds[1] = { { .fd = sub_sensor_combined, .events = POLLIN } }; @@ -264,7 +248,7 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { /* is still now */ if (t_still == 0) { /* first time */ - mavlink_log_info(mavlink_fd, "still"); + mavlink_log_info(mavlink_fd, "still..."); t_still = t; t_timeout = t + timeout; } else { @@ -279,7 +263,7 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { accel_disp[2] > still_thr_raw2 * 2.0f) { /* not still, reset still start time */ if (t_still != 0) { - mavlink_log_info(mavlink_fd, "moving"); + mavlink_log_info(mavlink_fd, "moving..."); t_still = 0; } } @@ -289,17 +273,11 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { return -3; } if (t > t_timeout) { - mavlink_log_info(mavlink_fd, "ERROR: timeout"); return -1; } } float accel_len = sqrt(accel_len2); float accel_err_thr_raw = accel_len * accel_err_thr; - char str[80]; - sprintf(str, "ema: [ %.1f %.1f %.1f ]", accel_ema[0], accel_ema[1], accel_ema[2]); - mavlink_log_info(mavlink_fd, str); - sprintf(str, "disp: [ %.1f %.1f %.1f ]", accel_disp[0], accel_disp[1], accel_disp[2]); - mavlink_log_info(mavlink_fd, str); if ( fabs(accel_ema[0] - accel_len) < accel_err_thr_raw && fabs(accel_ema[1]) < accel_err_thr_raw && fabs(accel_ema[2]) < accel_err_thr_raw ) @@ -316,13 +294,13 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { fabs(accel_ema[1] + accel_len) < accel_err_thr_raw && fabs(accel_ema[2]) < accel_err_thr_raw ) return 3; // [ 0, -g, 0 ] - if ( abs(accel_ema[0]) < accel_err_thr_raw && - abs(accel_ema[1]) < accel_err_thr_raw && - abs(accel_ema[2] - accel_len) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr_raw && + fabs(accel_ema[1]) < accel_err_thr_raw && + fabs(accel_ema[2] - accel_len) < accel_err_thr_raw ) return 4; // [ 0, 0, g ] - if ( abs(accel_ema[0]) < accel_err_thr_raw && - abs(accel_ema[1]) < accel_err_thr_raw && - abs(accel_ema[2] + accel_len) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr_raw && + fabs(accel_ema[1]) < accel_err_thr_raw && + fabs(accel_ema[2] + accel_len) < accel_err_thr_raw ) return 5; // [ 0, 0, -g ] mavlink_log_info(mavlink_fd, "ERROR: invalid orientation"); return -2; // Can't detect orientation From 01e427b17c161d8adaa38d6bdb91aecb434451f2 Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 26 Apr 2013 16:14:32 -0700 Subject: [PATCH 046/129] Merge working changes into export-build branch. --- .gitignore | 4 + Makefile | 37 +- ROMFS/px4fmu_common/init.d/rc.FMU_quad_x | 67 ++ ROMFS/px4fmu_common/init.d/rc.PX4IO | 80 +++ ROMFS/px4fmu_common/init.d/rc.PX4IOAR | 98 +++ ROMFS/px4fmu_common/init.d/rc.boarddetect | 66 ++ ROMFS/px4fmu_common/init.d/rc.jig | 10 + ROMFS/px4fmu_common/init.d/rc.logging | 9 + ROMFS/px4fmu_common/init.d/rc.sensors | 34 + ROMFS/px4fmu_common/init.d/rc.standalone | 13 + ROMFS/px4fmu_common/init.d/rcS | 79 +++ .../logging/logconv.m | 0 .../mixers/FMU_AERT.mix | 0 .../mixers/FMU_AET.mix | 0 .../mixers/FMU_Q.mix | 0 .../mixers/FMU_RET.mix | 0 .../mixers/FMU_X5.mix | 0 .../mixers/FMU_delta.mix | 0 .../mixers/FMU_hex_+.mix | 0 .../mixers/FMU_hex_x.mix | 0 .../mixers/FMU_octo_+.mix | 0 .../mixers/FMU_octo_x.mix | 0 .../mixers/FMU_pass.mix | 0 .../mixers/FMU_quad_+.mix | 0 .../mixers/FMU_quad_x.mix | 0 .../mixers/README | 0 Tools/px_uploader.py | 587 +++++++++--------- apps/attitude_estimator_ekf/Makefile | 57 -- apps/commander/.context | 0 apps/commander/Makefile | 45 -- apps/drivers/boards/px4fmu/Makefile | 41 -- apps/drivers/px4fmu/Makefile | 44 -- apps/sensors/sensors.cpp | 2 + apps/systemcmds/eeprom/Makefile | 45 -- makefiles/board_px4fmu.mk | 2 +- makefiles/board_px4io.mk | 2 +- makefiles/config_px4fmu_default.mk | 28 +- makefiles/firmware.mk | 65 +- makefiles/module.mk | 34 +- makefiles/nuttx.mk | 7 +- makefiles/setup.mk | 34 +- makefiles/toolchain_gnu-arm-eabi.mk | 1 + makefiles/upload.mk | 6 +- nuttx/configs/px4fmu/include/board.h | 6 + nuttx/configs/px4fmu/nsh/appconfig | 7 +- nuttx/configs/px4fmu/nsh/defconfig | 2 +- .../ardrone_interface/ardrone_interface.c | 0 .../ardrone_interface/ardrone_motor_control.c | 0 .../ardrone_interface/ardrone_motor_control.h | 0 .../drivers/ardrone_interface/module.mk | 12 +- src/drivers/boards/px4fmu/module.mk | 9 + .../drivers/boards/px4fmu/px4fmu_can.c | 5 +- .../drivers/boards/px4fmu/px4fmu_init.c | 37 +- .../drivers/boards/px4fmu/px4fmu_internal.h | 7 +- .../drivers/boards/px4fmu/px4fmu_led.c | 0 .../drivers/boards/px4fmu/px4fmu_pwm_servo.c | 0 .../drivers/boards/px4fmu/px4fmu_spi.c | 18 + .../drivers/boards/px4fmu/px4fmu_usb.c | 0 {apps => src}/drivers/l3gd20/l3gd20.cpp | 0 src/drivers/l3gd20/module.mk | 6 + {apps => src}/drivers/px4fmu/fmu.cpp | 0 src/drivers/px4fmu/module.mk | 6 + src/include/visibility.h | 62 ++ .../attitude_estimator_ekf_main.cpp | 0 .../attitude_estimator_ekf_params.c | 0 .../attitude_estimator_ekf_params.h | 0 .../codegen/attitudeKalmanfilter.c | 0 .../codegen/attitudeKalmanfilter.h | 0 .../codegen/attitudeKalmanfilter_initialize.c | 0 .../codegen/attitudeKalmanfilter_initialize.h | 0 .../codegen/attitudeKalmanfilter_terminate.c | 0 .../codegen/attitudeKalmanfilter_terminate.h | 0 .../codegen/attitudeKalmanfilter_types.h | 0 .../attitude_estimator_ekf/codegen/cross.c | 0 .../attitude_estimator_ekf/codegen/cross.h | 0 .../attitude_estimator_ekf/codegen/eye.c | 0 .../attitude_estimator_ekf/codegen/eye.h | 0 .../attitude_estimator_ekf/codegen/mrdivide.c | 0 .../attitude_estimator_ekf/codegen/mrdivide.h | 0 .../attitude_estimator_ekf/codegen/norm.c | 0 .../attitude_estimator_ekf/codegen/norm.h | 0 .../attitude_estimator_ekf/codegen/rdivide.c | 0 .../attitude_estimator_ekf/codegen/rdivide.h | 0 .../attitude_estimator_ekf/codegen/rtGetInf.c | 0 .../attitude_estimator_ekf/codegen/rtGetInf.h | 0 .../attitude_estimator_ekf/codegen/rtGetNaN.c | 0 .../attitude_estimator_ekf/codegen/rtGetNaN.h | 0 .../codegen/rt_defines.h | 0 .../codegen/rt_nonfinite.c | 0 .../codegen/rt_nonfinite.h | 0 .../attitude_estimator_ekf/codegen/rtwtypes.h | 0 src/modules/attitude_estimator_ekf/module.mk | 16 + .../modules}/commander/calibration_routines.c | 0 .../modules}/commander/calibration_routines.h | 0 {apps => src/modules}/commander/commander.c | 0 {apps => src/modules}/commander/commander.h | 0 .../modules/commander/module.mk | 13 +- .../modules}/commander/state_machine_helper.c | 0 .../modules}/commander/state_machine_helper.h | 0 {apps => src}/systemcmds/eeprom/24xxxx_mtd.c | 0 {apps => src}/systemcmds/eeprom/eeprom.c | 0 src/systemcmds/eeprom/module.mk | 6 + 102 files changed, 1088 insertions(+), 621 deletions(-) create mode 100644 ROMFS/px4fmu_common/init.d/rc.FMU_quad_x create mode 100644 ROMFS/px4fmu_common/init.d/rc.PX4IO create mode 100644 ROMFS/px4fmu_common/init.d/rc.PX4IOAR create mode 100644 ROMFS/px4fmu_common/init.d/rc.boarddetect create mode 100644 ROMFS/px4fmu_common/init.d/rc.jig create mode 100644 ROMFS/px4fmu_common/init.d/rc.logging create mode 100644 ROMFS/px4fmu_common/init.d/rc.sensors create mode 100644 ROMFS/px4fmu_common/init.d/rc.standalone create mode 100755 ROMFS/px4fmu_common/init.d/rcS rename ROMFS/{px4fmu_default => px4fmu_common}/logging/logconv.m (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_AERT.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_AET.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_Q.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_RET.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_X5.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_delta.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_hex_+.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_hex_x.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_octo_+.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_octo_x.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_pass.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_quad_+.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/FMU_quad_x.mix (100%) rename ROMFS/{px4fmu_default => px4fmu_common}/mixers/README (100%) delete mode 100755 apps/attitude_estimator_ekf/Makefile delete mode 100644 apps/commander/.context delete mode 100644 apps/commander/Makefile delete mode 100644 apps/drivers/boards/px4fmu/Makefile delete mode 100644 apps/drivers/px4fmu/Makefile delete mode 100644 apps/systemcmds/eeprom/Makefile rename {apps => src/drivers}/ardrone_interface/ardrone_interface.c (100%) rename {apps => src/drivers}/ardrone_interface/ardrone_motor_control.c (100%) rename {apps => src/drivers}/ardrone_interface/ardrone_motor_control.h (100%) rename apps/drivers/l3gd20/Makefile => src/drivers/ardrone_interface/module.mk (88%) create mode 100644 src/drivers/boards/px4fmu/module.mk rename {apps => src}/drivers/boards/px4fmu/px4fmu_can.c (99%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_init.c (87%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_internal.h (98%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_led.c (100%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_pwm_servo.c (100%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_spi.c (93%) rename {apps => src}/drivers/boards/px4fmu/px4fmu_usb.c (100%) rename {apps => src}/drivers/l3gd20/l3gd20.cpp (100%) create mode 100644 src/drivers/l3gd20/module.mk rename {apps => src}/drivers/px4fmu/fmu.cpp (100%) create mode 100644 src/drivers/px4fmu/module.mk create mode 100644 src/include/visibility.h rename {apps => src/modules}/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp (100%) rename {apps => src/modules}/attitude_estimator_ekf/attitude_estimator_ekf_params.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/attitude_estimator_ekf_params.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/cross.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/cross.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/eye.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/eye.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/mrdivide.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/mrdivide.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/norm.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/norm.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rdivide.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rdivide.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rtGetInf.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rtGetInf.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rtGetNaN.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rtGetNaN.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rt_defines.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rt_nonfinite.c (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rt_nonfinite.h (100%) rename {apps => src/modules}/attitude_estimator_ekf/codegen/rtwtypes.h (100%) create mode 100644 src/modules/attitude_estimator_ekf/module.mk rename {apps => src/modules}/commander/calibration_routines.c (100%) rename {apps => src/modules}/commander/calibration_routines.h (100%) rename {apps => src/modules}/commander/commander.c (100%) rename {apps => src/modules}/commander/commander.h (100%) rename apps/ardrone_interface/Makefile => src/modules/commander/module.mk (88%) rename {apps => src/modules}/commander/state_machine_helper.c (100%) rename {apps => src/modules}/commander/state_machine_helper.h (100%) rename {apps => src}/systemcmds/eeprom/24xxxx_mtd.c (100%) rename {apps => src}/systemcmds/eeprom/eeprom.c (100%) create mode 100644 src/systemcmds/eeprom/module.mk diff --git a/.gitignore b/.gitignore index 46b347f72e..de03b0a607 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .built +.context *.context *.bdat *.pdat @@ -56,3 +57,6 @@ core mkdeps Archives Build +!ROMFS/*/*.d +!ROMFS/*/*/*.d +!ROMFS/*/*/*/*.d diff --git a/Makefile b/Makefile index d0ffeb7402..8f566a0020 100644 --- a/Makefile +++ b/Makefile @@ -42,12 +42,12 @@ include $(PX4_BASE)makefiles/setup.mk # # Canned firmware configurations that we build. # -CONFIGS ?= px4fmu_default px4io_default +CONFIGS ?= $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)config_*.mk)))) # # Boards that we build NuttX export kits for. # -BOARDS = px4fmu px4io +BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)board_*.mk)))) # # Debugging @@ -62,11 +62,26 @@ MQUIET = --no-print-directory # # If the user has listed a config as a target, strip it out and override CONFIGS. # +FIRMWARE_GOAL = firmware EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) ifneq ($(EXPLICIT_CONFIGS),) CONFIGS := $(EXPLICIT_CONFIGS) .PHONY: $(EXPLICIT_CONFIGS) $(EXPLICIT_CONFIGS): all + +# +# If the user has asked to upload, they must have also specified exactly one +# config. +# +ifneq ($(filter upload,$(MAKECMDGOALS)),) +ifneq ($(words $(EXPLICIT_CONFIGS)),1) +$(error In order to upload, exactly one board config must be specified) +endif +FIRMWARE_GOAL = upload +.PHONY: upload +upload: + @: +endif endif # @@ -95,11 +110,11 @@ $(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4: @echo %%%% Building $(config) in $(work_dir) @echo %%%% $(Q) mkdir -p $(work_dir) - $(Q) make -C $(work_dir) \ + $(Q) make -r -C $(work_dir) \ -f $(PX4_MK_DIR)firmware.mk \ CONFIG=$(config) \ WORK_DIR=$(work_dir) \ - firmware + $(FIRMWARE_GOAL) # # Build the NuttX export archives. @@ -118,15 +133,21 @@ NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)$(board).export) .PHONY: archives archives: $(NUTTX_ARCHIVES) +# We cannot build these parallel; note that we also force -j1 for the +# sub-make invocations. +ifneq ($(filter archives,$(MAKECMDGOALS)),) +.NOTPARALLEL: +endif + $(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@)) $(ARCHIVE_DIR)%.export: configuration = $(if $(filter $(board),px4io),io,nsh) $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC) $(NUTTX_APPS) @echo %% Configuring NuttX for $(board) $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) - $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean + $(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean $(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration)) @echo %% Exporting NuttX for $(board) - $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export + $(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) export $(Q) mkdir -p $(dir $@) $(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@ @@ -162,9 +183,7 @@ help: @echo "" @echo " all" @echo " Build all firmware configs: $(CONFIGS)" - @echo " A limited set of configs can be built with:" - @echo "" - @echo " CONFIGS=" + @echo " A limited set of configs can be built with CONFIGS=" @echo "" @for config in $(CONFIGS); do \ echo " $$config"; \ diff --git a/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x new file mode 100644 index 0000000000..8787443ea2 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x @@ -0,0 +1,67 @@ +#!nsh +# +# Flight startup script for PX4FMU with PWM outputs. +# + +# Disable the USB interface +set USB no + +# Disable autostarting other apps +set MODE custom + +echo "[init] doing PX4FMU Quad startup..." + +# +# Start the ORB +# +uorb start + +# +# Load microSD params +# +echo "[init] loading microSD params" +param select /fs/microsd/parameters +if [ -f /fs/microsd/parameters ] +then + param load /fs/microsd/parameters +fi + +# +# Force some key parameters to sane values +# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor +# see https://pixhawk.ethz.ch/mavlink/ +# +param set MAV_TYPE 2 + +# +# Start MAVLink +# +mavlink start -d /dev/ttyS0 -b 57600 +usleep 5000 + +# +# Start the sensors and test them. +# +sh /etc/init.d/rc.sensors + +# +# Start the commander. +# +commander start + +# +# Start the attitude estimator +# +attitude_estimator_ekf start + +echo "[init] starting PWM output" +fmu mode_pwm +mixer load /dev/pwm_output /etc/mixers/FMU_quad_x.mix + +# +# Start attitude control +# +multirotor_att_control start + +echo "[init] startup done, exiting" +exit \ No newline at end of file diff --git a/ROMFS/px4fmu_common/init.d/rc.PX4IO b/ROMFS/px4fmu_common/init.d/rc.PX4IO new file mode 100644 index 0000000000..1e3963b9ad --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IO @@ -0,0 +1,80 @@ +#!nsh + +# Disable USB and autostart +set USB no +set MODE camflyer + +# +# Start the ORB +# +uorb start + +# +# Load microSD params +# +echo "[init] loading microSD params" +param select /fs/microsd/parameters +if [ -f /fs/microsd/parameters ] +then + param load /fs/microsd/parameters +fi + +# +# Force some key parameters to sane values +# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor +# see https://pixhawk.ethz.ch/mavlink/ +# +param set MAV_TYPE 1 + +# +# Start the sensors. +# +sh /etc/init.d/rc.sensors + +# +# Start MAVLink +# +mavlink start -d /dev/ttyS1 -b 57600 +usleep 5000 + +# +# Start the commander. +# +commander start + +# +# Start GPS interface +# +gps start + +# +# Start the attitude estimator +# +kalman_demo start + +# +# Start PX4IO interface +# +px4io start + +# +# Load mixer and start controllers +# +mixer load /dev/pwm_output /etc/mixers/FMU_Q.mix +control_demo start + +# +# Start logging +# +sdlog start -s 10 + +# +# Start system state +# +if blinkm start +then + echo "using BlinkM for state indication" + blinkm systemstate +else + echo "no BlinkM found, OK." +fi diff --git a/ROMFS/px4fmu_common/init.d/rc.PX4IOAR b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR new file mode 100644 index 0000000000..72df68e350 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR @@ -0,0 +1,98 @@ +#!nsh +# +# Flight startup script for PX4FMU on PX4IOAR carrier board. +# + +# Disable the USB interface +set USB no + +# Disable autostarting other apps +set MODE ardrone + +echo "[init] doing PX4IOAR startup..." + +# +# Start the ORB +# +uorb start + +# +# Init the parameter storage +# +echo "[init] loading microSD params" +param select /fs/microsd/parameters +if [ -f /fs/microsd/parameters ] +then + param load /fs/microsd/parameters +fi + +# +# Force some key parameters to sane values +# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor +# see https://pixhawk.ethz.ch/mavlink/ +# +param set MAV_TYPE 2 + +# +# Start the sensors. +# +sh /etc/init.d/rc.sensors + +# +# Start MAVLink +# +mavlink start -d /dev/ttyS0 -b 57600 +usleep 5000 + +# +# Start the commander. +# +commander start + +# +# Start the attitude estimator +# +attitude_estimator_ekf start + +# +# Configure PX4FMU for operation with PX4IOAR +# +fmu mode_gpio_serial + +# +# Fire up the multi rotor attitude controller +# +multirotor_att_control start + +# +# Fire up the AR.Drone interface. +# +ardrone_interface start -d /dev/ttyS1 + +# +# Start GPS capture +# +gps start + +# +# Start logging +# +sdlog start -s 10 + +# +# Start system state +# +if blinkm start +then + echo "using BlinkM for state indication" + blinkm systemstate +else + echo "no BlinkM found, OK." +fi + +# +# startup is done; we don't want the shell because we +# use the same UART for telemetry +# +echo "[init] startup done" +exit \ No newline at end of file diff --git a/ROMFS/px4fmu_common/init.d/rc.boarddetect b/ROMFS/px4fmu_common/init.d/rc.boarddetect new file mode 100644 index 0000000000..f233e51df4 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.boarddetect @@ -0,0 +1,66 @@ +#!nsh +# +# If we are still in flight mode, work out what airframe +# configuration we have and start up accordingly. +# +if [ $MODE != autostart ] +then + echo "[init] automatic startup cancelled by user script" +else + echo "[init] detecting attached hardware..." + + # + # Assume that we are PX4FMU in standalone mode + # + set BOARD PX4FMU + + # + # Are we attached to a PX4IOAR (AR.Drone carrier board)? + # + if boardinfo test name PX4IOAR + then + set BOARD PX4IOAR + if [ -f /etc/init.d/rc.PX4IOAR ] + then + echo "[init] reading /etc/init.d/rc.PX4IOAR" + usleep 500 + sh /etc/init.d/rc.PX4IOAR + fi + else + echo "[init] PX4IOAR not detected" + fi + + # + # Are we attached to a PX4IO? + # + if boardinfo test name PX4IO + then + set BOARD PX4IO + if [ -f /etc/init.d/rc.PX4IO ] + then + echo "[init] reading /etc/init.d/rc.PX4IO" + usleep 500 + sh /etc/init.d/rc.PX4IO + fi + else + echo "[init] PX4IO not detected" + fi + + # + # Looks like we are stand-alone + # + if [ $BOARD == PX4FMU ] + then + echo "[init] no expansion board detected" + if [ -f /etc/init.d/rc.standalone ] + then + echo "[init] reading /etc/init.d/rc.standalone" + sh /etc/init.d/rc.standalone + fi + fi + + # + # We may not reach here if the airframe-specific script exits the shell. + # + echo "[init] startup done." +fi \ No newline at end of file diff --git a/ROMFS/px4fmu_common/init.d/rc.jig b/ROMFS/px4fmu_common/init.d/rc.jig new file mode 100644 index 0000000000..e2b5d8f30d --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.jig @@ -0,0 +1,10 @@ +#!nsh +# +# Test jig startup script +# + +echo "[testing] doing production test.." + +tests jig + +echo "[testing] testing done" diff --git a/ROMFS/px4fmu_common/init.d/rc.logging b/ROMFS/px4fmu_common/init.d/rc.logging new file mode 100644 index 0000000000..09c2d00d19 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.logging @@ -0,0 +1,9 @@ +#!nsh +# +# Initialise logging services. +# + +if [ -d /fs/microsd ] +then + sdlog start +fi diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors new file mode 100644 index 0000000000..42c2f52e94 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -0,0 +1,34 @@ +#!nsh +# +# Standard startup script for PX4FMU onboard sensor drivers. +# + +# +# Start sensor drivers here. +# + +ms5611 start +adc start + +if mpu6000 start +then + echo "using MPU6000 and HMC5883L" + hmc5883 start +else + echo "using L3GD20 and LSM303D" + l3gd20 start + lsm303 start +fi + +# +# Start the sensor collection task. +# IMPORTANT: this also loads param offsets +# ALWAYS start this task before the +# preflight_check. +# +sensors start + +# +# Check sensors - run AFTER 'sensors start' +# +preflight_check \ No newline at end of file diff --git a/ROMFS/px4fmu_common/init.d/rc.standalone b/ROMFS/px4fmu_common/init.d/rc.standalone new file mode 100644 index 0000000000..67e95215b9 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.standalone @@ -0,0 +1,13 @@ +#!nsh +# +# Flight startup script for PX4FMU standalone configuration. +# + +echo "[init] doing standalone PX4FMU startup..." + +# +# Start the ORB +# +uorb start + +echo "[init] startup done" diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS new file mode 100755 index 0000000000..89a7678797 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -0,0 +1,79 @@ +#!nsh +# +# PX4FMU 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 + +# +# Start playing the startup tune +# +tone_alarm start + +# +# 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" +else + echo "[init] no microSD card found" +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 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 ] +then + echo Running rc.APM + # if APM startup is successful then nsh will exit + sh /etc/init.d/rc.APM +fi diff --git a/ROMFS/px4fmu_default/logging/logconv.m b/ROMFS/px4fmu_common/logging/logconv.m similarity index 100% rename from ROMFS/px4fmu_default/logging/logconv.m rename to ROMFS/px4fmu_common/logging/logconv.m diff --git a/ROMFS/px4fmu_default/mixers/FMU_AERT.mix b/ROMFS/px4fmu_common/mixers/FMU_AERT.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_AERT.mix rename to ROMFS/px4fmu_common/mixers/FMU_AERT.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_AET.mix b/ROMFS/px4fmu_common/mixers/FMU_AET.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_AET.mix rename to ROMFS/px4fmu_common/mixers/FMU_AET.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_Q.mix b/ROMFS/px4fmu_common/mixers/FMU_Q.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_Q.mix rename to ROMFS/px4fmu_common/mixers/FMU_Q.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_RET.mix b/ROMFS/px4fmu_common/mixers/FMU_RET.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_RET.mix rename to ROMFS/px4fmu_common/mixers/FMU_RET.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_X5.mix b/ROMFS/px4fmu_common/mixers/FMU_X5.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_X5.mix rename to ROMFS/px4fmu_common/mixers/FMU_X5.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_delta.mix b/ROMFS/px4fmu_common/mixers/FMU_delta.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_delta.mix rename to ROMFS/px4fmu_common/mixers/FMU_delta.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_hex_+.mix b/ROMFS/px4fmu_common/mixers/FMU_hex_+.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_hex_+.mix rename to ROMFS/px4fmu_common/mixers/FMU_hex_+.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_hex_x.mix b/ROMFS/px4fmu_common/mixers/FMU_hex_x.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_hex_x.mix rename to ROMFS/px4fmu_common/mixers/FMU_hex_x.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_octo_+.mix b/ROMFS/px4fmu_common/mixers/FMU_octo_+.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_octo_+.mix rename to ROMFS/px4fmu_common/mixers/FMU_octo_+.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_octo_x.mix b/ROMFS/px4fmu_common/mixers/FMU_octo_x.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_octo_x.mix rename to ROMFS/px4fmu_common/mixers/FMU_octo_x.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_pass.mix b/ROMFS/px4fmu_common/mixers/FMU_pass.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_pass.mix rename to ROMFS/px4fmu_common/mixers/FMU_pass.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_quad_+.mix b/ROMFS/px4fmu_common/mixers/FMU_quad_+.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_quad_+.mix rename to ROMFS/px4fmu_common/mixers/FMU_quad_+.mix diff --git a/ROMFS/px4fmu_default/mixers/FMU_quad_x.mix b/ROMFS/px4fmu_common/mixers/FMU_quad_x.mix similarity index 100% rename from ROMFS/px4fmu_default/mixers/FMU_quad_x.mix rename to ROMFS/px4fmu_common/mixers/FMU_quad_x.mix diff --git a/ROMFS/px4fmu_default/mixers/README b/ROMFS/px4fmu_common/mixers/README similarity index 100% rename from ROMFS/px4fmu_default/mixers/README rename to ROMFS/px4fmu_common/mixers/README diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index cce388d710..d2ebf16987 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -41,20 +41,19 @@ # The uploader uses the following fields from the firmware file: # # image -# The firmware that will be uploaded. +# The firmware that will be uploaded. # image_size -# The size of the firmware in bytes. +# The size of the firmware in bytes. # board_id -# The board for which the firmware is intended. +# The board for which the firmware is intended. # board_revision -# Currently only used for informational purposes. +# Currently only used for informational purposes. # import sys import argparse import binascii import serial -import os import struct import json import zlib @@ -64,292 +63,294 @@ import array from sys import platform as _platform + class firmware(object): - '''Loads a firmware file''' + '''Loads a firmware file''' - desc = {} - image = bytes() - crctab = array.array('I', [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ]) - crcpad = bytearray('\xff\xff\xff\xff') + desc = {} + image = bytes() + crctab = array.array('I', [ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d]) + crcpad = bytearray('\xff\xff\xff\xff') - def __init__(self, path): + def __init__(self, path): - # read the file - f = open(path, "r") - self.desc = json.load(f) - f.close() + # read the file + f = open(path, "r") + self.desc = json.load(f) + f.close() - self.image = bytearray(zlib.decompress(base64.b64decode(self.desc['image']))) + self.image = bytearray(zlib.decompress(base64.b64decode(self.desc['image']))) - # pad image to 4-byte length - while ((len(self.image) % 4) != 0): - self.image.append('\xff') + # pad image to 4-byte length + while ((len(self.image) % 4) != 0): + self.image.append('\xff') - def property(self, propname): - return self.desc[propname] + def property(self, propname): + return self.desc[propname] - def __crc32(self, bytes, state): - for byte in bytes: - index = (state ^ byte) & 0xff - state = self.crctab[index] ^ (state >> 8) - return state + def __crc32(self, bytes, state): + for byte in bytes: + index = (state ^ byte) & 0xff + state = self.crctab[index] ^ (state >> 8) + return state + + def crc(self, padlen): + state = self.__crc32(self.image, int(0)) + for i in range(len(self.image), (padlen - 1), 4): + state = self.__crc32(self.crcpad, state) + return state - def crc(self, padlen): - state = self.__crc32(self.image, int(0)) - for i in range(len(self.image), (padlen - 1), 4): - state = self.__crc32(self.crcpad, state) - return state class uploader(object): - '''Uploads a firmware file to the PX FMU bootloader''' + '''Uploads a firmware file to the PX FMU bootloader''' - # protocol bytes - INSYNC = chr(0x12) - EOC = chr(0x20) + # protocol bytes + INSYNC = chr(0x12) + EOC = chr(0x20) - # reply bytes - OK = chr(0x10) - FAILED = chr(0x11) - INVALID = chr(0x13) # rev3+ + # reply bytes + OK = chr(0x10) + FAILED = chr(0x11) + INVALID = chr(0x13) # rev3+ - # command bytes - NOP = chr(0x00) # guaranteed to be discarded by the bootloader - GET_SYNC = chr(0x21) - GET_DEVICE = chr(0x22) - CHIP_ERASE = chr(0x23) - CHIP_VERIFY = chr(0x24) # rev2 only - PROG_MULTI = chr(0x27) - READ_MULTI = chr(0x28) # rev2 only - GET_CRC = chr(0x29) # rev3+ - REBOOT = chr(0x30) - - INFO_BL_REV = chr(1) # bootloader protocol revision - BL_REV_MIN = 2 # minimum supported bootloader protocol - BL_REV_MAX = 3 # maximum supported bootloader protocol - INFO_BOARD_ID = chr(2) # board type - INFO_BOARD_REV = chr(3) # board revision - INFO_FLASH_SIZE = chr(4) # max firmware size in bytes + # command bytes + NOP = chr(0x00) # guaranteed to be discarded by the bootloader + GET_SYNC = chr(0x21) + GET_DEVICE = chr(0x22) + CHIP_ERASE = chr(0x23) + CHIP_VERIFY = chr(0x24) # rev2 only + PROG_MULTI = chr(0x27) + READ_MULTI = chr(0x28) # rev2 only + GET_CRC = chr(0x29) # rev3+ + REBOOT = chr(0x30) + + INFO_BL_REV = chr(1) # bootloader protocol revision + BL_REV_MIN = 2 # minimum supported bootloader protocol + BL_REV_MAX = 3 # maximum supported bootloader protocol + INFO_BOARD_ID = chr(2) # board type + INFO_BOARD_REV = chr(3) # board revision + INFO_FLASH_SIZE = chr(4) # max firmware size in bytes - PROG_MULTI_MAX = 60 # protocol max is 255, must be multiple of 4 - READ_MULTI_MAX = 60 # protocol max is 255, something overflows with >= 64 + PROG_MULTI_MAX = 60 # protocol max is 255, must be multiple of 4 + READ_MULTI_MAX = 60 # protocol max is 255, something overflows with >= 64 - def __init__(self, portname, baudrate): - # open the port, keep the default timeout short so we can poll quickly - self.port = serial.Serial(portname, baudrate, timeout=0.25) + def __init__(self, portname, baudrate): + # open the port, keep the default timeout short so we can poll quickly + self.port = serial.Serial(portname, baudrate, timeout=0.5) - def close(self): - if self.port is not None: - self.port.close() + def close(self): + if self.port is not None: + self.port.close() - def __send(self, c): -# print("send " + binascii.hexlify(c)) - self.port.write(str(c)) + def __send(self, c): +# print("send " + binascii.hexlify(c)) + self.port.write(str(c)) - def __recv(self, count = 1): - c = self.port.read(count) - if len(c) < 1: - raise RuntimeError("timeout waiting for data") -# print("recv " + binascii.hexlify(c)) - return c + def __recv(self, count=1): + c = self.port.read(count) + if len(c) < 1: + raise RuntimeError("timeout waiting for data") +# print("recv " + binascii.hexlify(c)) + return c - def __recv_int(self): - raw = self.__recv(4) - val = struct.unpack("= 3: - self.__getSync() + # send a PROG_MULTI command to write a collection of bytes + def __program_multi(self, data): + self.__send(uploader.PROG_MULTI + + chr(len(data))) + self.__send(data) + self.__send(uploader.EOC) + self.__getSync() - # split a sequence into a list of size-constrained pieces - def __split_len(self, seq, length): - return [seq[i:i+length] for i in range(0, len(seq), length)] + # verify multiple bytes in flash + def __verify_multi(self, data): + self.__send(uploader.READ_MULTI + + chr(len(data)) + + uploader.EOC) + self.port.flush() + programmed = self.__recv(len(data)) + if programmed != data: + print("got " + binascii.hexlify(programmed)) + print("expect " + binascii.hexlify(data)) + return False + self.__getSync() + return True - # upload code - def __program(self, fw): - code = fw.image - groups = self.__split_len(code, uploader.PROG_MULTI_MAX) - for bytes in groups: - self.__program_multi(bytes) + # send the reboot command + def __reboot(self): + self.__send(uploader.REBOOT + + uploader.EOC) + self.port.flush() - # verify code - def __verify_v2(self, fw): - self.__send(uploader.CHIP_VERIFY - + uploader.EOC) - self.__getSync() - code = fw.image - groups = self.__split_len(code, uploader.READ_MULTI_MAX) - for bytes in groups: - if (not self.__verify_multi(bytes)): - raise RuntimeError("Verification failed") + # v3+ can report failure if the first word flash fails + if self.bl_rev >= 3: + self.__getSync() - def __verify_v3(self, fw): - expect_crc = fw.crc(self.fw_maxsize) - self.__send(uploader.GET_CRC - + uploader.EOC) - report_crc = self.__recv_int() - self.__getSync() - if report_crc != expect_crc: - print(("Expected 0x%x" % expect_crc)) - print(("Got 0x%x" % report_crc)) - raise RuntimeError("Program CRC failed") + # split a sequence into a list of size-constrained pieces + def __split_len(self, seq, length): + return [seq[i:i+length] for i in range(0, len(seq), length)] - # get basic data about the board - def identify(self): - # make sure we are in sync before starting - self.__sync() + # upload code + def __program(self, fw): + code = fw.image + groups = self.__split_len(code, uploader.PROG_MULTI_MAX) + for bytes in groups: + self.__program_multi(bytes) - # get the bootloader protocol ID first - self.bl_rev = self.__getInfo(uploader.INFO_BL_REV) - if (self.bl_rev < uploader.BL_REV_MIN) or (self.bl_rev > uploader.BL_REV_MAX): - print(("Unsupported bootloader protocol %d" % uploader.INFO_BL_REV)) - raise RuntimeError("Bootloader protocol mismatch") + # verify code + def __verify_v2(self, fw): + self.__send(uploader.CHIP_VERIFY + + uploader.EOC) + self.__getSync() + code = fw.image + groups = self.__split_len(code, uploader.READ_MULTI_MAX) + for bytes in groups: + if (not self.__verify_multi(bytes)): + raise RuntimeError("Verification failed") - self.board_type = self.__getInfo(uploader.INFO_BOARD_ID) - self.board_rev = self.__getInfo(uploader.INFO_BOARD_REV) - self.fw_maxsize = self.__getInfo(uploader.INFO_FLASH_SIZE) + def __verify_v3(self, fw): + expect_crc = fw.crc(self.fw_maxsize) + self.__send(uploader.GET_CRC + + uploader.EOC) + report_crc = self.__recv_int() + self.__getSync() + if report_crc != expect_crc: + print("Expected 0x%x" % expect_crc) + print("Got 0x%x" % report_crc) + raise RuntimeError("Program CRC failed") - # upload the firmware - def upload(self, fw): - # Make sure we are doing the right thing - if self.board_type != fw.property('board_id'): - raise RuntimeError("Firmware not suitable for this board (run 'make configure_px4fmu && make clean' or 'make configure_px4io && make clean' to reconfigure).") - if self.fw_maxsize < fw.property('image_size'): - raise RuntimeError("Firmware image is too large for this board") + # get basic data about the board + def identify(self): + # make sure we are in sync before starting + self.__sync() - print("erase...") - self.__erase() + # get the bootloader protocol ID first + self.bl_rev = self.__getInfo(uploader.INFO_BL_REV) + if (self.bl_rev < uploader.BL_REV_MIN) or (self.bl_rev > uploader.BL_REV_MAX): + print("Unsupported bootloader protocol %d" % uploader.INFO_BL_REV) + raise RuntimeError("Bootloader protocol mismatch") - print("program...") - self.__program(fw) + self.board_type = self.__getInfo(uploader.INFO_BOARD_ID) + self.board_rev = self.__getInfo(uploader.INFO_BOARD_REV) + self.fw_maxsize = self.__getInfo(uploader.INFO_FLASH_SIZE) - print("verify...") - if self.bl_rev == 2: - self.__verify_v2(fw) - else: - self.__verify_v3(fw) + # upload the firmware + def upload(self, fw): + # Make sure we are doing the right thing + if self.board_type != fw.property('board_id'): + raise RuntimeError("Firmware not suitable for this board") + if self.fw_maxsize < fw.property('image_size'): + raise RuntimeError("Firmware image is too large for this board") + + print("erase...") + self.__erase() + + print("program...") + self.__program(fw) + + print("verify...") + if self.bl_rev == 2: + self.__verify_v2(fw) + else: + self.__verify_v3(fw) + + print("done, rebooting.") + self.__reboot() + self.port.close() - print("done, rebooting.") - self.__reboot() - self.port.close() - # Parse commandline arguments parser = argparse.ArgumentParser(description="Firmware uploader for the PX autopilot system.") @@ -360,57 +361,57 @@ args = parser.parse_args() # Load the firmware file fw = firmware(args.firmware) -print(("Loaded firmware for %x,%x, waiting for the bootloader..." % (fw.property('board_id'), fw.property('board_revision')))) +print("Loaded firmware for %x,%x, waiting for the bootloader..." % (fw.property('board_id'), fw.property('board_revision'))) # Spin waiting for a device to show up while True: - for port in args.port.split(","): + for port in args.port.split(","): - #print("Trying %s" % port) + #print("Trying %s" % port) - # create an uploader attached to the port - try: - if "linux" in _platform: - # Linux, don't open Mac OS and Win ports - if not "COM" in port and not "tty.usb" in port: - up = uploader(port, args.baud) - elif "darwin" in _platform: - # OS X, don't open Windows and Linux ports - if not "COM" in port and not "ACM" in port: - up = uploader(port, args.baud) - elif "win" in _platform: - # Windows, don't open POSIX ports - if not "/" in port: - up = uploader(port, args.baud) - except: - # open failed, rate-limit our attempts - time.sleep(0.05) + # create an uploader attached to the port + try: + if "linux" in _platform: + # Linux, don't open Mac OS and Win ports + if not "COM" in port and not "tty.usb" in port: + up = uploader(port, args.baud) + elif "darwin" in _platform: + # OS X, don't open Windows and Linux ports + if not "COM" in port and not "ACM" in port: + up = uploader(port, args.baud) + elif "win" in _platform: + # Windows, don't open POSIX ports + if not "/" in port: + up = uploader(port, args.baud) + except: + # open failed, rate-limit our attempts + time.sleep(0.05) - # and loop to the next port - continue + # and loop to the next port + continue - # port is open, try talking to it - try: - # identify the bootloader - up.identify() - print(("Found board %x,%x bootloader rev %x on %s" % (up.board_type, up.board_rev, up.bl_rev, port))) + # port is open, try talking to it + try: + # identify the bootloader + up.identify() + print("Found board %x,%x bootloader rev %x on %s" % (up.board_type, up.board_rev, up.bl_rev, port)) - except: - # most probably a timeout talking to the port, no bootloader - continue + except: + # most probably a timeout talking to the port, no bootloader + continue - try: - # ok, we have a bootloader, try flashing it - up.upload(fw) + try: + # ok, we have a bootloader, try flashing it + up.upload(fw) - except RuntimeError as ex: + except RuntimeError as ex: - # print the error - print(("ERROR: %s" % ex.args)) + # print the error + print("ERROR: %s" % ex.args) - finally: - # always close the port - up.close() + finally: + # always close the port + up.close() - # we could loop here if we wanted to wait for more boards... - sys.exit(0) + # we could loop here if we wanted to wait for more boards... + sys.exit(0) diff --git a/apps/attitude_estimator_ekf/Makefile b/apps/attitude_estimator_ekf/Makefile deleted file mode 100755 index 46a54c6607..0000000000 --- a/apps/attitude_estimator_ekf/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -APPNAME = attitude_estimator_ekf -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -CXXSRCS = attitude_estimator_ekf_main.cpp - -CSRCS = attitude_estimator_ekf_params.c \ - codegen/eye.c \ - codegen/attitudeKalmanfilter.c \ - codegen/mrdivide.c \ - codegen/rdivide.c \ - codegen/attitudeKalmanfilter_initialize.c \ - codegen/attitudeKalmanfilter_terminate.c \ - codegen/rt_nonfinite.c \ - codegen/rtGetInf.c \ - codegen/rtGetNaN.c \ - codegen/norm.c \ - codegen/cross.c - - -# XXX this is *horribly* broken -INCLUDES += $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk diff --git a/apps/commander/.context b/apps/commander/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/commander/Makefile b/apps/commander/Makefile deleted file mode 100644 index d12697274b..0000000000 --- a/apps/commander/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Commander application -# - -APPNAME = commander -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk - diff --git a/apps/drivers/boards/px4fmu/Makefile b/apps/drivers/boards/px4fmu/Makefile deleted file mode 100644 index 6b183d8d28..0000000000 --- a/apps/drivers/boards/px4fmu/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Board-specific startup code for the PX4FMU -# - -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common -LIBNAME = brd_px4fmu - -include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/px4fmu/Makefile b/apps/drivers/px4fmu/Makefile deleted file mode 100644 index 7f7c2a7328..0000000000 --- a/apps/drivers/px4fmu/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Interface driver for the PX4FMU board -# - -APPNAME = fmu -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common - -include $(APPDIR)/mk/app.mk diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp index 1f3f7707e2..123bbb1203 100644 --- a/apps/sensors/sensors.cpp +++ b/apps/sensors/sensors.cpp @@ -372,7 +372,9 @@ Sensors *g_sensors; } Sensors::Sensors() : +#ifdef CONFIG_HRT_PPM _ppm_last_valid(0), +#endif _fd_adc(-1), _last_adc(0), diff --git a/apps/systemcmds/eeprom/Makefile b/apps/systemcmds/eeprom/Makefile deleted file mode 100644 index 58c8cb5ec7..0000000000 --- a/apps/systemcmds/eeprom/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build the eeprom tool. -# - -APPNAME = eeprom -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 -MAXOPTIMIZATION = -Os - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/makefiles/board_px4fmu.mk b/makefiles/board_px4fmu.mk index 959e4ed263..8370696446 100644 --- a/makefiles/board_px4fmu.mk +++ b/makefiles/board_px4fmu.mk @@ -1,5 +1,5 @@ # -# Platform-specific definitions for the PX4FMU +# Board-specific definitions for the PX4FMU # # diff --git a/makefiles/board_px4io.mk b/makefiles/board_px4io.mk index 275014aba5..b0eb2dae79 100644 --- a/makefiles/board_px4io.mk +++ b/makefiles/board_px4io.mk @@ -1,5 +1,5 @@ # -# Platform-specific definitions for the PX4IO +# Board-specific definitions for the PX4IO # # diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index a6d766511c..3f634d72cd 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -5,7 +5,26 @@ # # Use the configuration's ROMFS. # -ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG) +ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common + +# +# Board support modules +# +MODULES += drivers/px4fmu +MODULES += drivers/boards/px4fmu +MODULES += drivers/l3gd20 +MODULES += drivers/ardrone_interface +MODULES += systemcmds/eeprom + +# +# General system control +# +MODULES += modules/commander + +# +# Estimation modules (EKF / other filters) +# +#MODULES += modules/attitude_estimator_ekf # # Transitional support - add commands from the NuttX export archive. @@ -22,25 +41,19 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ $(call _B, adc, , 2048, adc_main ) \ - $(call _B, ardrone_interface, SCHED_PRIORITY_MAX-15, 2048, ardrone_interface_main ) \ - $(call _B, attitude_estimator_ekf, , 2048, attitude_estimator_ekf_main) \ $(call _B, bl_update, , 4096, bl_update_main ) \ $(call _B, blinkm, , 2048, blinkm_main ) \ $(call _B, bma180, , 2048, bma180_main ) \ $(call _B, boardinfo, , 2048, boardinfo_main ) \ - $(call _B, commander, SCHED_PRIORITY_MAX-30, 2048, commander_main ) \ $(call _B, control_demo, , 2048, control_demo_main ) \ $(call _B, delay_test, , 2048, delay_test_main ) \ - $(call _B, eeprom, , 4096, eeprom_main ) \ $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ - $(call _B, fmu, , 2048, fmu_main ) \ $(call _B, gps, , 2048, gps_main ) \ $(call _B, hil, , 2048, hil_main ) \ $(call _B, hmc5883, , 4096, hmc5883_main ) \ $(call _B, hott_telemetry, , 2048, hott_telemetry_main ) \ $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ - $(call _B, l3gd20, , 2048, l3gd20_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ $(call _B, mavlink, , 2048, mavlink_main ) \ $(call _B, mavlink_onboard, , 2048, mavlink_onboard_main ) \ @@ -62,4 +75,5 @@ BUILTIN_COMMANDS := \ $(call _B, tests, , 12000, tests_main ) \ $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ $(call _B, top, SCHED_PRIORITY_DEFAULT-10, 3000, top_main ) \ + $(call _B, param, SCHED_PRIORITY_DEFAULT-10, 2048, param_main ) \ $(call _B, uorb, , 4096, uorb_main ) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index dad57d531e..fff0e1c65c 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -64,7 +64,16 @@ # path to this file. # # CONFIG: -# Used to set the output filename; defaults to 'firmware'. +# Used when searching for the configuration file, and available +# to module Makefiles to select optional features. +# If not set, CONFIG_FILE must be set and CONFIG will be derived +# automatically from it. +# +# CONFIG_FILE: +# If set, overrides the configuration file search logic. Sets +# CONFIG to the name of the configuration file, strips any +# leading config_ prefix and any suffix. e.g. config_board_foo.mk +# results in CONFIG being set to 'board_foo'. # # WORK_DIR: # Sets the directory in which the firmware will be built. Defaults @@ -92,11 +101,14 @@ # If PX4_BASE wasn't set previously, work out what it should be # and set it here now. # -MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) +MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(PX4_BASE),) export PX4_BASE := $(abspath $(MK_DIR)/..) endif $(info % PX4_BASE = $(PX4_BASE)) +ifneq ($(words $(PX4_BASE)),1) +$(error Cannot build when the PX4_BASE path contains one or more space characters.) +endif # # Set a default target so that included makefiles or errors here don't @@ -115,13 +127,14 @@ include $(MK_DIR)/setup.mk # # Locate the configuration file # +ifneq ($(CONFIG_FILE),) +CONFIG := $(subst config_,,$(basename $(notdir $(CONFIG_FILE)))) +else +CONFIG_FILE := $(wildcard $(PX4_MK_DIR)/config_$(CONFIG).mk) +endif ifeq ($(CONFIG),) $(error Missing configuration name or file (specify with CONFIG=)) endif -CONFIG_FILE := $(firstword $(wildcard $(CONFIG)) $(wildcard $(PX4_MK_DIR)/config_$(CONFIG).mk)) -ifeq ($(CONFIG_FILE),) -$(error Can't find a config file called $(CONFIG) or $(PX4_MK_DIR)/config_$(CONFIG).mk) -endif export CONFIG include $(CONFIG_FILE) $(info % CONFIG = $(CONFIG)) @@ -211,10 +224,7 @@ MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module $(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) $(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) $(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) - @$(ECHO) %% - @$(ECHO) %% Building module using $(mkfile) - @$(ECHO) %% - $(Q) $(MAKE) -f $(PX4_MK_DIR)module.mk \ + $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ MODULE_WORK_DIR=$(dir $@) \ MODULE_OBJ=$@ \ MODULE_MK=$(mkfile) \ @@ -230,7 +240,7 @@ $(MODULE_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) $(MODULE_CLEANS): mkfile = $(patsubst %clean,%module.mk,$(relpath)) $(MODULE_CLEANS): @$(ECHO) %% cleaning using $(mkfile) - $(Q) $(MAKE) -f $(PX4_MK_DIR)module.mk \ + $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ MODULE_WORK_DIR=$(dir $@) \ MODULE_MK=$(mkfile) \ clean @@ -246,6 +256,9 @@ include $(PX4_MK_DIR)/nuttx.mk ################################################################################ ifneq ($(ROMFS_ROOT),) +ifeq ($(wildcard $(ROMFS_ROOT)),) +$(error ROMFS_ROOT specifies a directory that does not exist) +endif # # Note that there is no support for more than one root directory or constructing @@ -272,7 +285,7 @@ $(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS) # Generate the ROMFS image from the root $(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS) - @$(ECHO) %% generating $@ + @$(ECHO) "ROMFS: $@" $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG) @@ -298,10 +311,12 @@ endif # BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c -# add command definitions from modules -BUILTIN_COMMAND_FILES := $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*) -BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(BUILTIN_COMMAND_FILES))) +# command definitions from modules (may be empty at Makefile parsing time...) +MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) +# We must have at least one pre-defined builtin command in order to generate +# any of this. +# ifneq ($(BUILTIN_COMMANDS),) # (BUILTIN_PROTO,,) @@ -315,17 +330,19 @@ define BUILTIN_DEF endef # Don't generate until modules have updated their command files -$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(BUILTIN_COMMAND_FILES) - @$(ECHO) %% generating $@ +$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(BUILTIN_COMMAND_FILES) + @$(ECHO) "CMDS: $@" $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ $(Q) $(ECHO) '#include ' >> $@ $(Q) $(ECHO) '#include ' >> $@ $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) + $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) $(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@ $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) + $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) $(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@ $(Q) $(ECHO) '};' >> $@ - $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ + $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@ SRCS += $(BUILTIN_CSRC) @@ -358,7 +375,7 @@ endif # PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4 PRODUCT_BIN = $(WORK_DIR)firmware.bin -PRODUCT_SYM = $(WORK_DIR)firmware.sym +PRODUCT_ELF = $(WORK_DIR)firmware.elf .PHONY: firmware firmware: $(PRODUCT_BUNDLE) @@ -393,10 +410,10 @@ $(PRODUCT_BUNDLE): $(PRODUCT_BIN) --git_identity $(PX4_BASE) \ --image $< > $@ -$(PRODUCT_BIN): $(PRODUCT_SYM) +$(PRODUCT_BIN): $(PRODUCT_ELF) $(call SYM_TO_BIN,$<,$@) -$(PRODUCT_SYM): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) +$(PRODUCT_ELF): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) $(call LINK,$@,$(OBJS) $(MODULE_OBJS)) # @@ -407,17 +424,19 @@ $(PRODUCT_SYM): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKF upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \ METHOD=serial \ - PRODUCT=$(PRODUCT) \ + CONFIG=$(CONFIG) \ + BOARD=$(BOARD) \ BUNDLE=$(PRODUCT_BUNDLE) \ BIN=$(PRODUCT_BIN) .PHONY: clean clean: $(MODULE_CLEANS) @$(ECHO) %% cleaning - $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_SYM) + $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_ELF) $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) + # # DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS) # diff --git a/makefiles/module.mk b/makefiles/module.mk index 8b01d0a126..538f6d318e 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -75,6 +75,18 @@ # the list should be formatted as: # ... # +# INCLUDE_DIRS (optional, must be appended) +# +# The list of directories searched for include files. If non-standard +# includes (e.g. those from another module) are required, paths to search +# can be added here. +# +# DEFAULT_VISIBILITY (optional) +# +# If not set, global symbols defined in a module will not be visible +# outside the module. Symbols that should be globally visible must be +# marked __EXPORT. +# If set, global symbols defined in a module will be globally visible. # # @@ -96,12 +108,7 @@ ifeq ($(MODULE_MK),) $(error No module makefile specified) endif -$(info % MODULE_MK = $(MODULE_MK)) - -# -# Get path and tool config -# -include $(PX4_BASE)/makefiles/setup.mk +$(info %% MODULE_MK = $(MODULE_MK)) # # Get the board/toolchain config @@ -144,12 +151,25 @@ MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODU $(MODULE_COMMAND_FILES): command = $(word 2,$(subst ., ,$(notdir $(@)))) $(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).* $(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) - @$(ECHO) COMMAND: $(command) @$(REMOVE) -f $(exclude) @$(MKDIR) -p $(dir $@) + @echo "CMD: $(command)" $(Q) $(TOUCH) $@ endif +################################################################################ +# Adjust compilation flags to implement EXPORT +################################################################################ + +ifeq ($(DEFAULT_VISIBILITY),) +DEFAULT_VISIBILITY = hidden +else +DEFAULT_VISIBILITY = default +endif + +CFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h +CXXFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h + ################################################################################ # Build rules ################################################################################ diff --git a/makefiles/nuttx.mk b/makefiles/nuttx.mk index c6e2c86d1b..346735a02a 100644 --- a/makefiles/nuttx.mk +++ b/makefiles/nuttx.mk @@ -63,7 +63,10 @@ LDSCRIPT += $(NUTTX_EXPORT_DIR)build/ld.script # # Add directories from the NuttX export to the relevant search paths # -INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include +INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include \ + $(NUTTX_EXPORT_DIR)arch/chip \ + $(NUTTX_EXPORT_DIR)arch/common + LIB_DIRS += $(NUTTX_EXPORT_DIR)libs LIBS += -lapps -lnuttx LINK_DEPS += $(NUTTX_EXPORT_DIR)libs/libapps.a \ @@ -71,5 +74,5 @@ LINK_DEPS += $(NUTTX_EXPORT_DIR)libs/libapps.a \ $(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) @$(ECHO) %% Unpacking $(NUTTX_ARCHIVE) - $(Q) $(UNZIP) -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) $(UNZIP_CMD) -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) $(Q) $(TOUCH) $@ diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 8e7a00ef4c..b798f7cabe 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -41,7 +41,8 @@ # the number of duplicate slashes we have lying around in paths, # and is consistent with joining the results of $(dir) and $(notdir). # -export PX4_MODULE_SRC = $(abspath $(PX4_BASE)/src/modules)/ +export PX4_INCLUDE_DIR = $(abspath $(PX4_BASE)/src/include)/ +export PX4_MODULE_SRC = $(abspath $(PX4_BASE)/src)/ export PX4_MK_DIR = $(abspath $(PX4_BASE)/makefiles)/ export NUTTX_SRC = $(abspath $(PX4_BASE)/nuttx)/ export NUTTX_APP_SRC = $(abspath $(PX4_BASE)/apps)/ @@ -51,24 +52,33 @@ export IMAGE_DIR = $(abspath $(PX4_BASE)/Images)/ export BUILD_DIR = $(abspath $(PX4_BASE)/Build)/ export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/ +# +# Default include paths +# +export INCLUDE_DIRS := $(PX4_MODULE_SRC) \ + $(PX4_INCLUDE_DIR) + +# Include from legacy app/library path +export INCLUDE_DIRS += $(NUTTX_APP_SRC) + # # Tools # -MKFW = $(PX4_BASE)/Tools/px_mkfw.py -UPLOADER = $(PX4_BASE)/Tools/px_uploader.py -COPY = cp -REMOVE = rm -f -RMDIR = rm -rf -GENROMFS = genromfs -TOUCH = touch -MKDIR = mkdir -ECHO = echo -UNZIP = unzip +export MKFW = $(PX4_BASE)/Tools/px_mkfw.py +export UPLOADER = $(PX4_BASE)/Tools/px_uploader.py +export COPY = cp +export REMOVE = rm -f +export RMDIR = rm -rf +export GENROMFS = genromfs +export TOUCH = touch +export MKDIR = mkdir +export ECHO = echo +export UNZIP_CMD = unzip # # Host-specific paths, hacks and fixups # -SYSTYPE := $(shell uname -s) +export SYSTYPE := $(shell uname -s) ifeq ($(SYSTYPE),Darwin) # Eclipse may not have the toolchain on its path. diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index d214006bef..5e6a5bf04b 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -157,6 +157,7 @@ CXXFLAGS = $(ARCHCXXFLAGS) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ $(EXTRADEFINES) \ + -DCONFIG_WCHAR_BUILTIN \ $(addprefix -I,$(INCLUDE_DIRS)) # Flags we pass to the assembler diff --git a/makefiles/upload.mk b/makefiles/upload.mk index 5308aaa3ee..f23d6ae41a 100644 --- a/makefiles/upload.mk +++ b/makefiles/upload.mk @@ -21,11 +21,11 @@ ifeq ($(SERIAL_PORTS),) SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" endif -.PHONY: all upload-$(METHOD)-$(PRODUCT) -all: upload-$(METHOD)-$(PRODUCT) +.PHONY: all upload-$(METHOD)-$(BOARD) +all: upload-$(METHOD)-$(BOARD) upload-serial-px4fmu: $(BUNDLE) $(UPLOADER) - @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE) + @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) # # JTAG firmware uploading with OpenOCD diff --git a/nuttx/configs/px4fmu/include/board.h b/nuttx/configs/px4fmu/include/board.h index 0bc0b30216..294b6c3984 100755 --- a/nuttx/configs/px4fmu/include/board.h +++ b/nuttx/configs/px4fmu/include/board.h @@ -308,6 +308,10 @@ #define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 #define GPIO_SPI1_SCK GPIO_SPI1_SCK_1 +#define GPIO_SPI2_MISO GPIO_SPI2_MISO_2 +#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_2 +#define GPIO_SPI2_SCK GPIO_SPI2_SCK_2 + #define GPIO_SPI3_MISO GPIO_SPI3_MISO_2 #define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_1 #define GPIO_SPI3_SCK GPIO_SPI3_SCK_2 @@ -321,6 +325,8 @@ #define PX4_SPIDEV_ACCEL 2 #define PX4_SPIDEV_MPU 3 +#define PX4_SPIDEV_ACCEL_MAG 2 // external for anti vibration test + /* * Tone alarm output */ diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 9e28ff485f..1e5d7d4e13 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -65,7 +65,6 @@ CONFIGURED_APPS += systemcmds/perf CONFIGURED_APPS += systemcmds/top CONFIGURED_APPS += systemcmds/boardinfo CONFIGURED_APPS += systemcmds/mixer -CONFIGURED_APPS += systemcmds/eeprom CONFIGURED_APPS += systemcmds/param CONFIGURED_APPS += systemcmds/pwm CONFIGURED_APPS += systemcmds/bl_update @@ -110,20 +109,18 @@ endif CONFIGURED_APPS += systemcmds/i2c # Communication and Drivers -CONFIGURED_APPS += drivers/boards/px4fmu +#CONFIGURED_APPS += drivers/boards/px4fmu CONFIGURED_APPS += drivers/device CONFIGURED_APPS += drivers/ms5611 CONFIGURED_APPS += drivers/hmc5883 CONFIGURED_APPS += drivers/mpu6000 CONFIGURED_APPS += drivers/bma180 -CONFIGURED_APPS += drivers/l3gd20 CONFIGURED_APPS += drivers/px4io CONFIGURED_APPS += drivers/stm32 -CONFIGURED_APPS += drivers/led +#CONFIGURED_APPS += drivers/led CONFIGURED_APPS += drivers/blinkm CONFIGURED_APPS += drivers/stm32/tone_alarm CONFIGURED_APPS += drivers/stm32/adc -CONFIGURED_APPS += drivers/px4fmu CONFIGURED_APPS += drivers/hil CONFIGURED_APPS += drivers/gps CONFIGURED_APPS += drivers/mb12xx diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 130886aac2..cf30b835fc 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -85,7 +85,7 @@ CONFIG_ARCH_FPU=y CONFIG_ARCH_INTERRUPTSTACK=n CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y +CONFIG_ARCH_LEDS=n CONFIG_ARCH_BUTTONS=n CONFIG_ARCH_CALIBRATION=n CONFIG_ARCH_DMA=y diff --git a/apps/ardrone_interface/ardrone_interface.c b/src/drivers/ardrone_interface/ardrone_interface.c similarity index 100% rename from apps/ardrone_interface/ardrone_interface.c rename to src/drivers/ardrone_interface/ardrone_interface.c diff --git a/apps/ardrone_interface/ardrone_motor_control.c b/src/drivers/ardrone_interface/ardrone_motor_control.c similarity index 100% rename from apps/ardrone_interface/ardrone_motor_control.c rename to src/drivers/ardrone_interface/ardrone_motor_control.c diff --git a/apps/ardrone_interface/ardrone_motor_control.h b/src/drivers/ardrone_interface/ardrone_motor_control.h similarity index 100% rename from apps/ardrone_interface/ardrone_motor_control.h rename to src/drivers/ardrone_interface/ardrone_motor_control.h diff --git a/apps/drivers/l3gd20/Makefile b/src/drivers/ardrone_interface/module.mk similarity index 88% rename from apps/drivers/l3gd20/Makefile rename to src/drivers/ardrone_interface/module.mk index 98e2d57c55..058bd1397d 100644 --- a/apps/drivers/l3gd20/Makefile +++ b/src/drivers/ardrone_interface/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,9 @@ ############################################################################ # -# Makefile to build the L3GD20 driver. +# AR.Drone motor driver # -APPNAME = l3gd20 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = ardrone_interface +SRCS = ardrone_interface.c \ + ardrone_motor_control.c diff --git a/src/drivers/boards/px4fmu/module.mk b/src/drivers/boards/px4fmu/module.mk new file mode 100644 index 0000000000..2cb261d305 --- /dev/null +++ b/src/drivers/boards/px4fmu/module.mk @@ -0,0 +1,9 @@ +# +# Board-specific startup code for the PX4FMU +# + +SRCS = px4fmu_can.c \ + px4fmu_init.c \ + px4fmu_pwm_servo.c \ + px4fmu_spi.c \ + px4fmu_usb.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_can.c b/src/drivers/boards/px4fmu/px4fmu_can.c similarity index 99% rename from apps/drivers/boards/px4fmu/px4fmu_can.c rename to src/drivers/boards/px4fmu/px4fmu_can.c index 0d0b5fcd36..187689ff9a 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_can.c +++ b/src/drivers/boards/px4fmu/px4fmu_can.c @@ -37,7 +37,6 @@ * Board-specific CAN functions. */ - /************************************************************************************ * Included Files ************************************************************************************/ @@ -57,6 +56,8 @@ #include "stm32_can.h" #include "px4fmu_internal.h" +#ifdef CONFIG_CAN + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ @@ -139,3 +140,5 @@ int can_devinit(void) return OK; } + +#endif diff --git a/apps/drivers/boards/px4fmu/px4fmu_init.c b/src/drivers/boards/px4fmu/px4fmu_init.c similarity index 87% rename from apps/drivers/boards/px4fmu/px4fmu_init.c rename to src/drivers/boards/px4fmu/px4fmu_init.c index 9960c6bbd5..5dd70c3f95 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_init.c +++ b/src/drivers/boards/px4fmu/px4fmu_init.c @@ -127,6 +127,7 @@ __EXPORT void stm32_boardinitialize(void) ****************************************************************************/ static struct spi_dev_s *spi1; +static struct spi_dev_s *spi2; static struct spi_dev_s *spi3; #include @@ -147,6 +148,11 @@ __EXPORT int nsh_archinitialize(void) { int result; + /* configure always-on ADC pins */ + stm32_configgpio(GPIO_ADC1_IN10); + stm32_configgpio(GPIO_ADC1_IN11); + /* IN12 and IN13 further below */ + /* configure the high-resolution time/callout interface */ hrt_init(); @@ -173,7 +179,7 @@ __EXPORT int nsh_archinitialize(void) NULL); // initial LED state - drv_led_start(); +// drv_led_start(); up_ledoff(LED_BLUE); up_ledoff(LED_AMBER); up_ledon(LED_BLUE); @@ -188,7 +194,7 @@ __EXPORT int nsh_archinitialize(void) return -ENODEV; } - // Default SPI1 to 1MHz and de-assert the known chip selects. + /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); @@ -199,6 +205,28 @@ __EXPORT int nsh_archinitialize(void) message("[boot] Successfully initialized SPI port 1\r\n"); + /* + * If SPI2 is enabled in the defconfig, we loose some ADC pins as chip selects. + * Keep the SPI2 init optional and conditionally initialize the ADC pins + */ + spi2 = up_spiinitialize(2); + + if (!spi2) { + message("[boot] Enabling IN12/13 instead of SPI2\n"); + /* no SPI2, use pins for ADC */ + stm32_configgpio(GPIO_ADC1_IN12); + stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards + } else { + /* Default SPI2 to 1MHz and de-assert the known chip selects. */ + SPI_SETFREQUENCY(spi2, 10000000); + SPI_SETBITS(spi2, 8); + SPI_SETMODE(spi2, SPIDEV_MODE3); + SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); + SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); + + message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n"); + } + /* Get the SPI port for the microSD slot */ message("[boot] Initializing SPI port 3\n"); @@ -223,10 +251,5 @@ __EXPORT int nsh_archinitialize(void) message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n"); - stm32_configgpio(GPIO_ADC1_IN10); - stm32_configgpio(GPIO_ADC1_IN11); - stm32_configgpio(GPIO_ADC1_IN12); - stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards - return OK; } diff --git a/apps/drivers/boards/px4fmu/px4fmu_internal.h b/src/drivers/boards/px4fmu/px4fmu_internal.h similarity index 98% rename from apps/drivers/boards/px4fmu/px4fmu_internal.h rename to src/drivers/boards/px4fmu/px4fmu_internal.h index 6550fdf3da..671a58f8f6 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_internal.h +++ b/src/drivers/boards/px4fmu/px4fmu_internal.h @@ -58,9 +58,9 @@ __BEGIN_DECLS ****************************************************************************************************/ /* Configuration ************************************************************************************/ -#ifdef CONFIG_STM32_SPI2 -# error "SPI2 is not supported on this board" -#endif +//#ifdef CONFIG_STM32_SPI2 +//# error "SPI2 is not supported on this board" +//#endif #if defined(CONFIG_STM32_CAN1) # warning "CAN1 is not supported on this board" @@ -77,6 +77,7 @@ __BEGIN_DECLS // XXX MPU6000 DRDY? /* SPI chip selects */ + #define GPIO_SPI_CS_GYRO (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN14) #define GPIO_SPI_CS_ACCEL (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15) #define GPIO_SPI_CS_MPU (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN0) diff --git a/apps/drivers/boards/px4fmu/px4fmu_led.c b/src/drivers/boards/px4fmu/px4fmu_led.c similarity index 100% rename from apps/drivers/boards/px4fmu/px4fmu_led.c rename to src/drivers/boards/px4fmu/px4fmu_led.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_pwm_servo.c b/src/drivers/boards/px4fmu/px4fmu_pwm_servo.c similarity index 100% rename from apps/drivers/boards/px4fmu/px4fmu_pwm_servo.c rename to src/drivers/boards/px4fmu/px4fmu_pwm_servo.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_spi.c b/src/drivers/boards/px4fmu/px4fmu_spi.c similarity index 93% rename from apps/drivers/boards/px4fmu/px4fmu_spi.c rename to src/drivers/boards/px4fmu/px4fmu_spi.c index 7a02eaeb7d..b5d00eac0d 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_spi.c +++ b/src/drivers/boards/px4fmu/px4fmu_spi.c @@ -121,6 +121,24 @@ __EXPORT uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devi return SPI_STATUS_PRESENT; } +__EXPORT void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +{ + /* SPI select is active low, so write !selected to select the device */ + + switch (devid) { + break; + + default: + break; + + } +} + +__EXPORT uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +{ + return SPI_STATUS_PRESENT; +} + __EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { diff --git a/apps/drivers/boards/px4fmu/px4fmu_usb.c b/src/drivers/boards/px4fmu/px4fmu_usb.c similarity index 100% rename from apps/drivers/boards/px4fmu/px4fmu_usb.c rename to src/drivers/boards/px4fmu/px4fmu_usb.c diff --git a/apps/drivers/l3gd20/l3gd20.cpp b/src/drivers/l3gd20/l3gd20.cpp similarity index 100% rename from apps/drivers/l3gd20/l3gd20.cpp rename to src/drivers/l3gd20/l3gd20.cpp diff --git a/src/drivers/l3gd20/module.mk b/src/drivers/l3gd20/module.mk new file mode 100644 index 0000000000..23e77e8712 --- /dev/null +++ b/src/drivers/l3gd20/module.mk @@ -0,0 +1,6 @@ +# +# LSM303D accel/mag driver +# + +MODULE_COMMAND = l3gd20 +SRCS = l3gd20.cpp diff --git a/apps/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp similarity index 100% rename from apps/drivers/px4fmu/fmu.cpp rename to src/drivers/px4fmu/fmu.cpp diff --git a/src/drivers/px4fmu/module.mk b/src/drivers/px4fmu/module.mk new file mode 100644 index 0000000000..05bc7a5b33 --- /dev/null +++ b/src/drivers/px4fmu/module.mk @@ -0,0 +1,6 @@ +# +# Interface driver for the PX4FMU board +# + +MODULE_COMMAND = fmu +SRCS = fmu.cpp diff --git a/src/include/visibility.h b/src/include/visibility.h new file mode 100644 index 0000000000..2c6adc062e --- /dev/null +++ b/src/include/visibility.h @@ -0,0 +1,62 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file visibility.h + * + * Definitions controlling symbol naming and visibility. + * + * This file is normally included automatically by the build system. + */ + +#ifndef __SYSTEMLIB_VISIBILITY_H +#define __SYSTEMLIB_VISIBILITY_H + +#ifdef __EXPORT +# undef __EXPORT +#endif +#define __EXPORT __attribute__ ((visibility ("default"))) + +#ifdef __PRIVATE +# undef __PRIVATE +#endif +#define __PRIVATE __attribute__ ((visibility ("hidden"))) + +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif +#endif \ No newline at end of file diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp similarity index 100% rename from apps/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp rename to src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.c b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c similarity index 100% rename from apps/attitude_estimator_ekf/attitude_estimator_ekf_params.c rename to src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.h b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.h similarity index 100% rename from apps/attitude_estimator_ekf/attitude_estimator_ekf_params.h rename to src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h rename to src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h diff --git a/apps/attitude_estimator_ekf/codegen/cross.c b/src/modules/attitude_estimator_ekf/codegen/cross.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/cross.c rename to src/modules/attitude_estimator_ekf/codegen/cross.c diff --git a/apps/attitude_estimator_ekf/codegen/cross.h b/src/modules/attitude_estimator_ekf/codegen/cross.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/cross.h rename to src/modules/attitude_estimator_ekf/codegen/cross.h diff --git a/apps/attitude_estimator_ekf/codegen/eye.c b/src/modules/attitude_estimator_ekf/codegen/eye.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/eye.c rename to src/modules/attitude_estimator_ekf/codegen/eye.c diff --git a/apps/attitude_estimator_ekf/codegen/eye.h b/src/modules/attitude_estimator_ekf/codegen/eye.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/eye.h rename to src/modules/attitude_estimator_ekf/codegen/eye.h diff --git a/apps/attitude_estimator_ekf/codegen/mrdivide.c b/src/modules/attitude_estimator_ekf/codegen/mrdivide.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/mrdivide.c rename to src/modules/attitude_estimator_ekf/codegen/mrdivide.c diff --git a/apps/attitude_estimator_ekf/codegen/mrdivide.h b/src/modules/attitude_estimator_ekf/codegen/mrdivide.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/mrdivide.h rename to src/modules/attitude_estimator_ekf/codegen/mrdivide.h diff --git a/apps/attitude_estimator_ekf/codegen/norm.c b/src/modules/attitude_estimator_ekf/codegen/norm.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/norm.c rename to src/modules/attitude_estimator_ekf/codegen/norm.c diff --git a/apps/attitude_estimator_ekf/codegen/norm.h b/src/modules/attitude_estimator_ekf/codegen/norm.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/norm.h rename to src/modules/attitude_estimator_ekf/codegen/norm.h diff --git a/apps/attitude_estimator_ekf/codegen/rdivide.c b/src/modules/attitude_estimator_ekf/codegen/rdivide.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rdivide.c rename to src/modules/attitude_estimator_ekf/codegen/rdivide.c diff --git a/apps/attitude_estimator_ekf/codegen/rdivide.h b/src/modules/attitude_estimator_ekf/codegen/rdivide.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rdivide.h rename to src/modules/attitude_estimator_ekf/codegen/rdivide.h diff --git a/apps/attitude_estimator_ekf/codegen/rtGetInf.c b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rtGetInf.c rename to src/modules/attitude_estimator_ekf/codegen/rtGetInf.c diff --git a/apps/attitude_estimator_ekf/codegen/rtGetInf.h b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rtGetInf.h rename to src/modules/attitude_estimator_ekf/codegen/rtGetInf.h diff --git a/apps/attitude_estimator_ekf/codegen/rtGetNaN.c b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rtGetNaN.c rename to src/modules/attitude_estimator_ekf/codegen/rtGetNaN.c diff --git a/apps/attitude_estimator_ekf/codegen/rtGetNaN.h b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rtGetNaN.h rename to src/modules/attitude_estimator_ekf/codegen/rtGetNaN.h diff --git a/apps/attitude_estimator_ekf/codegen/rt_defines.h b/src/modules/attitude_estimator_ekf/codegen/rt_defines.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rt_defines.h rename to src/modules/attitude_estimator_ekf/codegen/rt_defines.h diff --git a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.c b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.c similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rt_nonfinite.c rename to src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.c diff --git a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.h b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rt_nonfinite.h rename to src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.h diff --git a/apps/attitude_estimator_ekf/codegen/rtwtypes.h b/src/modules/attitude_estimator_ekf/codegen/rtwtypes.h similarity index 100% rename from apps/attitude_estimator_ekf/codegen/rtwtypes.h rename to src/modules/attitude_estimator_ekf/codegen/rtwtypes.h diff --git a/src/modules/attitude_estimator_ekf/module.mk b/src/modules/attitude_estimator_ekf/module.mk new file mode 100644 index 0000000000..5ce5451122 --- /dev/null +++ b/src/modules/attitude_estimator_ekf/module.mk @@ -0,0 +1,16 @@ + +MODULE_NAME = attitude_estimator_ekf +SRCS = attitude_estimator_ekf_main.cpp \ + attitude_estimator_ekf_params.c \ + codegen/attitudeKalmanfilter_initialize.c \ + codegen/attitudeKalmanfilter_terminate.c \ + codegen/attitudeKalmanfilter.c \ + codegen/cross.c \ + codegen/eye.c \ + codegen/mrdivide.c \ + codegen/norm.c \ + codegen/rdivide.c \ + codegen/rt_nonfinite.c \ + codegen/rtGetInf.c \ + codegen/rtGetNaN.c + diff --git a/apps/commander/calibration_routines.c b/src/modules/commander/calibration_routines.c similarity index 100% rename from apps/commander/calibration_routines.c rename to src/modules/commander/calibration_routines.c diff --git a/apps/commander/calibration_routines.h b/src/modules/commander/calibration_routines.h similarity index 100% rename from apps/commander/calibration_routines.h rename to src/modules/commander/calibration_routines.h diff --git a/apps/commander/commander.c b/src/modules/commander/commander.c similarity index 100% rename from apps/commander/commander.c rename to src/modules/commander/commander.c diff --git a/apps/commander/commander.h b/src/modules/commander/commander.h similarity index 100% rename from apps/commander/commander.h rename to src/modules/commander/commander.h diff --git a/apps/ardrone_interface/Makefile b/src/modules/commander/module.mk similarity index 88% rename from apps/ardrone_interface/Makefile rename to src/modules/commander/module.mk index fea96082f6..b90da8289f 100644 --- a/apps/ardrone_interface/Makefile +++ b/src/modules/commander/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,10 @@ ############################################################################ # -# Makefile to build ardrone interface +# Main system state machine # -APPNAME = ardrone_interface -PRIORITY = SCHED_PRIORITY_MAX - 15 -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = commander +SRCS = commander.c \ + state_machine_helper.c \ + calibration_routines.c diff --git a/apps/commander/state_machine_helper.c b/src/modules/commander/state_machine_helper.c similarity index 100% rename from apps/commander/state_machine_helper.c rename to src/modules/commander/state_machine_helper.c diff --git a/apps/commander/state_machine_helper.h b/src/modules/commander/state_machine_helper.h similarity index 100% rename from apps/commander/state_machine_helper.h rename to src/modules/commander/state_machine_helper.h diff --git a/apps/systemcmds/eeprom/24xxxx_mtd.c b/src/systemcmds/eeprom/24xxxx_mtd.c similarity index 100% rename from apps/systemcmds/eeprom/24xxxx_mtd.c rename to src/systemcmds/eeprom/24xxxx_mtd.c diff --git a/apps/systemcmds/eeprom/eeprom.c b/src/systemcmds/eeprom/eeprom.c similarity index 100% rename from apps/systemcmds/eeprom/eeprom.c rename to src/systemcmds/eeprom/eeprom.c diff --git a/src/systemcmds/eeprom/module.mk b/src/systemcmds/eeprom/module.mk new file mode 100644 index 0000000000..3b4fc04791 --- /dev/null +++ b/src/systemcmds/eeprom/module.mk @@ -0,0 +1,6 @@ +# +# EEPROM file system driver +# + +MODULE_COMMAND = eeprom +SRCS = 24xxxx_mtd.c eeprom.c From 4748bba35ac8f5ff0010d2ba202c85a6c5d36168 Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 26 Apr 2013 20:02:12 -0700 Subject: [PATCH 047/129] Move the 'tests' app to the new world. --- apps/px4/tests/Makefile | 44 ------------------- makefiles/config_px4fmu_default.mk | 6 ++- nuttx/configs/px4fmu/nsh/appconfig | 1 - {apps/px4 => src/systemcmds}/tests/.context | 0 src/systemcmds/tests/module.mk | 28 ++++++++++++ {apps/px4 => src/systemcmds}/tests/test_adc.c | 0 .../px4 => src/systemcmds}/tests/test_bson.c | 0 .../px4 => src/systemcmds}/tests/test_float.c | 0 .../px4 => src/systemcmds}/tests/test_gpio.c | 0 .../systemcmds}/tests/test_hott_telemetry.c | 0 {apps/px4 => src/systemcmds}/tests/test_hrt.c | 0 {apps/px4 => src/systemcmds}/tests/test_int.c | 0 .../systemcmds}/tests/test_jig_voltages.c | 0 {apps/px4 => src/systemcmds}/tests/test_led.c | 0 .../systemcmds}/tests/test_sensors.c | 0 .../px4 => src/systemcmds}/tests/test_servo.c | 0 .../px4 => src/systemcmds}/tests/test_sleep.c | 0 .../px4 => src/systemcmds}/tests/test_time.c | 0 .../systemcmds}/tests/test_uart_baudchange.c | 0 .../systemcmds}/tests/test_uart_console.c | 0 .../systemcmds}/tests/test_uart_loopback.c | 0 .../systemcmds}/tests/test_uart_send.c | 0 {apps/px4 => src/systemcmds}/tests/tests.h | 0 .../px4 => src/systemcmds}/tests/tests_file.c | 0 .../px4 => src/systemcmds}/tests/tests_main.c | 0 .../systemcmds}/tests/tests_param.c | 0 26 files changed, 33 insertions(+), 46 deletions(-) delete mode 100644 apps/px4/tests/Makefile rename {apps/px4 => src/systemcmds}/tests/.context (100%) create mode 100644 src/systemcmds/tests/module.mk rename {apps/px4 => src/systemcmds}/tests/test_adc.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_bson.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_float.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_gpio.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_hott_telemetry.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_hrt.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_int.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_jig_voltages.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_led.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_sensors.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_servo.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_sleep.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_time.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_uart_baudchange.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_uart_console.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_uart_loopback.c (100%) rename {apps/px4 => src/systemcmds}/tests/test_uart_send.c (100%) rename {apps/px4 => src/systemcmds}/tests/tests.h (100%) rename {apps/px4 => src/systemcmds}/tests/tests_file.c (100%) rename {apps/px4 => src/systemcmds}/tests/tests_main.c (100%) rename {apps/px4 => src/systemcmds}/tests/tests_param.c (100%) diff --git a/apps/px4/tests/Makefile b/apps/px4/tests/Makefile deleted file mode 100644 index e27222b9de..0000000000 --- a/apps/px4/tests/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build assorted test cases -# - -APPNAME = tests -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 12000 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os \ No newline at end of file diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 3f634d72cd..e70079fa1f 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -14,7 +14,12 @@ MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu MODULES += drivers/l3gd20 MODULES += drivers/ardrone_interface + +# +# System utilities +# MODULES += systemcmds/eeprom +MODULES += systemcmds/tests # # General system control @@ -72,7 +77,6 @@ BUILTIN_COMMANDS := \ $(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \ $(call _B, sercon, , 2048, sercon_main ) \ $(call _B, serdis, , 2048, serdis_main ) \ - $(call _B, tests, , 12000, tests_main ) \ $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ $(call _B, top, SCHED_PRIORITY_DEFAULT-10, 3000, top_main ) \ $(call _B, param, SCHED_PRIORITY_DEFAULT-10, 2048, param_main ) \ diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 1e5d7d4e13..6e91f3d1a3 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -127,7 +127,6 @@ CONFIGURED_APPS += drivers/mb12xx # Testing stuff CONFIGURED_APPS += px4/sensors_bringup -CONFIGURED_APPS += px4/tests ifeq ($(CONFIG_CAN),y) #CONFIGURED_APPS += examples/can diff --git a/apps/px4/tests/.context b/src/systemcmds/tests/.context similarity index 100% rename from apps/px4/tests/.context rename to src/systemcmds/tests/.context diff --git a/src/systemcmds/tests/module.mk b/src/systemcmds/tests/module.mk new file mode 100644 index 0000000000..754d3a0da9 --- /dev/null +++ b/src/systemcmds/tests/module.mk @@ -0,0 +1,28 @@ +# +# Assorted tests and the like +# + +MODULE_COMMAND = tests +MODULE_STACKSIZE = 12000 +MAXOPTIMIZATION = -Os + +SRCS = test_adc.c \ + test_bson.c \ + test_float.c \ + test_gpio.c \ + test_hott_telemetry.c \ + test_hrt.c \ + test_int.c \ + test_jig_voltages.c \ + test_led.c \ + test_sensors.c \ + test_servo.c \ + test_sleep.c \ + test_time.c \ + test_uart_baudchange.c \ + test_uart_console.c \ + test_uart_loopback.c \ + test_uart_send.c \ + tests_file.c \ + tests_main.c \ + tests_param.c diff --git a/apps/px4/tests/test_adc.c b/src/systemcmds/tests/test_adc.c similarity index 100% rename from apps/px4/tests/test_adc.c rename to src/systemcmds/tests/test_adc.c diff --git a/apps/px4/tests/test_bson.c b/src/systemcmds/tests/test_bson.c similarity index 100% rename from apps/px4/tests/test_bson.c rename to src/systemcmds/tests/test_bson.c diff --git a/apps/px4/tests/test_float.c b/src/systemcmds/tests/test_float.c similarity index 100% rename from apps/px4/tests/test_float.c rename to src/systemcmds/tests/test_float.c diff --git a/apps/px4/tests/test_gpio.c b/src/systemcmds/tests/test_gpio.c similarity index 100% rename from apps/px4/tests/test_gpio.c rename to src/systemcmds/tests/test_gpio.c diff --git a/apps/px4/tests/test_hott_telemetry.c b/src/systemcmds/tests/test_hott_telemetry.c similarity index 100% rename from apps/px4/tests/test_hott_telemetry.c rename to src/systemcmds/tests/test_hott_telemetry.c diff --git a/apps/px4/tests/test_hrt.c b/src/systemcmds/tests/test_hrt.c similarity index 100% rename from apps/px4/tests/test_hrt.c rename to src/systemcmds/tests/test_hrt.c diff --git a/apps/px4/tests/test_int.c b/src/systemcmds/tests/test_int.c similarity index 100% rename from apps/px4/tests/test_int.c rename to src/systemcmds/tests/test_int.c diff --git a/apps/px4/tests/test_jig_voltages.c b/src/systemcmds/tests/test_jig_voltages.c similarity index 100% rename from apps/px4/tests/test_jig_voltages.c rename to src/systemcmds/tests/test_jig_voltages.c diff --git a/apps/px4/tests/test_led.c b/src/systemcmds/tests/test_led.c similarity index 100% rename from apps/px4/tests/test_led.c rename to src/systemcmds/tests/test_led.c diff --git a/apps/px4/tests/test_sensors.c b/src/systemcmds/tests/test_sensors.c similarity index 100% rename from apps/px4/tests/test_sensors.c rename to src/systemcmds/tests/test_sensors.c diff --git a/apps/px4/tests/test_servo.c b/src/systemcmds/tests/test_servo.c similarity index 100% rename from apps/px4/tests/test_servo.c rename to src/systemcmds/tests/test_servo.c diff --git a/apps/px4/tests/test_sleep.c b/src/systemcmds/tests/test_sleep.c similarity index 100% rename from apps/px4/tests/test_sleep.c rename to src/systemcmds/tests/test_sleep.c diff --git a/apps/px4/tests/test_time.c b/src/systemcmds/tests/test_time.c similarity index 100% rename from apps/px4/tests/test_time.c rename to src/systemcmds/tests/test_time.c diff --git a/apps/px4/tests/test_uart_baudchange.c b/src/systemcmds/tests/test_uart_baudchange.c similarity index 100% rename from apps/px4/tests/test_uart_baudchange.c rename to src/systemcmds/tests/test_uart_baudchange.c diff --git a/apps/px4/tests/test_uart_console.c b/src/systemcmds/tests/test_uart_console.c similarity index 100% rename from apps/px4/tests/test_uart_console.c rename to src/systemcmds/tests/test_uart_console.c diff --git a/apps/px4/tests/test_uart_loopback.c b/src/systemcmds/tests/test_uart_loopback.c similarity index 100% rename from apps/px4/tests/test_uart_loopback.c rename to src/systemcmds/tests/test_uart_loopback.c diff --git a/apps/px4/tests/test_uart_send.c b/src/systemcmds/tests/test_uart_send.c similarity index 100% rename from apps/px4/tests/test_uart_send.c rename to src/systemcmds/tests/test_uart_send.c diff --git a/apps/px4/tests/tests.h b/src/systemcmds/tests/tests.h similarity index 100% rename from apps/px4/tests/tests.h rename to src/systemcmds/tests/tests.h diff --git a/apps/px4/tests/tests_file.c b/src/systemcmds/tests/tests_file.c similarity index 100% rename from apps/px4/tests/tests_file.c rename to src/systemcmds/tests/tests_file.c diff --git a/apps/px4/tests/tests_main.c b/src/systemcmds/tests/tests_main.c similarity index 100% rename from apps/px4/tests/tests_main.c rename to src/systemcmds/tests/tests_main.c diff --git a/apps/px4/tests/tests_param.c b/src/systemcmds/tests/tests_param.c similarity index 100% rename from apps/px4/tests/tests_param.c rename to src/systemcmds/tests/tests_param.c From d8a3454538e2a634513defd50b40fb49c194b670 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 00:10:20 +0200 Subject: [PATCH 048/129] Cut over MAVLink to new build system --- apps/mavlink/.context | 0 makefiles/config_px4fmu_default.mk | 4 ++-- {apps => src/include}/mavlink/mavlink_log.h | 0 {apps => src/modules}/mavlink/.gitignore | 0 {apps => src/modules}/mavlink/mavlink.c | 2 +- .../modules}/mavlink/mavlink_bridge_header.h | 2 +- {apps => src/modules}/mavlink/mavlink_hil.h | 0 {apps => src/modules}/mavlink/mavlink_log.c | 2 +- .../modules}/mavlink/mavlink_parameters.c | 0 .../modules}/mavlink/mavlink_parameters.h | 0 .../modules}/mavlink/mavlink_receiver.c | 4 ++-- {apps => src/modules}/mavlink/missionlib.c | 2 +- {apps => src/modules}/mavlink/missionlib.h | 0 .../Makefile => src/modules/mavlink/module.mk | 19 +++++++++++-------- {apps => src/modules}/mavlink/orb_listener.c | 3 ++- {apps => src/modules}/mavlink/orb_topics.h | 0 {apps => src/modules}/mavlink/util.h | 0 {apps => src/modules}/mavlink/waypoints.c | 0 {apps => src/modules}/mavlink/waypoints.h | 0 .../modules}/mavlink_onboard/mavlink.c | 0 .../mavlink_onboard/mavlink_bridge_header.h | 2 +- .../mavlink_onboard/mavlink_receiver.c | 0 .../modules/mavlink_onboard/module.mk | 14 ++++++-------- .../modules}/mavlink_onboard/orb_topics.h | 0 {apps => src/modules}/mavlink_onboard/util.h | 0 25 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 apps/mavlink/.context rename {apps => src/include}/mavlink/mavlink_log.h (100%) rename {apps => src/modules}/mavlink/.gitignore (100%) rename {apps => src/modules}/mavlink/mavlink.c (99%) rename {apps => src/modules}/mavlink/mavlink_bridge_header.h (98%) rename {apps => src/modules}/mavlink/mavlink_hil.h (100%) rename {apps => src/modules}/mavlink/mavlink_log.c (98%) rename {apps => src/modules}/mavlink/mavlink_parameters.c (100%) rename {apps => src/modules}/mavlink/mavlink_parameters.h (100%) rename {apps => src/modules}/mavlink/mavlink_receiver.c (99%) rename {apps => src/modules}/mavlink/missionlib.c (99%) rename {apps => src/modules}/mavlink/missionlib.h (100%) rename apps/mavlink_onboard/Makefile => src/modules/mavlink/module.mk (82%) rename {apps => src/modules}/mavlink/orb_listener.c (99%) rename {apps => src/modules}/mavlink/orb_topics.h (100%) rename {apps => src/modules}/mavlink/util.h (100%) rename {apps => src/modules}/mavlink/waypoints.c (100%) rename {apps => src/modules}/mavlink/waypoints.h (100%) rename {apps => src/modules}/mavlink_onboard/mavlink.c (100%) rename {apps => src/modules}/mavlink_onboard/mavlink_bridge_header.h (98%) rename {apps => src/modules}/mavlink_onboard/mavlink_receiver.c (100%) rename apps/mavlink/Makefile => src/modules/mavlink_onboard/module.mk (85%) rename {apps => src/modules}/mavlink_onboard/orb_topics.h (100%) rename {apps => src/modules}/mavlink_onboard/util.h (100%) diff --git a/apps/mavlink/.context b/apps/mavlink/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index e70079fa1f..44e35bdf9b 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -25,6 +25,8 @@ MODULES += systemcmds/tests # General system control # MODULES += modules/commander +MODULES += modules/mavlink +MODULES += modules/mavlink_onboard # # Estimation modules (EKF / other filters) @@ -60,8 +62,6 @@ BUILTIN_COMMANDS := \ $(call _B, hott_telemetry, , 2048, hott_telemetry_main ) \ $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ - $(call _B, mavlink, , 2048, mavlink_main ) \ - $(call _B, mavlink_onboard, , 2048, mavlink_onboard_main ) \ $(call _B, mixer, , 4096, mixer_main ) \ $(call _B, mpu6000, , 4096, mpu6000_main ) \ $(call _B, ms5611, , 2048, ms5611_main ) \ diff --git a/apps/mavlink/mavlink_log.h b/src/include/mavlink/mavlink_log.h similarity index 100% rename from apps/mavlink/mavlink_log.h rename to src/include/mavlink/mavlink_log.h diff --git a/apps/mavlink/.gitignore b/src/modules/mavlink/.gitignore similarity index 100% rename from apps/mavlink/.gitignore rename to src/modules/mavlink/.gitignore diff --git a/apps/mavlink/mavlink.c b/src/modules/mavlink/mavlink.c similarity index 99% rename from apps/mavlink/mavlink.c rename to src/modules/mavlink/mavlink.c index 644b779af2..de78cd1399 100644 --- a/apps/mavlink/mavlink.c +++ b/src/modules/mavlink/mavlink.c @@ -64,9 +64,9 @@ #include #include #include +#include #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/mavlink_bridge_header.h b/src/modules/mavlink/mavlink_bridge_header.h similarity index 98% rename from apps/mavlink/mavlink_bridge_header.h rename to src/modules/mavlink/mavlink_bridge_header.h index 270ec17274..0010bb341e 100644 --- a/apps/mavlink/mavlink_bridge_header.h +++ b/src/modules/mavlink/mavlink_bridge_header.h @@ -51,7 +51,7 @@ #define MAVLINK_GET_CHANNEL_BUFFER mavlink_get_channel_buffer #define MAVLINK_GET_CHANNEL_STATUS mavlink_get_channel_status -#include "v1.0/mavlink_types.h" +#include #include diff --git a/apps/mavlink/mavlink_hil.h b/src/modules/mavlink/mavlink_hil.h similarity index 100% rename from apps/mavlink/mavlink_hil.h rename to src/modules/mavlink/mavlink_hil.h diff --git a/apps/mavlink/mavlink_log.c b/src/modules/mavlink/mavlink_log.c similarity index 98% rename from apps/mavlink/mavlink_log.c rename to src/modules/mavlink/mavlink_log.c index ed65fb883c..fa974dc0b6 100644 --- a/apps/mavlink/mavlink_log.c +++ b/src/modules/mavlink/mavlink_log.c @@ -42,7 +42,7 @@ #include #include -#include "mavlink_log.h" +#include void mavlink_logbuffer_init(struct mavlink_logbuffer *lb, int size) { diff --git a/apps/mavlink/mavlink_parameters.c b/src/modules/mavlink/mavlink_parameters.c similarity index 100% rename from apps/mavlink/mavlink_parameters.c rename to src/modules/mavlink/mavlink_parameters.c diff --git a/apps/mavlink/mavlink_parameters.h b/src/modules/mavlink/mavlink_parameters.h similarity index 100% rename from apps/mavlink/mavlink_parameters.h rename to src/modules/mavlink/mavlink_parameters.h diff --git a/apps/mavlink/mavlink_receiver.c b/src/modules/mavlink/mavlink_receiver.c similarity index 99% rename from apps/mavlink/mavlink_receiver.c rename to src/modules/mavlink/mavlink_receiver.c index 22c2fcdade..e62e4dcc4c 100644 --- a/apps/mavlink/mavlink_receiver.c +++ b/src/modules/mavlink/mavlink_receiver.c @@ -64,9 +64,9 @@ #include #include +#include #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" @@ -312,7 +312,7 @@ handle_message(mavlink_message_t *msg) static const float ground_press = 1013.25f; // mbar static const float ground_tempC = 21.0f; static const float ground_alt = 0.0f; - static const float T0 = 273.15; + static const float T0 = 273.15f; static const float R = 287.05f; static const float g = 9.806f; diff --git a/apps/mavlink/missionlib.c b/src/modules/mavlink/missionlib.c similarity index 99% rename from apps/mavlink/missionlib.c rename to src/modules/mavlink/missionlib.c index 8064febc47..d369e05ffa 100644 --- a/apps/mavlink/missionlib.c +++ b/src/modules/mavlink/missionlib.c @@ -62,9 +62,9 @@ #include #include +#include #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/missionlib.h b/src/modules/mavlink/missionlib.h similarity index 100% rename from apps/mavlink/missionlib.h rename to src/modules/mavlink/missionlib.h diff --git a/apps/mavlink_onboard/Makefile b/src/modules/mavlink/module.mk similarity index 82% rename from apps/mavlink_onboard/Makefile rename to src/modules/mavlink/module.mk index 8b1cb9b2c7..cbf08aeb20 100644 --- a/apps/mavlink_onboard/Makefile +++ b/src/modules/mavlink/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,16 @@ ############################################################################ # -# Mavlink Application +# MAVLink protocol to uORB interface process # -APPNAME = mavlink_onboard -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mavlink +SRCS += mavlink.c \ + missionlib.c \ + mavlink_parameters.c \ + mavlink_log.c \ + mavlink_receiver.c \ + orb_listener.c \ + waypoints.c -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk +INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink diff --git a/apps/mavlink/orb_listener.c b/src/modules/mavlink/orb_listener.c similarity index 99% rename from apps/mavlink/orb_listener.c rename to src/modules/mavlink/orb_listener.c index 5f15facf87..295cd5e28c 100644 --- a/apps/mavlink/orb_listener.c +++ b/src/modules/mavlink/orb_listener.c @@ -56,8 +56,9 @@ #include #include +#include + #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/orb_topics.h b/src/modules/mavlink/orb_topics.h similarity index 100% rename from apps/mavlink/orb_topics.h rename to src/modules/mavlink/orb_topics.h diff --git a/apps/mavlink/util.h b/src/modules/mavlink/util.h similarity index 100% rename from apps/mavlink/util.h rename to src/modules/mavlink/util.h diff --git a/apps/mavlink/waypoints.c b/src/modules/mavlink/waypoints.c similarity index 100% rename from apps/mavlink/waypoints.c rename to src/modules/mavlink/waypoints.c diff --git a/apps/mavlink/waypoints.h b/src/modules/mavlink/waypoints.h similarity index 100% rename from apps/mavlink/waypoints.h rename to src/modules/mavlink/waypoints.h diff --git a/apps/mavlink_onboard/mavlink.c b/src/modules/mavlink_onboard/mavlink.c similarity index 100% rename from apps/mavlink_onboard/mavlink.c rename to src/modules/mavlink_onboard/mavlink.c diff --git a/apps/mavlink_onboard/mavlink_bridge_header.h b/src/modules/mavlink_onboard/mavlink_bridge_header.h similarity index 98% rename from apps/mavlink_onboard/mavlink_bridge_header.h rename to src/modules/mavlink_onboard/mavlink_bridge_header.h index bf7c5354cc..3ad3bb6175 100644 --- a/apps/mavlink_onboard/mavlink_bridge_header.h +++ b/src/modules/mavlink_onboard/mavlink_bridge_header.h @@ -51,7 +51,7 @@ #define MAVLINK_GET_CHANNEL_BUFFER mavlink_get_channel_buffer #define MAVLINK_GET_CHANNEL_STATUS mavlink_get_channel_status -#include "v1.0/mavlink_types.h" +#include #include diff --git a/apps/mavlink_onboard/mavlink_receiver.c b/src/modules/mavlink_onboard/mavlink_receiver.c similarity index 100% rename from apps/mavlink_onboard/mavlink_receiver.c rename to src/modules/mavlink_onboard/mavlink_receiver.c diff --git a/apps/mavlink/Makefile b/src/modules/mavlink_onboard/module.mk similarity index 85% rename from apps/mavlink/Makefile rename to src/modules/mavlink_onboard/module.mk index 8ddb69b71d..c40fa042e8 100644 --- a/apps/mavlink/Makefile +++ b/src/modules/mavlink_onboard/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,11 @@ ############################################################################ # -# Mavlink Application +# MAVLink protocol to uORB interface process (XXX hack for onboard use) # -APPNAME = mavlink -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mavlink_onboard +SRCS = mavlink.c \ + mavlink_receiver.c -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk +INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink diff --git a/apps/mavlink_onboard/orb_topics.h b/src/modules/mavlink_onboard/orb_topics.h similarity index 100% rename from apps/mavlink_onboard/orb_topics.h rename to src/modules/mavlink_onboard/orb_topics.h diff --git a/apps/mavlink_onboard/util.h b/src/modules/mavlink_onboard/util.h similarity index 100% rename from apps/mavlink_onboard/util.h rename to src/modules/mavlink_onboard/util.h From f924e312fa8022c6f4ee61cd8c0d6693ccb8a743 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 00:11:16 +0200 Subject: [PATCH 049/129] Merged --- src/modules/attitude_estimator_ekf/module.mk | 62 ++++++++++++++++---- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/src/modules/attitude_estimator_ekf/module.mk b/src/modules/attitude_estimator_ekf/module.mk index 5ce5451122..bfb7db9977 100644 --- a/src/modules/attitude_estimator_ekf/module.mk +++ b/src/modules/attitude_estimator_ekf/module.mk @@ -1,16 +1,52 @@ +############################################################################ +# +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# Attitude estimator (Extended Kalman Filter) +# MODULE_NAME = attitude_estimator_ekf -SRCS = attitude_estimator_ekf_main.cpp \ - attitude_estimator_ekf_params.c \ - codegen/attitudeKalmanfilter_initialize.c \ - codegen/attitudeKalmanfilter_terminate.c \ - codegen/attitudeKalmanfilter.c \ - codegen/cross.c \ - codegen/eye.c \ - codegen/mrdivide.c \ - codegen/norm.c \ - codegen/rdivide.c \ - codegen/rt_nonfinite.c \ - codegen/rtGetInf.c \ - codegen/rtGetNaN.c +CXXSRCS = attitude_estimator_ekf_main.cpp +SRCS = attitude_estimator_ekf_params.c \ + codegen/eye.c \ + codegen/attitudeKalmanfilter.c \ + codegen/mrdivide.c \ + codegen/rdivide.c \ + codegen/attitudeKalmanfilter_initialize.c \ + codegen/attitudeKalmanfilter_terminate.c \ + codegen/rt_nonfinite.c \ + codegen/rtGetInf.c \ + codegen/rtGetNaN.c \ + codegen/norm.c \ + codegen/cross.c From 51badab96ddd4273595cf49e494375d7f2235708 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 00:13:35 +0200 Subject: [PATCH 051/129] Deleted old cruft --- apps/systemcmds/delay_test/Makefile | 44 ------- apps/systemcmds/delay_test/delay_test.c | 160 ------------------------ 2 files changed, 204 deletions(-) delete mode 100644 apps/systemcmds/delay_test/Makefile delete mode 100644 apps/systemcmds/delay_test/delay_test.c diff --git a/apps/systemcmds/delay_test/Makefile b/apps/systemcmds/delay_test/Makefile deleted file mode 100644 index e54cf2f4e4..0000000000 --- a/apps/systemcmds/delay_test/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Delay test -# - -APPNAME = delay_test -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/delay_test/delay_test.c b/apps/systemcmds/delay_test/delay_test.c deleted file mode 100644 index 51cce38fca..0000000000 --- a/apps/systemcmds/delay_test/delay_test.c +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: Lorenz Meier - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file delay_test.c - * - * Simple but effective delay test using leds and a scope to measure - * communication delays end-to-end accurately. - * - * @author Lorenz Meier - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -__EXPORT int delay_test_main(int argc, char *argv[]); -static int led_on(int leds, int led); -static int led_off(int leds, int led); - -int delay_test_main(int argc, char *argv[]) -{ - bool vicon_msg = false; - bool command_msg = false; - - if (argc > 1 && !strcmp(argv[1], "--help")) { - warnx("usage: delay_test [vicon] [command]\n"); - exit(1); - } - - if (argc > 1 && !strcmp(argv[1], "vicon")) { - vicon_msg = true; - } - - if (argc > 1 && !strcmp(argv[1], "command")) { - command_msg = true; - } - - int buzzer = open("/dev/tone_alarm", O_WRONLY); - int leds = open(LED_DEVICE_PATH, 0); - - /* prepare use of amber led */ - led_off(leds, LED_AMBER); - - int topic; - - /* subscribe to topic */ - if (vicon_msg) { - topic = orb_subscribe(ORB_ID(vehicle_vicon_position)); - } else if (command_msg) { - topic = orb_subscribe(ORB_ID(vehicle_command)); - } else { - errx(1, "No topic selected for delay test, use --help for a list of topics."); - } - - const int testcount = 20; - - warnx("running %d iterations..\n", testcount); - - struct pollfd fds[1]; - fds[0].fd = topic; - fds[0].events = POLLIN; - - /* display and sound error */ - for (int i = 0; i < testcount; i++) - { - /* wait for topic */ - int ret = poll(&fds[0], 1, 2000); - - /* this would be bad... */ - if (ret < 0) { - warnx("poll error %d", errno); - usleep(1000000); - continue; - } - - /* do we have a topic update? */ - if (fds[0].revents & POLLIN) { - - /* copy object to disable poll ready state */ - if (vicon_msg) { - struct vehicle_vicon_position_s vicon_position; - orb_copy(ORB_ID(vehicle_vicon_position), topic, &vicon_position); - } else if (command_msg) { - struct vehicle_command_s vehicle_command; - orb_copy(ORB_ID(vehicle_command), topic, &vehicle_command); - } - - led_on(leds, LED_AMBER); - ioctl(buzzer, TONE_SET_ALARM, 4); - /* keep led on for 50 ms to make it barely visible */ - usleep(50000); - led_off(leds, LED_AMBER); - } - } - - /* stop alarm */ - ioctl(buzzer, TONE_SET_ALARM, 0); - - /* switch on leds */ - led_on(leds, LED_BLUE); - led_on(leds, LED_AMBER); - - exit(0); -} - -static int led_off(int leds, int led) -{ - return ioctl(leds, LED_OFF, led); -} - -static int led_on(int leds, int led) -{ - return ioctl(leds, LED_ON, led); -} \ No newline at end of file From 574e76532126fea8ab0ac5fd0595f6fb2935f0dd Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 11:30:41 +0200 Subject: [PATCH 052/129] Moved all system commands to the new world --- apps/systemcmds/boardinfo/.context | 0 apps/systemcmds/calibration/Makefile | 44 --- apps/systemcmds/calibration/calibration.c | 147 ---------- apps/systemcmds/calibration/calibration.h | 60 ---- apps/systemcmds/calibration/channels_cal.c | 196 ------------- apps/systemcmds/calibration/range_cal.c | 224 --------------- apps/systemcmds/calibration/servo_cal.c | 264 ------------------ apps/systemcmds/perf/.context | 0 apps/systemcmds/reboot/.context | 0 apps/systemcmds/top/.context | 0 apps/systemcmds/top/Makefile | 44 --- makefiles/config_px4fmu_default.mk | 22 +- src/modules/mavlink_onboard/module.mk | 2 +- .../systemcmds/bl_update/bl_update.c | 2 +- .../systemcmds/bl_update/module.mk | 11 +- .../systemcmds/boardinfo/boardinfo.c | 2 +- .../systemcmds/boardinfo/module.mk | 11 +- src/systemcmds/eeprom/module.mk | 33 +++ {apps => src}/systemcmds/i2c/i2c.c | 2 +- .../Makefile => src/systemcmds/i2c/module.mk | 9 +- {apps => src}/systemcmds/mixer/mixer.c | 0 .../systemcmds/mixer/module.mk | 9 +- .../systemcmds/param/module.mk | 10 +- {apps => src}/systemcmds/param/param.c | 0 .../Makefile => src/systemcmds/perf/module.mk | 9 +- {apps => src}/systemcmds/perf/perf.c | 2 +- .../systemcmds/preflight_check/module.mk | 12 +- .../preflight_check/preflight_check.c | 2 +- .../Makefile => src/systemcmds/pwm/module.mk | 9 +- {apps => src}/systemcmds/pwm/pwm.c | 0 src/systemcmds/reboot/module.mk | 41 +++ {apps => src}/systemcmds/reboot/reboot.c | 0 .../Makefile => src/systemcmds/top/module.mk | 12 +- {apps => src}/systemcmds/top/top.c | 0 34 files changed, 131 insertions(+), 1048 deletions(-) delete mode 100644 apps/systemcmds/boardinfo/.context delete mode 100644 apps/systemcmds/calibration/Makefile delete mode 100755 apps/systemcmds/calibration/calibration.c delete mode 100644 apps/systemcmds/calibration/calibration.h delete mode 100755 apps/systemcmds/calibration/channels_cal.c delete mode 100755 apps/systemcmds/calibration/range_cal.c delete mode 100644 apps/systemcmds/calibration/servo_cal.c delete mode 100644 apps/systemcmds/perf/.context delete mode 100644 apps/systemcmds/reboot/.context delete mode 100644 apps/systemcmds/top/.context delete mode 100644 apps/systemcmds/top/Makefile rename {apps => src}/systemcmds/bl_update/bl_update.c (98%) rename apps/systemcmds/bl_update/Makefile => src/systemcmds/bl_update/module.mk (88%) rename {apps => src}/systemcmds/boardinfo/boardinfo.c (99%) rename apps/systemcmds/preflight_check/Makefile => src/systemcmds/boardinfo/module.mk (89%) rename {apps => src}/systemcmds/i2c/i2c.c (98%) rename apps/systemcmds/i2c/Makefile => src/systemcmds/i2c/module.mk (91%) rename {apps => src}/systemcmds/mixer/mixer.c (100%) rename apps/systemcmds/mixer/Makefile => src/systemcmds/mixer/module.mk (91%) rename apps/systemcmds/param/Makefile => src/systemcmds/param/module.mk (91%) rename {apps => src}/systemcmds/param/param.c (100%) rename apps/systemcmds/perf/Makefile => src/systemcmds/perf/module.mk (91%) rename {apps => src}/systemcmds/perf/perf.c (97%) rename apps/systemcmds/boardinfo/Makefile => src/systemcmds/preflight_check/module.mk (86%) rename {apps => src}/systemcmds/preflight_check/preflight_check.c (98%) rename apps/systemcmds/pwm/Makefile => src/systemcmds/pwm/module.mk (91%) rename {apps => src}/systemcmds/pwm/pwm.c (100%) create mode 100644 src/systemcmds/reboot/module.mk rename {apps => src}/systemcmds/reboot/reboot.c (100%) rename apps/systemcmds/reboot/Makefile => src/systemcmds/top/module.mk (90%) rename {apps => src}/systemcmds/top/top.c (100%) diff --git a/apps/systemcmds/boardinfo/.context b/apps/systemcmds/boardinfo/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/systemcmds/calibration/Makefile b/apps/systemcmds/calibration/Makefile deleted file mode 100644 index a1735962e1..0000000000 --- a/apps/systemcmds/calibration/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the calibration tool -# - -APPNAME = calibration -PRIORITY = SCHED_PRIORITY_MAX - 1 -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/calibration/calibration.c b/apps/systemcmds/calibration/calibration.c deleted file mode 100755 index 7f8b9240f4..0000000000 --- a/apps/systemcmds/calibration/calibration.c +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** - * calibration.c - * - * Copyright (C) 2012 Ivan Ovinnikov. All rights reserved. - * Authors: Nils Wenzler - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include -#include -#include -#include "calibration.h" - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static int calibrate_help(int argc, char *argv[]); -static int calibrate_all(int argc, char *argv[]); - -__EXPORT int calibration_main(int argc, char *argv[]); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -struct { - const char *name; - int (* fn)(int argc, char *argv[]); - unsigned options; -#define OPT_NOHELP (1<<0) -#define OPT_NOALLTEST (1<<1) -} calibrates[] = { - {"range", range_cal, 0}, - {"servo", servo_cal, 0}, - {"all", calibrate_all, OPT_NOALLTEST}, - {"help", calibrate_help, OPT_NOALLTEST | OPT_NOHELP}, - {NULL, NULL} -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int -calibrate_help(int argc, char *argv[]) -{ - unsigned i; - - printf("Available calibration routines:\n"); - - for (i = 0; calibrates[i].name; i++) - printf(" %s\n", calibrates[i].name); - - return 0; -} - -static int -calibrate_all(int argc, char *argv[]) -{ - unsigned i; - char *args[2] = {"all", NULL}; - - printf("Running all calibration routines...\n\n"); - - for (i = 0; calibrates[i].name; i++) { - printf(" %s:\n", calibrates[i].name); - - if (calibrates[i].fn(1, args)) { - printf(" FAIL\n"); - - } else { - printf(" DONE\n"); - } - } - - return 0; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void press_enter(void) -{ - int c; - printf("Press CTRL+ENTER to continue... \n"); - fflush(stdout); - - do c = getchar(); while ((c != '\n') && (c != EOF)); -} - -/**************************************************************************** - * Name: calibrate_main - ****************************************************************************/ - -int calibration_main(int argc, char *argv[]) -{ - unsigned i; - - if (argc < 2) { - printf("calibration: missing name - 'calibration help' for a list of routines\n"); - return 1; - } - - for (i = 0; calibrates[i].name; i++) { - if (!strcmp(calibrates[i].name, argv[1])) - return calibrates[i].fn(argc - 1, argv + 1); - } - - printf("calibrate: no routines called '%s' - 'calibration help' for a list of routines\n", argv[1]); - return 1; -} diff --git a/apps/systemcmds/calibration/calibration.h b/apps/systemcmds/calibration/calibration.h deleted file mode 100644 index 028853ec8e..0000000000 --- a/apps/systemcmds/calibration/calibration.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -#ifndef _CALIBRATION_H -#define _CALIBRATION_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -extern int range_cal(int argc, char *argv[]); -extern int servo_cal(int argc, char *argv[]); - -#endif diff --git a/apps/systemcmds/calibration/channels_cal.c b/apps/systemcmds/calibration/channels_cal.c deleted file mode 100755 index 575138b120..0000000000 --- a/apps/systemcmds/calibration/channels_cal.c +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * channels_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include -#include -#include -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ -#define ABS(a) (((a) < 0) ? -(a) : (a)) -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t old_values[NR_CHANNELS]; -uint16_t cur_values[NR_CHANNELS]; -uint8_t function_map[NR_CHANNELS]; -char names[12][9]; - - - -/**************************************************************************** - * Private Functions - ****************************************************************************/ -void press_enter_2(void) -{ - int c; - printf("Press CTRL+ENTER to continue... \n"); - fflush(stdout); - - do c = getchar(); while ((c != '\n') && (c != EOF)); -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_val(uint16_t *buffer) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel: %i\t RAW Value: %i: \n", i, global_data_rc_channels->chan[i].raw); - buffer[i] = global_data_rc_channels->chan[i].raw; - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -void set_channel(void) -{ - static uint8_t j = 0; - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - if (ABS(old_values - cur_values) > 50) { - function_map[j] = i; - strcpy(names[i], global_data_rc_channels->function_names[j]); - j++; - } - } -} - -void write_dat(void) -{ - global_data_lock(&global_data_rc_channels->access_conf); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - global_data_rc_channels->function[i] = function_map[i]; - strcpy(global_data_rc_channels->chan[i].name, names[i]); - - printf("Channel %i\t Function %s\n", i, - global_data_rc_channels->chan[i].name); - } - - global_data_unlock(&global_data_rc_channels->access_conf); -} - - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int channels_cal(int argc, char *argv[]) -{ - - printf("This routine maps the input functions on the remote control\n"); - printf("to the corresponding function (Throttle, Roll,..)\n"); - printf("Always move the stick all the way\n"); - press_enter_2(); - - printf("Pull the THROTTLE stick down\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Move the THROTTLE stick up\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Pull the PITCH stick down\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Move the PITCH stick up\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Put the ROLL stick to the left\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Put the ROLL stick to the right\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Put the YAW stick to the left\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Put the YAW stick to the right\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - uint8_t k; - - for (k = 5; k < NR_CHANNELS; k++) { - function_map[k] = k; - strcpy(names[k], global_data_rc_channels->function_names[k]); - } - -//write the values to global_data_rc_channels - write_dat(); - - return 0; - -} - diff --git a/apps/systemcmds/calibration/range_cal.c b/apps/systemcmds/calibration/range_cal.c deleted file mode 100755 index 159a0d06b7..0000000000 --- a/apps/systemcmds/calibration/range_cal.c +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** - * range_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include -#include -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t max_values[NR_CHANNELS]; -uint16_t min_values[NR_CHANNELS]; -uint16_t mid_values[NR_CHANNELS]; - - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**This sets the middle values - */ -uint8_t set_mid(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - if (i == global_data_rc_channels->function[ROLL] || - i == global_data_rc_channels->function[YAW] || - i == global_data_rc_channels->function[PITCH]) { - - mid_values[i] = global_data_rc_channels->chan[i].raw; - - } else { - mid_values[i] = (max_values[i] + min_values[i]) / 2; - } - - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_value(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - //see if the value is bigger or smaller than 1500 (roughly neutral) - //and write to the appropriate array - if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw < 1500) { - min_values[i] = global_data_rc_channels->chan[i].raw; - - } else if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw > 1500) { - max_values[i] = global_data_rc_channels->chan[i].raw; - - } else { - max_values[i] = 0; - min_values[i] = 0; - } - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - - -void write_data(void) -{ - // global_data_lock(&global_data_rc_channels->access_conf); - // uint8_t i; - // for(i=0; i < NR_CHANNELS; i++){ - // //Write the data to global_data_rc_channels (if not 0) - // if(mid_values[i]!=0 && min_values[i]!=0 && max_values[i]!=0){ - // global_data_rc_channels->chan[i].scaling_factor = - // 10000/((max_values[i] - min_values[i])/2); - // - // global_data_rc_channels->chan[i].mid = mid_values[i]; - // } - // - // printf("Channel %i\t Function %s \t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - // i, - // global_data_rc_channels->function_name[global_data_rc_channels->function[i]], - // min_values[i], max_values[i], - // global_data_rc_channels->chan[i].scaling_factor, - // global_data_rc_channels->chan[i].mid); - // } - // global_data_unlock(&global_data_rc_channels->access_conf); - - //Write to the Parameter storage - - global_data_parameter_storage->pm.param_values[PARAM_RC1_MIN] = min_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_MIN] = min_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_MIN] = min_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_MIN] = min_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_MIN] = min_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_MIN] = min_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_MIN] = min_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_MIN] = min_values[7]; - - - global_data_parameter_storage->pm.param_values[PARAM_RC1_MAX] = max_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_MAX] = max_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_MAX] = max_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_MAX] = max_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_MAX] = max_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_MAX] = max_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_MAX] = max_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_MAX] = max_values[7]; - - - global_data_parameter_storage->pm.param_values[PARAM_RC1_TRIM] = mid_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_TRIM] = mid_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_TRIM] = mid_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_TRIM] = mid_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_TRIM] = mid_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_TRIM] = mid_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_TRIM] = mid_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_TRIM] = mid_values[7]; - - usleep(3e6); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel %i:\t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - i, - min_values[i], max_values[i], - global_data_rc_channels->chan[i].scaling_factor, - global_data_rc_channels->chan[i].mid); - } - - -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int range_cal(int argc, char *argv[]) -{ - - printf("The range calibration routine assumes you already did the channel\n"); - printf("assignment\n"); - printf("This routine chooses the minimum, maximum and middle\n"); - printf("value for each channel separatly. The ROLL, PITCH and YAW function\n"); - printf("get their middle value from the RC direct, for the rest it is\n"); - printf("calculated out of the min and max values.\n"); - press_enter(); - - printf("Hold both sticks in lower left corner and continue\n "); - press_enter(); - usleep(500000); - - while (get_value()); - - printf("Hold both sticks in upper right corner and continue\n"); - press_enter(); - usleep(500000); - - while (get_value()); - - printf("Set the trim to 0 and leave the sticks in the neutral position\n"); - press_enter(); - - //Loop until successfull - while (set_mid()); - - //write the values to global_data_rc_channels - write_data(); - - return 0; - -} - diff --git a/apps/systemcmds/calibration/servo_cal.c b/apps/systemcmds/calibration/servo_cal.c deleted file mode 100644 index 96b3045a95..0000000000 --- a/apps/systemcmds/calibration/servo_cal.c +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** - * servo_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include -#include -#include -#include -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t max_values_servo[PWM_SERVO_MAX_CHANNELS]; -uint16_t min_values_servo[PWM_SERVO_MAX_CHANNELS]; -uint16_t mid_values_servo[PWM_SERVO_MAX_CHANNELS]; - -// Servo loop thread - -pthread_t servo_calib_thread; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**This sets the middle values - */ -uint8_t set_mid_s(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < PWM_SERVO_MAX_CHANNELS; i++) { - if (i == global_data_rc_channels->function[ROLL] || - i == global_data_rc_channels->function[YAW] || - i == global_data_rc_channels->function[PITCH]) { - - mid_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else { - mid_values_servo[i] = (max_values_servo[i] + min_values_servo[i]) / 2; - } - - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_value_s(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < PWM_SERVO_MAX_CHANNELS; i++) { - //see if the value is bigger or smaller than 1500 (roughly neutral) - //and write to the appropriate array - if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw < 1500) { - min_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw > 1500) { - max_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else { - max_values_servo[i] = 0; - min_values_servo[i] = 0; - } - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - - -void write_data_s(void) -{ - // global_data_lock(&global_data_rc_channels->access_conf); - // uint8_t i; - // for(i=0; i < NR_CHANNELS; i++){ - // //Write the data to global_data_rc_channels (if not 0) - // if(mid_values_servo[i]!=0 && min_values_servo[i]!=0 && max_values_servo[i]!=0){ - // global_data_rc_channels->chan[i].scaling_factor = - // 10000/((max_values_servo[i] - min_values_servo[i])/2); - // - // global_data_rc_channels->chan[i].mid = mid_values_servo[i]; - // } - // - // printf("Channel %i\t Function %s \t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - // i, - // global_data_rc_channels->function_name[global_data_rc_channels->function[i]], - // min_values_servo[i], max_values_servo[i], - // global_data_rc_channels->chan[i].scaling_factor, - // global_data_rc_channels->chan[i].mid); - // } - // global_data_unlock(&global_data_rc_channels->access_conf); - - //Write to the Parameter storage - - - - global_data_lock(&global_data_parameter_storage->access_conf); - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_MIN] = min_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_MIN] = min_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_MIN] = min_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_MIN] = min_values_servo[3]; - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_MAX] = max_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_MAX] = max_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_MAX] = max_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_MAX] = max_values_servo[3]; - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_TRIM] = mid_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_TRIM] = mid_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_TRIM] = mid_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_TRIM] = mid_values_servo[3]; - - global_data_unlock(&global_data_parameter_storage->access_conf); - - usleep(3e6); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel %i:\t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - i, - min_values_servo[i], max_values_servo[i], - global_data_rc_channels->chan[i].scaling_factor, - global_data_rc_channels->chan[i].mid); - } - -} - -static void *servo_loop(void *arg) -{ - - // Set thread name - prctl(1, "calibration servo", getpid()); - - // initialize servos - int fd; - servo_position_t data[PWM_SERVO_MAX_CHANNELS]; - - fd = open("/dev/pwm_servo", O_RDWR); - - if (fd < 0) { - printf("failed opening /dev/pwm_servo\n"); - } - - ioctl(fd, PWM_SERVO_ARM, 0); - - while (1) { - int i; - - for (i = 0; i < 4; i++) { - data[i] = global_data_rc_channels->chan[global_data_rc_channels->function[THROTTLE]].raw; - } - - int result = write(fd, &data, sizeof(data)); - - if (result != sizeof(data)) { - printf("failed bulk-reading channel values\n"); - } - - // 5Hz loop - usleep(200000); - } - - return NULL; -} - - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int servo_cal(int argc, char *argv[]) -{ - // pthread_attr_t servo_loop_attr; - // pthread_attr_init(&servo_loop_attr); - // pthread_attr_setstacksize(&servo_loop_attr, 1024); - pthread_create(&servo_calib_thread, NULL, servo_loop, NULL); - pthread_join(servo_calib_thread, NULL); - - printf("The servo calibration routine assumes you already did the channel\n"); - printf("assignment with 'calibration channels'\n"); - printf("This routine chooses the minimum, maximum and middle\n"); - printf("value for each channel separately. The ROLL, PITCH and YAW function\n"); - printf("get their middle value from the RC direct, for the rest it is\n"); - printf("calculated out of the min and max values.\n"); - press_enter(); - - printf("Hold both sticks in lower left corner and continue\n "); - press_enter(); - usleep(500000); - - while (get_value_s()); - - printf("Hold both sticks in upper right corner and continue\n"); - press_enter(); - usleep(500000); - - while (get_value_s()); - - printf("Set the trim to 0 and leave the sticks in the neutral position\n"); - press_enter(); - - //Loop until successfull - while (set_mid_s()); - - //write the values to global_data_rc_channels - write_data_s(); - - return 0; - -} - diff --git a/apps/systemcmds/perf/.context b/apps/systemcmds/perf/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/systemcmds/reboot/.context b/apps/systemcmds/reboot/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/systemcmds/top/.context b/apps/systemcmds/top/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/systemcmds/top/Makefile b/apps/systemcmds/top/Makefile deleted file mode 100644 index f58f9212e7..0000000000 --- a/apps/systemcmds/top/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# realtime system performance display -# - -APPNAME = top -PRIORITY = SCHED_PRIORITY_DEFAULT - 10 -STACKSIZE = 3000 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 44e35bdf9b..b3ebe45532 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -16,9 +16,19 @@ MODULES += drivers/l3gd20 MODULES += drivers/ardrone_interface # -# System utilities +# System commands # MODULES += systemcmds/eeprom +MODULES += systemcmds/bl_update +MODULES += systemcmds/boardinfo +MODULES += systemcmds/i2c +MODULES += systemcmds/mixer +MODULES += systemcmds/param +MODULES += systemcmds/perf +MODULES += systemcmds/preflight_check +MODULES += systemcmds/pwm +MODULES += systemcmds/reboot +MODULES += systemcmds/top MODULES += systemcmds/tests # @@ -48,12 +58,9 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ $(call _B, adc, , 2048, adc_main ) \ - $(call _B, bl_update, , 4096, bl_update_main ) \ $(call _B, blinkm, , 2048, blinkm_main ) \ $(call _B, bma180, , 2048, bma180_main ) \ - $(call _B, boardinfo, , 2048, boardinfo_main ) \ $(call _B, control_demo, , 2048, control_demo_main ) \ - $(call _B, delay_test, , 2048, delay_test_main ) \ $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ $(call _B, gps, , 2048, gps_main ) \ @@ -62,22 +69,15 @@ BUILTIN_COMMANDS := \ $(call _B, hott_telemetry, , 2048, hott_telemetry_main ) \ $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ - $(call _B, mixer, , 4096, mixer_main ) \ $(call _B, mpu6000, , 4096, mpu6000_main ) \ $(call _B, ms5611, , 2048, ms5611_main ) \ $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ - $(call _B, param, , 4096, param_main ) \ - $(call _B, perf, , 2048, perf_main ) \ $(call _B, position_estimator, , 4096, position_estimator_main ) \ - $(call _B, preflight_check, , 2048, preflight_check_main ) \ $(call _B, px4io, , 2048, px4io_main ) \ - $(call _B, reboot, , 2048, reboot_main ) \ $(call _B, sdlog, SCHED_PRIORITY_MAX-30, 2048, sdlog_main ) \ $(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \ $(call _B, sercon, , 2048, sercon_main ) \ $(call _B, serdis, , 2048, serdis_main ) \ $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ - $(call _B, top, SCHED_PRIORITY_DEFAULT-10, 3000, top_main ) \ - $(call _B, param, SCHED_PRIORITY_DEFAULT-10, 2048, param_main ) \ $(call _B, uorb, , 4096, uorb_main ) diff --git a/src/modules/mavlink_onboard/module.mk b/src/modules/mavlink_onboard/module.mk index c40fa042e8..a7a4980faf 100644 --- a/src/modules/mavlink_onboard/module.mk +++ b/src/modules/mavlink_onboard/module.mk @@ -37,6 +37,6 @@ MODULE_COMMAND = mavlink_onboard SRCS = mavlink.c \ - mavlink_receiver.c + mavlink_receiver.c INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink diff --git a/apps/systemcmds/bl_update/bl_update.c b/src/systemcmds/bl_update/bl_update.c similarity index 98% rename from apps/systemcmds/bl_update/bl_update.c rename to src/systemcmds/bl_update/bl_update.c index 45715b7918..0569d89f50 100644 --- a/apps/systemcmds/bl_update/bl_update.c +++ b/src/systemcmds/bl_update/bl_update.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/systemcmds/bl_update/Makefile b/src/systemcmds/bl_update/module.mk similarity index 88% rename from apps/systemcmds/bl_update/Makefile rename to src/systemcmds/bl_update/module.mk index d05493577a..e8eea045e5 100644 --- a/apps/systemcmds/bl_update/Makefile +++ b/src/systemcmds/bl_update/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,12 @@ ############################################################################ # -# Build the eeprom tool. +# Bootloader updater (flashes the FMU USB bootloader software) # -APPNAME = bl_update -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = bl_update +SRCS = bl_update.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/boardinfo/boardinfo.c b/src/systemcmds/boardinfo/boardinfo.c similarity index 99% rename from apps/systemcmds/boardinfo/boardinfo.c rename to src/systemcmds/boardinfo/boardinfo.c index fb8b07ef4f..3ff5a066c1 100644 --- a/apps/systemcmds/boardinfo/boardinfo.c +++ b/src/systemcmds/boardinfo/boardinfo.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/systemcmds/preflight_check/Makefile b/src/systemcmds/boardinfo/module.mk similarity index 89% rename from apps/systemcmds/preflight_check/Makefile rename to src/systemcmds/boardinfo/module.mk index 98aadaa86f..6851d229b2 100644 --- a/apps/systemcmds/preflight_check/Makefile +++ b/src/systemcmds/boardinfo/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,10 @@ ############################################################################ # -# Reboot command. +# Information about FMU and IO boards connected # -APPNAME = preflight_check -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = boardinfo +SRCS = boardinfo.c MAXOPTIMIZATION = -Os diff --git a/src/systemcmds/eeprom/module.mk b/src/systemcmds/eeprom/module.mk index 3b4fc04791..07f3945be2 100644 --- a/src/systemcmds/eeprom/module.mk +++ b/src/systemcmds/eeprom/module.mk @@ -1,3 +1,36 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + # # EEPROM file system driver # diff --git a/apps/systemcmds/i2c/i2c.c b/src/systemcmds/i2c/i2c.c similarity index 98% rename from apps/systemcmds/i2c/i2c.c rename to src/systemcmds/i2c/i2c.c index e1babdc12b..4da238039c 100644 --- a/apps/systemcmds/i2c/i2c.c +++ b/src/systemcmds/i2c/i2c.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: Lorenz Meier * * Redistribution and use in source and binary forms, with or without diff --git a/apps/systemcmds/i2c/Makefile b/src/systemcmds/i2c/module.mk similarity index 91% rename from apps/systemcmds/i2c/Makefile rename to src/systemcmds/i2c/module.mk index 046e747571..ab2357c7d0 100644 --- a/apps/systemcmds/i2c/Makefile +++ b/src/systemcmds/i2c/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Build the i2c test tool. # -APPNAME = i2c -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = i2c +SRCS = i2c.c -include $(APPDIR)/mk/app.mk +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/mixer/mixer.c b/src/systemcmds/mixer/mixer.c similarity index 100% rename from apps/systemcmds/mixer/mixer.c rename to src/systemcmds/mixer/mixer.c diff --git a/apps/systemcmds/mixer/Makefile b/src/systemcmds/mixer/module.mk similarity index 91% rename from apps/systemcmds/mixer/Makefile rename to src/systemcmds/mixer/module.mk index 3d8ac38cb7..d5a3f9f77b 100644 --- a/apps/systemcmds/mixer/Makefile +++ b/src/systemcmds/mixer/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,9 @@ # Build the mixer tool. # -APPNAME = mixer -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = mixer +SRCS = mixer.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/param/Makefile b/src/systemcmds/param/module.mk similarity index 91% rename from apps/systemcmds/param/Makefile rename to src/systemcmds/param/module.mk index f19cadbb60..63f15ad286 100644 --- a/apps/systemcmds/param/Makefile +++ b/src/systemcmds/param/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,10 @@ # Build the parameters tool. # -APPNAME = param -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = param +SRCS = param.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os + diff --git a/apps/systemcmds/param/param.c b/src/systemcmds/param/param.c similarity index 100% rename from apps/systemcmds/param/param.c rename to src/systemcmds/param/param.c diff --git a/apps/systemcmds/perf/Makefile b/src/systemcmds/perf/module.mk similarity index 91% rename from apps/systemcmds/perf/Makefile rename to src/systemcmds/perf/module.mk index f8bab41b65..77952842b3 100644 --- a/apps/systemcmds/perf/Makefile +++ b/src/systemcmds/perf/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,7 @@ # perf_counter reporting tool # -APPNAME = perf -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = perf +SRCS = perf.c MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/perf/perf.c b/src/systemcmds/perf/perf.c similarity index 97% rename from apps/systemcmds/perf/perf.c rename to src/systemcmds/perf/perf.c index 64443d019c..b69ea597b1 100644 --- a/apps/systemcmds/perf/perf.c +++ b/src/systemcmds/perf/perf.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/systemcmds/boardinfo/Makefile b/src/systemcmds/preflight_check/module.mk similarity index 86% rename from apps/systemcmds/boardinfo/Makefile rename to src/systemcmds/preflight_check/module.mk index 6f1be149c6..7c3c887836 100644 --- a/apps/systemcmds/boardinfo/Makefile +++ b/src/systemcmds/preflight_check/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,11 @@ ############################################################################ # -# Build the boardinfo tool. +# Pre-flight check. Locks down system for a few systems with blinking leds +# and buzzer if the sensors do not report an OK status. # -APPNAME = boardinfo -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = preflight_check +SRCS = preflight_check.c MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/preflight_check/preflight_check.c b/src/systemcmds/preflight_check/preflight_check.c similarity index 98% rename from apps/systemcmds/preflight_check/preflight_check.c rename to src/systemcmds/preflight_check/preflight_check.c index 9ac6f0b5e0..42256be61e 100644 --- a/apps/systemcmds/preflight_check/preflight_check.c +++ b/src/systemcmds/preflight_check/preflight_check.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: @author Lorenz Meier * * Redistribution and use in source and binary forms, with or without diff --git a/apps/systemcmds/pwm/Makefile b/src/systemcmds/pwm/module.mk similarity index 91% rename from apps/systemcmds/pwm/Makefile rename to src/systemcmds/pwm/module.mk index 5ab105ed12..4a23bba90e 100644 --- a/apps/systemcmds/pwm/Makefile +++ b/src/systemcmds/pwm/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Build the pwm tool. # -APPNAME = pwm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = pwm +SRCS = pwm.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 diff --git a/apps/systemcmds/pwm/pwm.c b/src/systemcmds/pwm/pwm.c similarity index 100% rename from apps/systemcmds/pwm/pwm.c rename to src/systemcmds/pwm/pwm.c diff --git a/src/systemcmds/reboot/module.mk b/src/systemcmds/reboot/module.mk new file mode 100644 index 0000000000..19f64af54f --- /dev/null +++ b/src/systemcmds/reboot/module.mk @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# reboot command. +# + +MODULE_COMMAND = reboot +SRCS = reboot.c + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/reboot/reboot.c b/src/systemcmds/reboot/reboot.c similarity index 100% rename from apps/systemcmds/reboot/reboot.c rename to src/systemcmds/reboot/reboot.c diff --git a/apps/systemcmds/reboot/Makefile b/src/systemcmds/top/module.mk similarity index 90% rename from apps/systemcmds/reboot/Makefile rename to src/systemcmds/top/module.mk index 15dd199829..9239aafc31 100644 --- a/apps/systemcmds/reboot/Makefile +++ b/src/systemcmds/top/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,13 @@ ############################################################################ # -# Reboot command. +# Build top memory / cpu status tool. # -APPNAME = reboot -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = top +SRCS = top.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 3000 MAXOPTIMIZATION = -Os + diff --git a/apps/systemcmds/top/top.c b/src/systemcmds/top/top.c similarity index 100% rename from apps/systemcmds/top/top.c rename to src/systemcmds/top/top.c From e6ed8268ee610d0b9e9b4930ad379a6d7dcc3629 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 12:59:47 +0200 Subject: [PATCH 053/129] Moved position_estimator_mc, px4io driver and sdlog app to new style build --- makefiles/config_px4fmu_default.mk | 15 ++++++++++----- src/drivers/l3gd20/l3gd20.cpp | 5 +++-- .../px4io/Makefile => src/drivers/px4io/module.mk | 9 ++++----- {apps => src}/drivers/px4io/px4io.cpp | 2 +- {apps => src}/drivers/px4io/uploader.cpp | 5 +++-- {apps => src}/drivers/px4io/uploader.h | 5 +++-- .../attitude_estimator_ekf_main.cpp | 1 - src/modules/attitude_estimator_ekf/module.mk | 8 ++++---- src/modules/commander/module.mk | 2 +- .../position_estimator_mc/codegen/kalman_dlqe1.c | 0 .../position_estimator_mc/codegen/kalman_dlqe1.h | 0 .../codegen/kalman_dlqe1_initialize.c | 0 .../codegen/kalman_dlqe1_initialize.h | 0 .../codegen/kalman_dlqe1_terminate.c | 0 .../codegen/kalman_dlqe1_terminate.h | 0 .../codegen/kalman_dlqe1_types.h | 0 .../position_estimator_mc/codegen/kalman_dlqe2.c | 0 .../position_estimator_mc/codegen/kalman_dlqe2.h | 0 .../codegen/kalman_dlqe2_initialize.c | 0 .../codegen/kalman_dlqe2_initialize.h | 0 .../codegen/kalman_dlqe2_terminate.c | 0 .../codegen/kalman_dlqe2_terminate.h | 0 .../codegen/kalman_dlqe2_types.h | 0 .../position_estimator_mc/codegen/kalman_dlqe3.c | 0 .../position_estimator_mc/codegen/kalman_dlqe3.h | 0 .../codegen/kalman_dlqe3_data.c | 0 .../codegen/kalman_dlqe3_data.h | 0 .../codegen/kalman_dlqe3_initialize.c | 0 .../codegen/kalman_dlqe3_initialize.h | 0 .../codegen/kalman_dlqe3_terminate.c | 0 .../codegen/kalman_dlqe3_terminate.h | 0 .../codegen/kalman_dlqe3_types.h | 0 .../codegen/positionKalmanFilter1D.c | 0 .../codegen/positionKalmanFilter1D.h | 0 .../codegen/positionKalmanFilter1D_dT.c | 0 .../codegen/positionKalmanFilter1D_dT.h | 0 .../positionKalmanFilter1D_dT_initialize.c | 0 .../positionKalmanFilter1D_dT_initialize.h | 0 .../codegen/positionKalmanFilter1D_dT_terminate.c | 0 .../codegen/positionKalmanFilter1D_dT_terminate.h | 0 .../codegen/positionKalmanFilter1D_dT_types.h | 0 .../codegen/positionKalmanFilter1D_initialize.c | 0 .../codegen/positionKalmanFilter1D_initialize.h | 0 .../codegen/positionKalmanFilter1D_terminate.c | 0 .../codegen/positionKalmanFilter1D_terminate.h | 0 .../codegen/positionKalmanFilter1D_types.h | 0 .../position_estimator_mc/codegen/randn.c | 0 .../position_estimator_mc/codegen/randn.h | 0 .../position_estimator_mc/codegen/rtGetInf.c | 0 .../position_estimator_mc/codegen/rtGetInf.h | 0 .../position_estimator_mc/codegen/rtGetNaN.c | 0 .../position_estimator_mc/codegen/rtGetNaN.h | 0 .../position_estimator_mc/codegen/rt_nonfinite.c | 0 .../position_estimator_mc/codegen/rt_nonfinite.h | 0 .../position_estimator_mc/codegen/rtwtypes.h | 0 .../modules}/position_estimator_mc/kalman_dlqe1.m | 0 .../modules}/position_estimator_mc/kalman_dlqe2.m | 0 .../modules}/position_estimator_mc/kalman_dlqe3.m | 0 .../modules/position_estimator_mc/module.mk | 10 +++------- .../positionKalmanFilter1D.m | 0 .../positionKalmanFilter1D_dT.m | 0 .../position_estimator_mc_main.c | 0 .../position_estimator_mc_params.c | 0 .../position_estimator_mc_params.h | 0 .../sdlog/Makefile => src/modules/sdlog/module.mk | 10 +++++----- {apps => src/modules}/sdlog/sdlog.c | 0 {apps => src/modules}/sdlog/sdlog_ringbuffer.c | 0 {apps => src/modules}/sdlog/sdlog_ringbuffer.h | 0 68 files changed, 37 insertions(+), 35 deletions(-) rename apps/drivers/px4io/Makefile => src/drivers/px4io/module.mk (91%) rename {apps => src}/drivers/px4io/px4io.cpp (99%) rename {apps => src}/drivers/px4io/uploader.cpp (99%) rename {apps => src}/drivers/px4io/uploader.h (95%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1_initialize.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1_initialize.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1_terminate.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1_terminate.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe1_types.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2_initialize.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2_initialize.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2_terminate.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2_terminate.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe2_types.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_data.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_data.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_initialize.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_initialize.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_terminate.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_terminate.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/kalman_dlqe3_types.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/positionKalmanFilter1D_types.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/randn.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/randn.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rtGetInf.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rtGetInf.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rtGetNaN.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rtGetNaN.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rt_nonfinite.c (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rt_nonfinite.h (100%) rename {apps => src/modules}/position_estimator_mc/codegen/rtwtypes.h (100%) rename {apps => src/modules}/position_estimator_mc/kalman_dlqe1.m (100%) rename {apps => src/modules}/position_estimator_mc/kalman_dlqe2.m (100%) rename {apps => src/modules}/position_estimator_mc/kalman_dlqe3.m (100%) rename apps/position_estimator_mc/Makefile => src/modules/position_estimator_mc/module.mk (91%) rename {apps => src/modules}/position_estimator_mc/positionKalmanFilter1D.m (100%) rename {apps => src/modules}/position_estimator_mc/positionKalmanFilter1D_dT.m (100%) rename {apps => src/modules}/position_estimator_mc/position_estimator_mc_main.c (100%) rename {apps => src/modules}/position_estimator_mc/position_estimator_mc_params.c (100%) rename {apps => src/modules}/position_estimator_mc/position_estimator_mc_params.h (100%) rename apps/sdlog/Makefile => src/modules/sdlog/module.mk (90%) rename {apps => src/modules}/sdlog/sdlog.c (100%) rename {apps => src/modules}/sdlog/sdlog_ringbuffer.c (100%) rename {apps => src/modules}/sdlog/sdlog_ringbuffer.h (100%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index b3ebe45532..80c34d5dd9 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -14,6 +14,9 @@ MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu MODULES += drivers/l3gd20 MODULES += drivers/ardrone_interface +MODULES += drivers/px4io +# sensors app is WIP +#MODULES += modules/sensors # # System commands @@ -41,7 +44,13 @@ MODULES += modules/mavlink_onboard # # Estimation modules (EKF / other filters) # -#MODULES += modules/attitude_estimator_ekf +MODULES += modules/attitude_estimator_ekf +MODULES += modules/position_estimator_mc + +# +# Logging +# +MODULES += modules/sdlog # # Transitional support - add commands from the NuttX export archive. @@ -73,10 +82,6 @@ BUILTIN_COMMANDS := \ $(call _B, ms5611, , 2048, ms5611_main ) \ $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ - $(call _B, position_estimator, , 4096, position_estimator_main ) \ - $(call _B, px4io, , 2048, px4io_main ) \ - $(call _B, sdlog, SCHED_PRIORITY_MAX-30, 2048, sdlog_main ) \ - $(call _B, sensors, SCHED_PRIORITY_MAX-5, 4096, sensors_main ) \ $(call _B, sercon, , 2048, sercon_main ) \ $(call _B, serdis, , 2048, serdis_main ) \ $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ diff --git a/src/drivers/l3gd20/l3gd20.cpp b/src/drivers/l3gd20/l3gd20.cpp index c7f433dd47..98098c83bf 100644 --- a/src/drivers/l3gd20/l3gd20.cpp +++ b/src/drivers/l3gd20/l3gd20.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Driver for the ST L3GD20 MEMS gyro connected via SPI. + * @file l3gd20.cpp + * Driver for the ST L3GD20 MEMS gyro connected via SPI. */ #include diff --git a/apps/drivers/px4io/Makefile b/src/drivers/px4io/module.mk similarity index 91% rename from apps/drivers/px4io/Makefile rename to src/drivers/px4io/module.mk index cbd9425463..328e5a6843 100644 --- a/apps/drivers/px4io/Makefile +++ b/src/drivers/px4io/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Interface driver for the PX4IO board. # -APPNAME = px4io -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = px4io -include $(APPDIR)/mk/app.mk +SRCS = px4io.cpp \ + uploader.cpp diff --git a/apps/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp similarity index 99% rename from apps/drivers/px4io/px4io.cpp rename to src/drivers/px4io/px4io.cpp index 4f6938a144..b21f83e442 100644 --- a/apps/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012,2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/px4io/uploader.cpp b/src/drivers/px4io/uploader.cpp similarity index 99% rename from apps/drivers/px4io/uploader.cpp rename to src/drivers/px4io/uploader.cpp index abf59216a6..9a67875e86 100644 --- a/apps/drivers/px4io/uploader.cpp +++ b/src/drivers/px4io/uploader.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Firmware uploader for PX4IO + * @file uploader.cpp + * Firmware uploader for PX4IO */ #include diff --git a/apps/drivers/px4io/uploader.h b/src/drivers/px4io/uploader.h similarity index 95% rename from apps/drivers/px4io/uploader.h rename to src/drivers/px4io/uploader.h index f983d19811..135202dd1b 100644 --- a/apps/drivers/px4io/uploader.h +++ b/src/drivers/px4io/uploader.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Firmware uploader for PX4IO + * @file uploader.h + * Firmware uploader definitions for PX4IO. */ #ifndef _PX4IO_UPLOADER_H diff --git a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp index 1a50dde0f4..8e18c3c9a7 100755 --- a/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/src/modules/attitude_estimator_ekf/module.mk b/src/modules/attitude_estimator_ekf/module.mk index bfb7db9977..d98647f999 100644 --- a/src/modules/attitude_estimator_ekf/module.mk +++ b/src/modules/attitude_estimator_ekf/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,10 @@ # Attitude estimator (Extended Kalman Filter) # -MODULE_NAME = attitude_estimator_ekf -CXXSRCS = attitude_estimator_ekf_main.cpp +MODULE_COMMAND = attitude_estimator_ekf -SRCS = attitude_estimator_ekf_params.c \ +SRCS = attitude_estimator_ekf_main.cpp \ + attitude_estimator_ekf_params.c \ codegen/eye.c \ codegen/attitudeKalmanfilter.c \ codegen/mrdivide.c \ diff --git a/src/modules/commander/module.mk b/src/modules/commander/module.mk index b90da8289f..556d5c2df6 100644 --- a/src/modules/commander/module.mk +++ b/src/modules/commander/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_types.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe1_types.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe1_types.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_types.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe2_types.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe2_types.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_data.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_data.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.c similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.c rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_types.h similarity index 100% rename from apps/position_estimator_mc/codegen/kalman_dlqe3_types.h rename to src/modules/position_estimator_mc/codegen/kalman_dlqe3_types.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_types.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_types.h similarity index 100% rename from apps/position_estimator_mc/codegen/positionKalmanFilter1D_types.h rename to src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_types.h diff --git a/apps/position_estimator_mc/codegen/randn.c b/src/modules/position_estimator_mc/codegen/randn.c similarity index 100% rename from apps/position_estimator_mc/codegen/randn.c rename to src/modules/position_estimator_mc/codegen/randn.c diff --git a/apps/position_estimator_mc/codegen/randn.h b/src/modules/position_estimator_mc/codegen/randn.h similarity index 100% rename from apps/position_estimator_mc/codegen/randn.h rename to src/modules/position_estimator_mc/codegen/randn.h diff --git a/apps/position_estimator_mc/codegen/rtGetInf.c b/src/modules/position_estimator_mc/codegen/rtGetInf.c similarity index 100% rename from apps/position_estimator_mc/codegen/rtGetInf.c rename to src/modules/position_estimator_mc/codegen/rtGetInf.c diff --git a/apps/position_estimator_mc/codegen/rtGetInf.h b/src/modules/position_estimator_mc/codegen/rtGetInf.h similarity index 100% rename from apps/position_estimator_mc/codegen/rtGetInf.h rename to src/modules/position_estimator_mc/codegen/rtGetInf.h diff --git a/apps/position_estimator_mc/codegen/rtGetNaN.c b/src/modules/position_estimator_mc/codegen/rtGetNaN.c similarity index 100% rename from apps/position_estimator_mc/codegen/rtGetNaN.c rename to src/modules/position_estimator_mc/codegen/rtGetNaN.c diff --git a/apps/position_estimator_mc/codegen/rtGetNaN.h b/src/modules/position_estimator_mc/codegen/rtGetNaN.h similarity index 100% rename from apps/position_estimator_mc/codegen/rtGetNaN.h rename to src/modules/position_estimator_mc/codegen/rtGetNaN.h diff --git a/apps/position_estimator_mc/codegen/rt_nonfinite.c b/src/modules/position_estimator_mc/codegen/rt_nonfinite.c similarity index 100% rename from apps/position_estimator_mc/codegen/rt_nonfinite.c rename to src/modules/position_estimator_mc/codegen/rt_nonfinite.c diff --git a/apps/position_estimator_mc/codegen/rt_nonfinite.h b/src/modules/position_estimator_mc/codegen/rt_nonfinite.h similarity index 100% rename from apps/position_estimator_mc/codegen/rt_nonfinite.h rename to src/modules/position_estimator_mc/codegen/rt_nonfinite.h diff --git a/apps/position_estimator_mc/codegen/rtwtypes.h b/src/modules/position_estimator_mc/codegen/rtwtypes.h similarity index 100% rename from apps/position_estimator_mc/codegen/rtwtypes.h rename to src/modules/position_estimator_mc/codegen/rtwtypes.h diff --git a/apps/position_estimator_mc/kalman_dlqe1.m b/src/modules/position_estimator_mc/kalman_dlqe1.m similarity index 100% rename from apps/position_estimator_mc/kalman_dlqe1.m rename to src/modules/position_estimator_mc/kalman_dlqe1.m diff --git a/apps/position_estimator_mc/kalman_dlqe2.m b/src/modules/position_estimator_mc/kalman_dlqe2.m similarity index 100% rename from apps/position_estimator_mc/kalman_dlqe2.m rename to src/modules/position_estimator_mc/kalman_dlqe2.m diff --git a/apps/position_estimator_mc/kalman_dlqe3.m b/src/modules/position_estimator_mc/kalman_dlqe3.m similarity index 100% rename from apps/position_estimator_mc/kalman_dlqe3.m rename to src/modules/position_estimator_mc/kalman_dlqe3.m diff --git a/apps/position_estimator_mc/Makefile b/src/modules/position_estimator_mc/module.mk similarity index 91% rename from apps/position_estimator_mc/Makefile rename to src/modules/position_estimator_mc/module.mk index 8f11001580..40b135ea4f 100644 --- a/apps/position_estimator_mc/Makefile +++ b/src/modules/position_estimator_mc/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,11 +35,9 @@ # Makefile to build the position estimator # -APPNAME = position_estimator_mc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = position_estimator_mc -CSRCS = position_estimator_mc_main.c \ +SRCS = position_estimator_mc_main.c \ position_estimator_mc_params.c \ codegen/positionKalmanFilter1D_initialize.c \ codegen/positionKalmanFilter1D_terminate.c \ @@ -60,5 +58,3 @@ CSRCS = position_estimator_mc_main.c \ codegen/kalman_dlqe3_terminate.c \ codegen/kalman_dlqe3_data.c \ codegen/randn.c - -include $(APPDIR)/mk/app.mk diff --git a/apps/position_estimator_mc/positionKalmanFilter1D.m b/src/modules/position_estimator_mc/positionKalmanFilter1D.m similarity index 100% rename from apps/position_estimator_mc/positionKalmanFilter1D.m rename to src/modules/position_estimator_mc/positionKalmanFilter1D.m diff --git a/apps/position_estimator_mc/positionKalmanFilter1D_dT.m b/src/modules/position_estimator_mc/positionKalmanFilter1D_dT.m similarity index 100% rename from apps/position_estimator_mc/positionKalmanFilter1D_dT.m rename to src/modules/position_estimator_mc/positionKalmanFilter1D_dT.m diff --git a/apps/position_estimator_mc/position_estimator_mc_main.c b/src/modules/position_estimator_mc/position_estimator_mc_main.c similarity index 100% rename from apps/position_estimator_mc/position_estimator_mc_main.c rename to src/modules/position_estimator_mc/position_estimator_mc_main.c diff --git a/apps/position_estimator_mc/position_estimator_mc_params.c b/src/modules/position_estimator_mc/position_estimator_mc_params.c similarity index 100% rename from apps/position_estimator_mc/position_estimator_mc_params.c rename to src/modules/position_estimator_mc/position_estimator_mc_params.c diff --git a/apps/position_estimator_mc/position_estimator_mc_params.h b/src/modules/position_estimator_mc/position_estimator_mc_params.h similarity index 100% rename from apps/position_estimator_mc/position_estimator_mc_params.h rename to src/modules/position_estimator_mc/position_estimator_mc_params.h diff --git a/apps/sdlog/Makefile b/src/modules/sdlog/module.mk similarity index 90% rename from apps/sdlog/Makefile rename to src/modules/sdlog/module.mk index 225b14a322..89da2d8273 100644 --- a/apps/sdlog/Makefile +++ b/src/modules/sdlog/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,9 +35,9 @@ # sdlog Application # -APPNAME = sdlog +MODULE_COMMAND = sdlog # The main thread only buffers to RAM, needs a high priority -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-30" -include $(APPDIR)/mk/app.mk +SRCS = sdlog.c \ + sdlog_ringbuffer.c diff --git a/apps/sdlog/sdlog.c b/src/modules/sdlog/sdlog.c similarity index 100% rename from apps/sdlog/sdlog.c rename to src/modules/sdlog/sdlog.c diff --git a/apps/sdlog/sdlog_ringbuffer.c b/src/modules/sdlog/sdlog_ringbuffer.c similarity index 100% rename from apps/sdlog/sdlog_ringbuffer.c rename to src/modules/sdlog/sdlog_ringbuffer.c diff --git a/apps/sdlog/sdlog_ringbuffer.h b/src/modules/sdlog/sdlog_ringbuffer.h similarity index 100% rename from apps/sdlog/sdlog_ringbuffer.h rename to src/modules/sdlog/sdlog_ringbuffer.h From c89f46f59055f4cc0d7ada4a26e48f021278538e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 13:16:24 +0200 Subject: [PATCH 054/129] Moved sensors app to new world --- makefiles/config_px4fmu_default.mk | 3 +-- {apps => src/modules}/sensors/.context | 0 .../Makefile => src/modules/sensors/module.mk | 13 +++++-------- {apps => src/modules}/sensors/sensor_params.c | 0 {apps => src/modules}/sensors/sensors.cpp | 0 5 files changed, 6 insertions(+), 10 deletions(-) rename {apps => src/modules}/sensors/.context (100%) rename apps/sensors/Makefile => src/modules/sensors/module.mk (88%) rename {apps => src/modules}/sensors/sensor_params.c (100%) rename {apps => src/modules}/sensors/sensors.cpp (100%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 80c34d5dd9..aae7e9b0e1 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -15,8 +15,7 @@ MODULES += drivers/boards/px4fmu MODULES += drivers/l3gd20 MODULES += drivers/ardrone_interface MODULES += drivers/px4io -# sensors app is WIP -#MODULES += modules/sensors +MODULES += modules/sensors # # System commands diff --git a/apps/sensors/.context b/src/modules/sensors/.context similarity index 100% rename from apps/sensors/.context rename to src/modules/sensors/.context diff --git a/apps/sensors/Makefile b/src/modules/sensors/module.mk similarity index 88% rename from apps/sensors/Makefile rename to src/modules/sensors/module.mk index 526fb0164f..ebbc580e10 100644 --- a/apps/sensors/Makefile +++ b/src/modules/sensors/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,11 +35,8 @@ # Makefile to build the sensor data collector # -APPNAME = sensors -PRIORITY = SCHED_PRIORITY_MAX-5 -STACKSIZE = 4096 +MODULE_COMMAND = sensors +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-5" -CXXSRCS = sensors.cpp -CSRCS = sensor_params.c - -include $(APPDIR)/mk/app.mk +SRCS = sensors.cpp \ + sensor_params.c diff --git a/apps/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c similarity index 100% rename from apps/sensors/sensor_params.c rename to src/modules/sensors/sensor_params.c diff --git a/apps/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp similarity index 100% rename from apps/sensors/sensors.cpp rename to src/modules/sensors/sensors.cpp From 1becedfe011d02120fe68b549f8c3a02e0a979c7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 13:41:40 +0200 Subject: [PATCH 055/129] Minor config file rearrangement --- makefiles/config_px4fmu_default.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index aae7e9b0e1..57d9492583 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -10,11 +10,11 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common # # Board support modules # +MODULES += drivers/px4io MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu -MODULES += drivers/l3gd20 MODULES += drivers/ardrone_interface -MODULES += drivers/px4io +MODULES += drivers/l3gd20 MODULES += modules/sensors # From 5974c37abba562c1372beb04490014db274fd175 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 14:06:23 +0200 Subject: [PATCH 056/129] Moved the bulk of sensor drivers to the new world --- apps/drivers/mpu6000/Makefile | 42 ----------------- apps/hott_telemetry/Makefile | 45 ------------------- makefiles/config_px4fmu_default.mk | 17 +++---- {apps => src}/drivers/blinkm/blinkm.cpp | 0 .../Makefile => src/drivers/blinkm/module.mk | 8 ++-- {apps => src}/drivers/bma180/bma180.cpp | 0 .../Makefile => src/drivers/bma180/module.mk | 8 ++-- {apps => src}/drivers/gps/gps.cpp | 0 {apps => src}/drivers/gps/gps_helper.cpp | 0 {apps => src}/drivers/gps/gps_helper.h | 0 .../gps/Makefile => src/drivers/gps/module.mk | 11 ++--- {apps => src}/drivers/gps/mtk.cpp | 0 {apps => src}/drivers/gps/mtk.h | 0 {apps => src}/drivers/gps/ubx.cpp | 0 {apps => src}/drivers/gps/ubx.h | 0 {apps => src}/drivers/hil/hil.cpp | 0 .../Makefile => src/drivers/hil/module.mk | 10 ++--- {apps => src}/drivers/hmc5883/hmc5883.cpp | 0 .../Makefile => src/drivers/hmc5883/module.mk | 13 +++--- .../hott_telemetry/hott_telemetry_main.c | 12 ++--- .../drivers}/hott_telemetry/messages.c | 6 +-- .../drivers}/hott_telemetry/messages.h | 5 ++- src/drivers/hott_telemetry/module.mk | 41 +++++++++++++++++ {apps => src}/drivers/mb12xx/mb12xx.cpp | 2 +- .../Makefile => src/drivers/mb12xx/module.mk | 8 ++-- src/drivers/mpu6000/module.mk | 43 ++++++++++++++++++ {apps => src}/drivers/mpu6000/mpu6000.cpp | 2 +- .../Makefile => src/drivers/ms5611/module.mk | 8 ++-- {apps => src}/drivers/ms5611/ms5611.cpp | 0 29 files changed, 133 insertions(+), 148 deletions(-) delete mode 100644 apps/drivers/mpu6000/Makefile delete mode 100644 apps/hott_telemetry/Makefile rename {apps => src}/drivers/blinkm/blinkm.cpp (100%) rename apps/drivers/blinkm/Makefile => src/drivers/blinkm/module.mk (90%) rename {apps => src}/drivers/bma180/bma180.cpp (100%) rename apps/drivers/bma180/Makefile => src/drivers/bma180/module.mk (91%) rename {apps => src}/drivers/gps/gps.cpp (100%) rename {apps => src}/drivers/gps/gps_helper.cpp (100%) rename {apps => src}/drivers/gps/gps_helper.h (100%) rename apps/drivers/gps/Makefile => src/drivers/gps/module.mk (91%) rename {apps => src}/drivers/gps/mtk.cpp (100%) rename {apps => src}/drivers/gps/mtk.h (100%) rename {apps => src}/drivers/gps/ubx.cpp (100%) rename {apps => src}/drivers/gps/ubx.h (100%) rename {apps => src}/drivers/hil/hil.cpp (100%) rename apps/drivers/hmc5883/Makefile => src/drivers/hil/module.mk (89%) rename {apps => src}/drivers/hmc5883/hmc5883.cpp (100%) rename apps/drivers/hil/Makefile => src/drivers/hmc5883/module.mk (88%) rename {apps => src/drivers}/hott_telemetry/hott_telemetry_main.c (96%) rename {apps => src/drivers}/hott_telemetry/messages.c (94%) rename {apps => src/drivers}/hott_telemetry/messages.h (96%) create mode 100644 src/drivers/hott_telemetry/module.mk rename {apps => src}/drivers/mb12xx/mb12xx.cpp (99%) rename apps/drivers/mb12xx/Makefile => src/drivers/mb12xx/module.mk (91%) create mode 100644 src/drivers/mpu6000/module.mk rename {apps => src}/drivers/mpu6000/mpu6000.cpp (99%) rename apps/drivers/ms5611/Makefile => src/drivers/ms5611/module.mk (90%) rename {apps => src}/drivers/ms5611/ms5611.cpp (100%) diff --git a/apps/drivers/mpu6000/Makefile b/apps/drivers/mpu6000/Makefile deleted file mode 100644 index 32df1bdae7..0000000000 --- a/apps/drivers/mpu6000/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the BMA180 driver. -# - -APPNAME = mpu6000 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk diff --git a/apps/hott_telemetry/Makefile b/apps/hott_telemetry/Makefile deleted file mode 100644 index 8d5faa3b7f..0000000000 --- a/apps/hott_telemetry/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Graupner HoTT Telemetry application. -# - -# The following line is required for accessing UARTs directly. -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common - -APPNAME = hott_telemetry -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 57d9492583..00aec3f8ae 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -15,6 +15,15 @@ MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu MODULES += drivers/ardrone_interface MODULES += drivers/l3gd20 +MODULES += drivers/bma180 +MODULES += drivers/mpu6000 +MODULES += drivers/hmc5883 +MODULES += drivers/ms5611 +MODULES += drivers/mb12xx +MODULES += drivers/gps +MODULES += drivers/hil +MODULES += drivers/hott_telemetry +MODULES += drivers/blinkm MODULES += modules/sensors # @@ -66,19 +75,11 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ $(call _B, adc, , 2048, adc_main ) \ - $(call _B, blinkm, , 2048, blinkm_main ) \ - $(call _B, bma180, , 2048, bma180_main ) \ $(call _B, control_demo, , 2048, control_demo_main ) \ $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ - $(call _B, gps, , 2048, gps_main ) \ - $(call _B, hil, , 2048, hil_main ) \ - $(call _B, hmc5883, , 4096, hmc5883_main ) \ - $(call _B, hott_telemetry, , 2048, hott_telemetry_main ) \ $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ - $(call _B, mpu6000, , 4096, mpu6000_main ) \ - $(call _B, ms5611, , 2048, ms5611_main ) \ $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ $(call _B, sercon, , 2048, sercon_main ) \ diff --git a/apps/drivers/blinkm/blinkm.cpp b/src/drivers/blinkm/blinkm.cpp similarity index 100% rename from apps/drivers/blinkm/blinkm.cpp rename to src/drivers/blinkm/blinkm.cpp diff --git a/apps/drivers/blinkm/Makefile b/src/drivers/blinkm/module.mk similarity index 90% rename from apps/drivers/blinkm/Makefile rename to src/drivers/blinkm/module.mk index 5a623693df..b48b90f3f4 100644 --- a/apps/drivers/blinkm/Makefile +++ b/src/drivers/blinkm/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # BlinkM I2C LED driver # -APPNAME = blinkm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = blinkm -include $(APPDIR)/mk/app.mk +SRCS = blinkm.cpp diff --git a/apps/drivers/bma180/bma180.cpp b/src/drivers/bma180/bma180.cpp similarity index 100% rename from apps/drivers/bma180/bma180.cpp rename to src/drivers/bma180/bma180.cpp diff --git a/apps/drivers/bma180/Makefile b/src/drivers/bma180/module.mk similarity index 91% rename from apps/drivers/bma180/Makefile rename to src/drivers/bma180/module.mk index cc01b629e6..4c60ee082c 100644 --- a/apps/drivers/bma180/Makefile +++ b/src/drivers/bma180/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Makefile to build the BMA180 driver. # -APPNAME = bma180 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = bma180 -include $(APPDIR)/mk/app.mk +SRCS = bma180.cpp diff --git a/apps/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp similarity index 100% rename from apps/drivers/gps/gps.cpp rename to src/drivers/gps/gps.cpp diff --git a/apps/drivers/gps/gps_helper.cpp b/src/drivers/gps/gps_helper.cpp similarity index 100% rename from apps/drivers/gps/gps_helper.cpp rename to src/drivers/gps/gps_helper.cpp diff --git a/apps/drivers/gps/gps_helper.h b/src/drivers/gps/gps_helper.h similarity index 100% rename from apps/drivers/gps/gps_helper.h rename to src/drivers/gps/gps_helper.h diff --git a/apps/drivers/gps/Makefile b/src/drivers/gps/module.mk similarity index 91% rename from apps/drivers/gps/Makefile rename to src/drivers/gps/module.mk index 3859a88a5a..097db2abfc 100644 --- a/apps/drivers/gps/Makefile +++ b/src/drivers/gps/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,9 @@ # GPS driver # -APPNAME = gps -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = gps -include $(APPDIR)/mk/app.mk +SRCS = gps.cpp \ + gps_helper.cpp \ + mtk.cpp \ + ubx.cpp diff --git a/apps/drivers/gps/mtk.cpp b/src/drivers/gps/mtk.cpp similarity index 100% rename from apps/drivers/gps/mtk.cpp rename to src/drivers/gps/mtk.cpp diff --git a/apps/drivers/gps/mtk.h b/src/drivers/gps/mtk.h similarity index 100% rename from apps/drivers/gps/mtk.h rename to src/drivers/gps/mtk.h diff --git a/apps/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp similarity index 100% rename from apps/drivers/gps/ubx.cpp rename to src/drivers/gps/ubx.cpp diff --git a/apps/drivers/gps/ubx.h b/src/drivers/gps/ubx.h similarity index 100% rename from apps/drivers/gps/ubx.h rename to src/drivers/gps/ubx.h diff --git a/apps/drivers/hil/hil.cpp b/src/drivers/hil/hil.cpp similarity index 100% rename from apps/drivers/hil/hil.cpp rename to src/drivers/hil/hil.cpp diff --git a/apps/drivers/hmc5883/Makefile b/src/drivers/hil/module.mk similarity index 89% rename from apps/drivers/hmc5883/Makefile rename to src/drivers/hil/module.mk index 4d7cb4e7b9..f8895f5d5a 100644 --- a/apps/drivers/hmc5883/Makefile +++ b/src/drivers/hil/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,9 @@ ############################################################################ # -# HMC5883 driver +# Hardware in the Loop (HIL) simulation actuator output bank # -APPNAME = hmc5883 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = hil -include $(APPDIR)/mk/app.mk +SRCS = hil.cpp diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp similarity index 100% rename from apps/drivers/hmc5883/hmc5883.cpp rename to src/drivers/hmc5883/hmc5883.cpp diff --git a/apps/drivers/hil/Makefile b/src/drivers/hmc5883/module.mk similarity index 88% rename from apps/drivers/hil/Makefile rename to src/drivers/hmc5883/module.mk index 1fb6e37bce..07377556d3 100644 --- a/apps/drivers/hil/Makefile +++ b/src/drivers/hmc5883/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,12 @@ ############################################################################ # -# Interface driver for the PX4FMU board +# HMC5883 driver # -APPNAME = hil -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = hmc5883 -include $(APPDIR)/mk/app.mk +# XXX seems excessive, check if 2048 is sufficient +MODULE_STACKSIZE = 4096 + +SRCS = hmc5883.cpp diff --git a/apps/hott_telemetry/hott_telemetry_main.c b/src/drivers/hott_telemetry/hott_telemetry_main.c similarity index 96% rename from apps/hott_telemetry/hott_telemetry_main.c rename to src/drivers/hott_telemetry/hott_telemetry_main.c index 31c9247aa5..a13a6ef589 100644 --- a/apps/hott_telemetry/hott_telemetry_main.c +++ b/src/drivers/hott_telemetry/hott_telemetry_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ /** * @file hott_telemetry_main.c + * @author Simon Wilks * * Graupner HoTT Telemetry implementation. * @@ -41,7 +42,6 @@ * a data packet can be returned if necessary. * * TODO: Add support for at least the vario and GPS sensor data. - * */ #include @@ -57,12 +57,6 @@ #include "messages.h" -/* The following are equired for UART direct manipulation. */ -#include -#include "up_arch.h" -#include "chip.h" -#include "stm32_internal.h" - static int thread_should_exit = false; /**< Deamon exit flag */ static int thread_running = false; /**< Deamon status flag */ static int deamon_task; /**< Handle of deamon task / thread */ diff --git a/apps/hott_telemetry/messages.c b/src/drivers/hott_telemetry/messages.c similarity index 94% rename from apps/hott_telemetry/messages.c rename to src/drivers/hott_telemetry/messages.c index 8bfb997737..5fbee16ce9 100644 --- a/apps/hott_telemetry/messages.c +++ b/src/drivers/hott_telemetry/messages.c @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ /** * @file messages.c - * + * @author Simon Wilks */ #include "messages.h" diff --git a/apps/hott_telemetry/messages.h b/src/drivers/hott_telemetry/messages.h similarity index 96% rename from apps/hott_telemetry/messages.h rename to src/drivers/hott_telemetry/messages.h index 44001e04f0..dd38075fa8 100644 --- a/apps/hott_telemetry/messages.h +++ b/src/drivers/hott_telemetry/messages.h @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ /** * @file messages.h + * @author Simon Wilks * * Graupner HoTT Telemetry message generation. * diff --git a/src/drivers/hott_telemetry/module.mk b/src/drivers/hott_telemetry/module.mk new file mode 100644 index 0000000000..def1d59e9b --- /dev/null +++ b/src/drivers/hott_telemetry/module.mk @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# Graupner HoTT Telemetry application. +# + +MODULE_COMMAND = hott_telemetry + +SRCS = hott_telemetry_main.c \ + messages.c diff --git a/apps/drivers/mb12xx/mb12xx.cpp b/src/drivers/mb12xx/mb12xx.cpp similarity index 99% rename from apps/drivers/mb12xx/mb12xx.cpp rename to src/drivers/mb12xx/mb12xx.cpp index 9d0f6bddcf..397686e8bf 100644 --- a/apps/drivers/mb12xx/mb12xx.cpp +++ b/src/drivers/mb12xx/mb12xx.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/mb12xx/Makefile b/src/drivers/mb12xx/module.mk similarity index 91% rename from apps/drivers/mb12xx/Makefile rename to src/drivers/mb12xx/module.mk index 0d24057877..4e00ada025 100644 --- a/apps/drivers/mb12xx/Makefile +++ b/src/drivers/mb12xx/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2013 PX4 Development Team. All rights reserved. +# Copyright (c) 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Makefile to build the Maxbotix Sonar driver. # -APPNAME = mb12xx -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mb12xx -include $(APPDIR)/mk/app.mk +SRCS = mb12xx.cpp diff --git a/src/drivers/mpu6000/module.mk b/src/drivers/mpu6000/module.mk new file mode 100644 index 0000000000..c7d9cd3ef1 --- /dev/null +++ b/src/drivers/mpu6000/module.mk @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# Makefile to build the MPU6000 driver. +# + +MODULE_COMMAND = mpu6000 + +# XXX seems excessive, check if 2048 is not sufficient +MODULE_STACKSIZE = 4096 + +SRCS = mpu6000.cpp diff --git a/apps/drivers/mpu6000/mpu6000.cpp b/src/drivers/mpu6000/mpu6000.cpp similarity index 99% rename from apps/drivers/mpu6000/mpu6000.cpp rename to src/drivers/mpu6000/mpu6000.cpp index ce7062046f..df1958186f 100644 --- a/apps/drivers/mpu6000/mpu6000.cpp +++ b/src/drivers/mpu6000/mpu6000.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/ms5611/Makefile b/src/drivers/ms5611/module.mk similarity index 90% rename from apps/drivers/ms5611/Makefile rename to src/drivers/ms5611/module.mk index d8e67cba25..3c4b0f0938 100644 --- a/apps/drivers/ms5611/Makefile +++ b/src/drivers/ms5611/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # MS5611 driver # -APPNAME = ms5611 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = ms5611 -include $(APPDIR)/mk/app.mk +SRCS = ms5611.cpp diff --git a/apps/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp similarity index 100% rename from apps/drivers/ms5611/ms5611.cpp rename to src/drivers/ms5611/ms5611.cpp From 76a30108d2eab6a65f5fc92e2f9550d25ad5656c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 14:16:34 +0200 Subject: [PATCH 057/129] Moved James Gopperts EKF to the new world --- makefiles/config_px4fmu_default.mk | 2 +- .../modules/att_pos_estimator_ekf}/KalmanNav.cpp | 0 .../modules/att_pos_estimator_ekf}/KalmanNav.hpp | 0 .../modules/att_pos_estimator_ekf/kalman_main.cpp | 4 ++-- .../modules/att_pos_estimator_ekf/module.mk | 11 +++++++---- .../modules/att_pos_estimator_ekf}/params.c | 0 6 files changed, 10 insertions(+), 7 deletions(-) rename {apps/examples/kalman_demo => src/modules/att_pos_estimator_ekf}/KalmanNav.cpp (100%) rename {apps/examples/kalman_demo => src/modules/att_pos_estimator_ekf}/KalmanNav.hpp (100%) rename apps/examples/kalman_demo/kalman_demo.cpp => src/modules/att_pos_estimator_ekf/kalman_main.cpp (96%) rename apps/examples/kalman_demo/Makefile => src/modules/att_pos_estimator_ekf/module.mk (89%) rename {apps/examples/kalman_demo => src/modules/att_pos_estimator_ekf}/params.c (100%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 00aec3f8ae..0767f71447 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -54,6 +54,7 @@ MODULES += modules/mavlink_onboard # MODULES += modules/attitude_estimator_ekf MODULES += modules/position_estimator_mc +MODULES += modules/att_pos_estimator_ekf # # Logging @@ -78,7 +79,6 @@ BUILTIN_COMMANDS := \ $(call _B, control_demo, , 2048, control_demo_main ) \ $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ - $(call _B, kalman_demo, SCHED_PRIORITY_MAX-30, 2048, kalman_demo_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ diff --git a/apps/examples/kalman_demo/KalmanNav.cpp b/src/modules/att_pos_estimator_ekf/KalmanNav.cpp similarity index 100% rename from apps/examples/kalman_demo/KalmanNav.cpp rename to src/modules/att_pos_estimator_ekf/KalmanNav.cpp diff --git a/apps/examples/kalman_demo/KalmanNav.hpp b/src/modules/att_pos_estimator_ekf/KalmanNav.hpp similarity index 100% rename from apps/examples/kalman_demo/KalmanNav.hpp rename to src/modules/att_pos_estimator_ekf/KalmanNav.hpp diff --git a/apps/examples/kalman_demo/kalman_demo.cpp b/src/modules/att_pos_estimator_ekf/kalman_main.cpp similarity index 96% rename from apps/examples/kalman_demo/kalman_demo.cpp rename to src/modules/att_pos_estimator_ekf/kalman_main.cpp index 581b68b016..aebe3d1feb 100644 --- a/apps/examples/kalman_demo/kalman_demo.cpp +++ b/src/modules/att_pos_estimator_ekf/kalman_main.cpp @@ -55,7 +55,7 @@ static int deamon_task; /**< Handle of deamon task / thread */ /** * Deamon management function. */ -extern "C" __EXPORT int kalman_demo_main(int argc, char *argv[]); +extern "C" __EXPORT int att_pos_estimator_ekf_main(int argc, char *argv[]); /** * Mainloop of deamon. @@ -85,7 +85,7 @@ usage(const char *reason) * The actual stack size should be set in the call * to task_create(). */ -int kalman_demo_main(int argc, char *argv[]) +int att_pos_estimator_ekf_main(int argc, char *argv[]) { if (argc < 1) diff --git a/apps/examples/kalman_demo/Makefile b/src/modules/att_pos_estimator_ekf/module.mk similarity index 89% rename from apps/examples/kalman_demo/Makefile rename to src/modules/att_pos_estimator_ekf/module.mk index 99c34d934e..abc6640182 100644 --- a/apps/examples/kalman_demo/Makefile +++ b/src/modules/att_pos_estimator_ekf/module.mk @@ -35,8 +35,11 @@ # Basic example application # -APPNAME = kalman_demo -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 +MODULE_COMMAND = att_pos_estimator_ekf -include $(APPDIR)/mk/app.mk +# XXX this might be intended for the spawned deamon, validate +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-30" + +SRCS = kalman_main.cpp \ + KalmanNav.cpp \ + params.c diff --git a/apps/examples/kalman_demo/params.c b/src/modules/att_pos_estimator_ekf/params.c similarity index 100% rename from apps/examples/kalman_demo/params.c rename to src/modules/att_pos_estimator_ekf/params.c From 988bf1eb0a3d36532883734a416f9c9e1e6ba125 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 14:28:47 +0200 Subject: [PATCH 058/129] Moved all fixed wing controllers to new world --- makefiles/config_px4fmu_default.mk | 7 +++++++ .../fixedwing_att_control_att.c | 3 +-- .../fixedwing_att_control_att.h | 0 .../fixedwing_att_control_main.c | 5 +++-- .../fixedwing_att_control_rate.c | 6 ++++-- .../fixedwing_att_control_rate.h | 0 .../modules/fixedwing_att_control/module.mk | 15 ++++++--------- .../fixedwing_backside_main.cpp | 14 ++++++++------ .../modules/fixedwing_backside/module.mk | 10 ++++------ .../modules/fixedwing_backside}/params.c | 0 .../fixedwing_pos_control_main.c | 0 .../modules/fixedwing_pos_control/module.mk | 13 ++++--------- 12 files changed, 37 insertions(+), 36 deletions(-) rename {apps => src/modules}/fixedwing_att_control/fixedwing_att_control_att.c (99%) rename {apps => src/modules}/fixedwing_att_control/fixedwing_att_control_att.h (100%) rename {apps => src/modules}/fixedwing_att_control/fixedwing_att_control_main.c (99%) rename {apps => src/modules}/fixedwing_att_control/fixedwing_att_control_rate.c (99%) rename {apps => src/modules}/fixedwing_att_control/fixedwing_att_control_rate.h (100%) rename apps/fixedwing_att_control/Makefile => src/modules/fixedwing_att_control/module.mk (86%) rename apps/examples/control_demo/control_demo.cpp => src/modules/fixedwing_backside/fixedwing_backside_main.cpp (92%) rename apps/examples/control_demo/Makefile => src/modules/fixedwing_backside/module.mk (89%) rename {apps/examples/control_demo => src/modules/fixedwing_backside}/params.c (100%) rename {apps => src/modules}/fixedwing_pos_control/fixedwing_pos_control_main.c (100%) rename apps/fixedwing_pos_control/Makefile => src/modules/fixedwing_pos_control/module.mk (86%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 0767f71447..6fd7da4614 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -56,6 +56,13 @@ MODULES += modules/attitude_estimator_ekf MODULES += modules/position_estimator_mc MODULES += modules/att_pos_estimator_ekf +# +# Vehicle Control +# +MODULES += modules/fixedwing_backside +MODULES += modules/fixedwing_att_control +MODULES += modules/fixedwing_pos_control + # # Logging # diff --git a/apps/fixedwing_att_control/fixedwing_att_control_att.c b/src/modules/fixedwing_att_control/fixedwing_att_control_att.c similarity index 99% rename from apps/fixedwing_att_control/fixedwing_att_control_att.c rename to src/modules/fixedwing_att_control/fixedwing_att_control_att.c index b012448a23..769b8b0a8d 100644 --- a/apps/fixedwing_att_control/fixedwing_att_control_att.c +++ b/src/modules/fixedwing_att_control/fixedwing_att_control_att.c @@ -35,7 +35,6 @@ * @file fixedwing_att_control_rate.c * Implementation of a fixed wing attitude controller. */ -#include #include #include @@ -59,7 +58,7 @@ #include #include - +#include "fixedwing_att_control_att.h" struct fw_att_control_params { diff --git a/apps/fixedwing_att_control/fixedwing_att_control_att.h b/src/modules/fixedwing_att_control/fixedwing_att_control_att.h similarity index 100% rename from apps/fixedwing_att_control/fixedwing_att_control_att.h rename to src/modules/fixedwing_att_control/fixedwing_att_control_att.h diff --git a/apps/fixedwing_att_control/fixedwing_att_control_main.c b/src/modules/fixedwing_att_control/fixedwing_att_control_main.c similarity index 99% rename from apps/fixedwing_att_control/fixedwing_att_control_main.c rename to src/modules/fixedwing_att_control/fixedwing_att_control_main.c index aa9db6d528..58477632b2 100644 --- a/apps/fixedwing_att_control/fixedwing_att_control_main.c +++ b/src/modules/fixedwing_att_control/fixedwing_att_control_main.c @@ -65,8 +65,9 @@ #include #include #include -#include -#include + +#include "fixedwing_att_control_rate.h" +#include "fixedwing_att_control_att.h" /* Prototypes */ /** diff --git a/apps/fixedwing_att_control/fixedwing_att_control_rate.c b/src/modules/fixedwing_att_control/fixedwing_att_control_rate.c similarity index 99% rename from apps/fixedwing_att_control/fixedwing_att_control_rate.c rename to src/modules/fixedwing_att_control/fixedwing_att_control_rate.c index ba5b593e28..4eccc118cb 100644 --- a/apps/fixedwing_att_control/fixedwing_att_control_rate.c +++ b/src/modules/fixedwing_att_control/fixedwing_att_control_rate.c @@ -33,11 +33,11 @@ ****************************************************************************/ /** * @file fixedwing_att_control_rate.c + * @author Thomas Gubler + * * Implementation of a fixed wing attitude controller. * - * @author Thomas Gubler */ -#include #include #include @@ -61,6 +61,8 @@ #include #include +#include "fixedwing_att_control_rate.h" + /* * Controller parameters, accessible via MAVLink * diff --git a/apps/fixedwing_att_control/fixedwing_att_control_rate.h b/src/modules/fixedwing_att_control/fixedwing_att_control_rate.h similarity index 100% rename from apps/fixedwing_att_control/fixedwing_att_control_rate.h rename to src/modules/fixedwing_att_control/fixedwing_att_control_rate.h diff --git a/apps/fixedwing_att_control/Makefile b/src/modules/fixedwing_att_control/module.mk similarity index 86% rename from apps/fixedwing_att_control/Makefile rename to src/modules/fixedwing_att_control/module.mk index 01465fa9ec..fd1a8724a5 100644 --- a/apps/fixedwing_att_control/Makefile +++ b/src/modules/fixedwing_att_control/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,14 +32,11 @@ ############################################################################ # -# Fixedwing Control application +# Fixedwing Attitude Control application # -APPNAME = fixedwing_att_control -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = fixedwing_att_control +SRCS = fixedwing_att_control_main.c \ + fixedwing_att_control_att.c \ + fixedwing_att_control_rate.c diff --git a/apps/examples/control_demo/control_demo.cpp b/src/modules/fixedwing_backside/fixedwing_backside_main.cpp similarity index 92% rename from apps/examples/control_demo/control_demo.cpp rename to src/modules/fixedwing_backside/fixedwing_backside_main.cpp index e609f2f4bd..e21990c929 100644 --- a/apps/examples/control_demo/control_demo.cpp +++ b/src/modules/fixedwing_backside/fixedwing_backside_main.cpp @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Example User + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: James Goppert * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +33,10 @@ ****************************************************************************/ /** - * @file control_demo.cpp - * Demonstration of control library + * @file fixedwing_backside_main.cpp + * @author James Goppert + * + * Fixedwing backside controller using control library */ #include @@ -55,7 +57,7 @@ static int deamon_task; /**< Handle of deamon task / thread */ /** * Deamon management function. */ -extern "C" __EXPORT int control_demo_main(int argc, char *argv[]); +extern "C" __EXPORT int fixedwing_backside_main(int argc, char *argv[]); /** * Mainloop of deamon. @@ -90,7 +92,7 @@ usage(const char *reason) * The actual stack size should be set in the call * to task_create(). */ -int control_demo_main(int argc, char *argv[]) +int fixedwing_backside_main(int argc, char *argv[]) { if (argc < 1) diff --git a/apps/examples/control_demo/Makefile b/src/modules/fixedwing_backside/module.mk similarity index 89% rename from apps/examples/control_demo/Makefile rename to src/modules/fixedwing_backside/module.mk index 6e40e645f8..a9233288b0 100644 --- a/apps/examples/control_demo/Makefile +++ b/src/modules/fixedwing_backside/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,9 @@ ############################################################################ # -# Basic example application +# Fixedwing backside controller # -APPNAME = control_demo -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = fixedwing_backside -include $(APPDIR)/mk/app.mk +SRCS = fixedwing_backside_main.cpp diff --git a/apps/examples/control_demo/params.c b/src/modules/fixedwing_backside/params.c similarity index 100% rename from apps/examples/control_demo/params.c rename to src/modules/fixedwing_backside/params.c diff --git a/apps/fixedwing_pos_control/fixedwing_pos_control_main.c b/src/modules/fixedwing_pos_control/fixedwing_pos_control_main.c similarity index 100% rename from apps/fixedwing_pos_control/fixedwing_pos_control_main.c rename to src/modules/fixedwing_pos_control/fixedwing_pos_control_main.c diff --git a/apps/fixedwing_pos_control/Makefile b/src/modules/fixedwing_pos_control/module.mk similarity index 86% rename from apps/fixedwing_pos_control/Makefile rename to src/modules/fixedwing_pos_control/module.mk index bce391f499..b976377e93 100644 --- a/apps/fixedwing_pos_control/Makefile +++ b/src/modules/fixedwing_pos_control/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,14 +32,9 @@ ############################################################################ # -# Fixedwing Control application +# Fixedwing PositionControl application # -APPNAME = fixedwing_pos_control -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = fixedwing_pos_control +SRCS = fixedwing_pos_control_main.c From 7ca82801bd4d4b9d6f4a0ac515e5cfcdc28f2e05 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 14:42:12 +0200 Subject: [PATCH 059/129] Moved multirotor controllers --- makefiles/config_px4fmu_default.mk | 8 +++----- .../modules/multirotor_att_control/module.mk | 12 ++++++------ .../multirotor_att_control_main.c | 0 .../multirotor_attitude_control.c | 0 .../multirotor_attitude_control.h | 0 .../multirotor_att_control/multirotor_rate_control.c | 0 .../multirotor_att_control/multirotor_rate_control.h | 0 .../modules/multirotor_pos_control/module.mk | 11 +++++------ .../multirotor_pos_control/multirotor_pos_control.c | 0 .../multirotor_pos_control_params.c | 0 .../multirotor_pos_control_params.h | 0 .../multirotor_pos_control/position_control.c | 0 .../multirotor_pos_control/position_control.h | 0 {apps => src/modules}/position_estimator/.context | 0 .../modules/position_estimator/module.mk | 12 ++++++------ .../position_estimator/position_estimator_main.c | 0 16 files changed, 20 insertions(+), 23 deletions(-) rename apps/multirotor_pos_control/Makefile => src/modules/multirotor_att_control/module.mk (85%) mode change 100644 => 100755 rename {apps => src/modules}/multirotor_att_control/multirotor_att_control_main.c (100%) rename {apps => src/modules}/multirotor_att_control/multirotor_attitude_control.c (100%) rename {apps => src/modules}/multirotor_att_control/multirotor_attitude_control.h (100%) rename {apps => src/modules}/multirotor_att_control/multirotor_rate_control.c (100%) rename {apps => src/modules}/multirotor_att_control/multirotor_rate_control.h (100%) rename apps/multirotor_att_control/Makefile => src/modules/multirotor_pos_control/module.mk (88%) mode change 100755 => 100644 rename {apps => src/modules}/multirotor_pos_control/multirotor_pos_control.c (100%) rename {apps => src/modules}/multirotor_pos_control/multirotor_pos_control_params.c (100%) rename {apps => src/modules}/multirotor_pos_control/multirotor_pos_control_params.h (100%) rename {apps => src/modules}/multirotor_pos_control/position_control.c (100%) rename {apps => src/modules}/multirotor_pos_control/position_control.h (100%) rename {apps => src/modules}/position_estimator/.context (100%) rename apps/position_estimator/Makefile => src/modules/position_estimator/module.mk (85%) rename {apps => src/modules}/position_estimator/position_estimator_main.c (100%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 6fd7da4614..fea9a814d2 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -54,6 +54,7 @@ MODULES += modules/mavlink_onboard # MODULES += modules/attitude_estimator_ekf MODULES += modules/position_estimator_mc +MODULES += modules/position_estimator MODULES += modules/att_pos_estimator_ekf # @@ -62,6 +63,8 @@ MODULES += modules/att_pos_estimator_ekf MODULES += modules/fixedwing_backside MODULES += modules/fixedwing_att_control MODULES += modules/fixedwing_pos_control +MODULES += modules/multirotor_att_control +MODULES += modules/multirotor_pos_control # # Logging @@ -83,12 +86,7 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ $(call _B, adc, , 2048, adc_main ) \ - $(call _B, control_demo, , 2048, control_demo_main ) \ - $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ - $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ - $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ - $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ $(call _B, sercon, , 2048, sercon_main ) \ $(call _B, serdis, , 2048, serdis_main ) \ $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ diff --git a/apps/multirotor_pos_control/Makefile b/src/modules/multirotor_att_control/module.mk old mode 100644 new mode 100755 similarity index 85% rename from apps/multirotor_pos_control/Makefile rename to src/modules/multirotor_att_control/module.mk index c88c854356..2fd52c162e --- a/apps/multirotor_pos_control/Makefile +++ b/src/modules/multirotor_att_control/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,11 @@ ############################################################################ # -# Makefile to build multirotor position control +# Makefile to build the multirotor attitude controller # -APPNAME = multirotor_pos_control -PRIORITY = SCHED_PRIORITY_MAX - 25 -STACKSIZE = 2048 +MODULE_COMMAND = multirotor_att_control -include $(APPDIR)/mk/app.mk +SRCS = multirotor_att_control_main.c \ + multirotor_attitude_control.c \ + multirotor_rate_control.c diff --git a/apps/multirotor_att_control/multirotor_att_control_main.c b/src/modules/multirotor_att_control/multirotor_att_control_main.c similarity index 100% rename from apps/multirotor_att_control/multirotor_att_control_main.c rename to src/modules/multirotor_att_control/multirotor_att_control_main.c diff --git a/apps/multirotor_att_control/multirotor_attitude_control.c b/src/modules/multirotor_att_control/multirotor_attitude_control.c similarity index 100% rename from apps/multirotor_att_control/multirotor_attitude_control.c rename to src/modules/multirotor_att_control/multirotor_attitude_control.c diff --git a/apps/multirotor_att_control/multirotor_attitude_control.h b/src/modules/multirotor_att_control/multirotor_attitude_control.h similarity index 100% rename from apps/multirotor_att_control/multirotor_attitude_control.h rename to src/modules/multirotor_att_control/multirotor_attitude_control.h diff --git a/apps/multirotor_att_control/multirotor_rate_control.c b/src/modules/multirotor_att_control/multirotor_rate_control.c similarity index 100% rename from apps/multirotor_att_control/multirotor_rate_control.c rename to src/modules/multirotor_att_control/multirotor_rate_control.c diff --git a/apps/multirotor_att_control/multirotor_rate_control.h b/src/modules/multirotor_att_control/multirotor_rate_control.h similarity index 100% rename from apps/multirotor_att_control/multirotor_rate_control.h rename to src/modules/multirotor_att_control/multirotor_rate_control.h diff --git a/apps/multirotor_att_control/Makefile b/src/modules/multirotor_pos_control/module.mk old mode 100755 new mode 100644 similarity index 88% rename from apps/multirotor_att_control/Makefile rename to src/modules/multirotor_pos_control/module.mk index 03cf33e434..d048477455 --- a/apps/multirotor_att_control/Makefile +++ b/src/modules/multirotor_pos_control/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,10 @@ ############################################################################ # -# Makefile to build uORB +# Build multirotor position control # -APPNAME = multirotor_att_control -PRIORITY = SCHED_PRIORITY_MAX - 15 -STACKSIZE = 2048 +MODULE_COMMAND = multirotor_pos_control -include $(APPDIR)/mk/app.mk +SRCS = multirotor_pos_control.c \ + multirotor_pos_control_params.c diff --git a/apps/multirotor_pos_control/multirotor_pos_control.c b/src/modules/multirotor_pos_control/multirotor_pos_control.c similarity index 100% rename from apps/multirotor_pos_control/multirotor_pos_control.c rename to src/modules/multirotor_pos_control/multirotor_pos_control.c diff --git a/apps/multirotor_pos_control/multirotor_pos_control_params.c b/src/modules/multirotor_pos_control/multirotor_pos_control_params.c similarity index 100% rename from apps/multirotor_pos_control/multirotor_pos_control_params.c rename to src/modules/multirotor_pos_control/multirotor_pos_control_params.c diff --git a/apps/multirotor_pos_control/multirotor_pos_control_params.h b/src/modules/multirotor_pos_control/multirotor_pos_control_params.h similarity index 100% rename from apps/multirotor_pos_control/multirotor_pos_control_params.h rename to src/modules/multirotor_pos_control/multirotor_pos_control_params.h diff --git a/apps/multirotor_pos_control/position_control.c b/src/modules/multirotor_pos_control/position_control.c similarity index 100% rename from apps/multirotor_pos_control/position_control.c rename to src/modules/multirotor_pos_control/position_control.c diff --git a/apps/multirotor_pos_control/position_control.h b/src/modules/multirotor_pos_control/position_control.h similarity index 100% rename from apps/multirotor_pos_control/position_control.h rename to src/modules/multirotor_pos_control/position_control.h diff --git a/apps/position_estimator/.context b/src/modules/position_estimator/.context similarity index 100% rename from apps/position_estimator/.context rename to src/modules/position_estimator/.context diff --git a/apps/position_estimator/Makefile b/src/modules/position_estimator/module.mk similarity index 85% rename from apps/position_estimator/Makefile rename to src/modules/position_estimator/module.mk index cc5072152c..f64095d9d1 100644 --- a/apps/position_estimator/Makefile +++ b/src/modules/position_estimator/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,10 @@ # Makefile to build the position estimator # -APPNAME = position_estimator -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = position_estimator -CSRCS = position_estimator_main.c +# XXX this should be converted to a deamon, its a pretty bad example app +MODULE_PRIORITY = SCHED_PRIORITY_DEFAULT +MODULE_STACKSIZE = 4096 -include $(APPDIR)/mk/app.mk +SRCS = position_estimator_main.c diff --git a/apps/position_estimator/position_estimator_main.c b/src/modules/position_estimator/position_estimator_main.c similarity index 100% rename from apps/position_estimator/position_estimator_main.c rename to src/modules/position_estimator/position_estimator_main.c From ee498a9d7ca4954398f35716804b1b59c7556c5b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 19:27:15 +0200 Subject: [PATCH 060/129] Made HMC bus-agnostic --- apps/drivers/device/i2c.h | 6 +++++- src/drivers/hmc5883/hmc5883.cpp | 34 +++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/apps/drivers/device/i2c.h b/apps/drivers/device/i2c.h index 66c34dd7c4..7daba31be8 100644 --- a/apps/drivers/device/i2c.h +++ b/apps/drivers/device/i2c.h @@ -60,6 +60,11 @@ protected: */ unsigned _retries; + /** + * The I2C bus number the device is attached to. + */ + int _bus; + /** * @ Constructor * @@ -123,7 +128,6 @@ protected: } private: - int _bus; uint16_t _address; uint32_t _frequency; struct i2c_dev_s *_dev; diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index 8ab5682821..d71f469e9d 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -75,7 +75,6 @@ * HMC5883 internal constants and data structures. */ -#define HMC5883L_BUS PX4_I2C_BUS_ONBOARD #define HMC5883L_ADDRESS PX4_I2C_OBDEV_HMC5883 /* Max measurement rate is 160Hz */ @@ -842,12 +841,21 @@ HMC5883::collect() * 74 from all measurements centers them around zero. */ - /* to align the sensor axes with the board, x and y need to be flipped */ - _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; - /* flip axes and negate value for y */ - _reports[_next_report].y = ((((report.x == -32768) ? 32767 : -report.x) * _range_scale) - _scale.y_offset) * _scale.y_scale; - /* z remains z */ - _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; + if (_bus == PX4_I2C_BUS_ONBOARD) { + /* to align the sensor axes with the board, x and y need to be flipped */ + _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; + /* flip axes and negate value for y */ + _reports[_next_report].y = ((((report.x == -32768) ? 32767 : -report.x) * _range_scale) - _scale.y_offset) * _scale.y_scale; + /* z remains z */ + _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; + } else { + /* XXX axis assignment of external sensor is yet unknown */ + _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; + /* flip axes and negate value for y */ + _reports[_next_report].y = ((((report.x == -32768) ? 32767 : -report.x) * _range_scale) - _scale.y_offset) * _scale.y_scale; + /* z remains z */ + _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; + } /* publish it */ orb_publish(ORB_ID(sensor_mag), _mag_topic, &_reports[_next_report]); @@ -1211,8 +1219,14 @@ start() if (g_dev != nullptr) errx(1, "already started"); - /* create the driver */ - g_dev = new HMC5883(HMC5883L_BUS); + /* create the driver, attempt expansion bus first */ + g_dev = new HMC5883(PX4_I2C_BUS_EXPANSION); + +#ifdef PX4_I2C_BUS_ONBOARD + /* if this failed, attempt onboard sensor */ + if (g_dev == nullptr) + g_dev = new HMC5883(PX4_I2C_BUS_ONBOARD); +#endif if (g_dev == nullptr) goto fail; From 7ac617242da56f6f826eb7496e7689f7f36c8fa2 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 19:27:24 +0200 Subject: [PATCH 061/129] docs fix --- src/modules/multirotor_att_control/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/multirotor_att_control/module.mk b/src/modules/multirotor_att_control/module.mk index 2fd52c162e..7569e1c7ee 100755 --- a/src/modules/multirotor_att_control/module.mk +++ b/src/modules/multirotor_att_control/module.mk @@ -32,7 +32,7 @@ ############################################################################ # -# Makefile to build the multirotor attitude controller +# Build multirotor attitude controller # MODULE_COMMAND = multirotor_att_control From 8040b9b96e8f7c07aa981150c33f850096062f70 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 19:51:06 +0200 Subject: [PATCH 062/129] Allowed for onboard bus to be not present --- src/drivers/hmc5883/hmc5883.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index d71f469e9d..c406a7588a 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -841,6 +841,7 @@ HMC5883::collect() * 74 from all measurements centers them around zero. */ +#ifdef PX4_I2C_BUS_ONBOARD if (_bus == PX4_I2C_BUS_ONBOARD) { /* to align the sensor axes with the board, x and y need to be flipped */ _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; @@ -849,13 +850,16 @@ HMC5883::collect() /* z remains z */ _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; } else { +#endif /* XXX axis assignment of external sensor is yet unknown */ _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; /* flip axes and negate value for y */ _reports[_next_report].y = ((((report.x == -32768) ? 32767 : -report.x) * _range_scale) - _scale.y_offset) * _scale.y_scale; /* z remains z */ _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; +#ifdef PX4_I2C_BUS_ONBOARD } +#endif /* publish it */ orb_publish(ORB_ID(sensor_mag), _mag_topic, &_reports[_next_report]); From f57439b90e23de260259dec051d3e2ead2d61c8c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 01:17:12 +0200 Subject: [PATCH 063/129] Moved all drivers to new world, PX4IO completely in new world --- apps/drivers/stm32/adc/Makefile | 43 --- apps/px4io/Makefile | 58 ---- makefiles/config_px4fmu_default.mk | 5 +- makefiles/config_px4io_default.mk | 7 +- makefiles/module.mk | 2 +- src/drivers/boards/px4io/module.mk | 6 + .../drivers/boards/px4io/px4io_init.c | 0 .../drivers/boards/px4io/px4io_internal.h | 0 .../drivers/boards/px4io/px4io_pwm_servo.c | 0 src/drivers/px4io/px4io.cpp | 4 +- {apps => src}/drivers/stm32/adc/adc.cpp | 0 .../drivers/stm32/adc/module.mk | 11 +- {apps => src}/drivers/stm32/drv_hrt.c | 0 {apps => src}/drivers/stm32/drv_pwm_servo.c | 2 + {apps => src}/drivers/stm32/drv_pwm_servo.h | 0 .../Makefile => src/drivers/stm32/module.mk | 7 +- .../drivers/stm32/tone_alarm/module.mk | 11 +- .../drivers/stm32/tone_alarm/tone_alarm.cpp | 0 .../px4io => src/modules/px4iofirmware}/adc.c | 0 .../modules/px4iofirmware}/controls.c | 0 .../px4io => src/modules/px4iofirmware}/dsm.c | 0 src/modules/px4iofirmware/hx_stream.c | 250 ++++++++++++++ src/modules/px4iofirmware/hx_stream.h | 122 +++++++ .../px4io => src/modules/px4iofirmware}/i2c.c | 0 .../modules/px4iofirmware}/mixer.cpp | 0 src/modules/px4iofirmware/module.mk | 4 + src/modules/px4iofirmware/perf_counter.c | 317 ++++++++++++++++++ src/modules/px4iofirmware/perf_counter.h | 128 +++++++ .../modules/px4iofirmware}/protocol.h | 0 .../modules/px4iofirmware}/px4io.c | 0 .../modules/px4iofirmware}/px4io.h | 0 .../modules/px4iofirmware}/registers.c | 0 .../modules/px4iofirmware}/safety.c | 0 .../modules/px4iofirmware}/sbus.c | 0 src/modules/px4iofirmware/up_cxxinitialize.c | 150 +++++++++ 35 files changed, 1006 insertions(+), 121 deletions(-) delete mode 100644 apps/drivers/stm32/adc/Makefile delete mode 100644 apps/px4io/Makefile create mode 100644 src/drivers/boards/px4io/module.mk rename {apps => src}/drivers/boards/px4io/px4io_init.c (100%) rename {apps => src}/drivers/boards/px4io/px4io_internal.h (100%) rename {apps => src}/drivers/boards/px4io/px4io_pwm_servo.c (100%) rename {apps => src}/drivers/stm32/adc/adc.cpp (100%) rename apps/drivers/boards/px4io/Makefile => src/drivers/stm32/adc/module.mk (87%) rename {apps => src}/drivers/stm32/drv_hrt.c (100%) rename {apps => src}/drivers/stm32/drv_pwm_servo.c (99%) rename {apps => src}/drivers/stm32/drv_pwm_servo.h (100%) rename apps/drivers/stm32/Makefile => src/drivers/stm32/module.mk (89%) rename apps/drivers/stm32/tone_alarm/Makefile => src/drivers/stm32/tone_alarm/module.mk (87%) rename {apps => src}/drivers/stm32/tone_alarm/tone_alarm.cpp (100%) rename {apps/px4io => src/modules/px4iofirmware}/adc.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/controls.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/dsm.c (100%) create mode 100644 src/modules/px4iofirmware/hx_stream.c create mode 100644 src/modules/px4iofirmware/hx_stream.h rename {apps/px4io => src/modules/px4iofirmware}/i2c.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/mixer.cpp (100%) create mode 100644 src/modules/px4iofirmware/module.mk create mode 100644 src/modules/px4iofirmware/perf_counter.c create mode 100644 src/modules/px4iofirmware/perf_counter.h rename {apps/px4io => src/modules/px4iofirmware}/protocol.h (100%) rename {apps/px4io => src/modules/px4iofirmware}/px4io.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/px4io.h (100%) rename {apps/px4io => src/modules/px4iofirmware}/registers.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/safety.c (100%) rename {apps/px4io => src/modules/px4iofirmware}/sbus.c (100%) create mode 100644 src/modules/px4iofirmware/up_cxxinitialize.c diff --git a/apps/drivers/stm32/adc/Makefile b/apps/drivers/stm32/adc/Makefile deleted file mode 100644 index 443bc06239..0000000000 --- a/apps/drivers/stm32/adc/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# STM32 ADC driver -# - -APPNAME = adc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common - -include $(APPDIR)/mk/app.mk diff --git a/apps/px4io/Makefile b/apps/px4io/Makefile deleted file mode 100644 index 0eb3ffcf7a..0000000000 --- a/apps/px4io/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build the px4io application. -# - -# -# Note that we pull a couple of specific files from the systemlib, since -# we can't support it all. -# -CSRCS = adc.c \ - controls.c \ - dsm.c \ - i2c.c \ - px4io.c \ - registers.c \ - safety.c \ - sbus.c \ - ../systemlib/hx_stream.c \ - ../systemlib/perf_counter.c \ - ../systemlib/up_cxxinitialize.c - -CXXSRCS = mixer.cpp - -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common - -include $(APPDIR)/mk/app.mk diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index fea9a814d2..47e15b3444 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -10,6 +10,9 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common # # Board support modules # +MODULES += drivers/stm32 +MODULES += drivers/stm32/adc +MODULES += drivers/stm32/tone_alarm MODULES += drivers/px4io MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu @@ -85,9 +88,7 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ - $(call _B, adc, , 2048, adc_main ) \ $(call _B, math_demo, , 8192, math_demo_main ) \ $(call _B, sercon, , 2048, sercon_main ) \ $(call _B, serdis, , 2048, serdis_main ) \ - $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ $(call _B, uorb, , 4096, uorb_main ) diff --git a/makefiles/config_px4io_default.mk b/makefiles/config_px4io_default.mk index dc774fe639..cf70391bcf 100644 --- a/makefiles/config_px4io_default.mk +++ b/makefiles/config_px4io_default.mk @@ -2,4 +2,9 @@ # Makefile for the px4io_default configuration # -# ... nothing here yet +# +# Board support modules +# +MODULES += drivers/stm32 +MODULES += drivers/boards/px4io +MODULES += modules/px4iofirmware \ No newline at end of file diff --git a/makefiles/module.mk b/makefiles/module.mk index 538f6d318e..253b3cd524 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/src/drivers/boards/px4io/module.mk b/src/drivers/boards/px4io/module.mk new file mode 100644 index 0000000000..2601a1c15a --- /dev/null +++ b/src/drivers/boards/px4io/module.mk @@ -0,0 +1,6 @@ +# +# Board-specific startup code for the PX4IO +# + +SRCS = px4io_init.c \ + px4io_pwm_servo.c diff --git a/apps/drivers/boards/px4io/px4io_init.c b/src/drivers/boards/px4io/px4io_init.c similarity index 100% rename from apps/drivers/boards/px4io/px4io_init.c rename to src/drivers/boards/px4io/px4io_init.c diff --git a/apps/drivers/boards/px4io/px4io_internal.h b/src/drivers/boards/px4io/px4io_internal.h similarity index 100% rename from apps/drivers/boards/px4io/px4io_internal.h rename to src/drivers/boards/px4io/px4io_internal.h diff --git a/apps/drivers/boards/px4io/px4io_pwm_servo.c b/src/drivers/boards/px4io/px4io_pwm_servo.c similarity index 100% rename from apps/drivers/boards/px4io/px4io_pwm_servo.c rename to src/drivers/boards/px4io/px4io_pwm_servo.c diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index b21f83e442..4c2f1736f9 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -80,11 +80,11 @@ #include #include #include +#include -#include #include #include "uploader.h" -#include +#include #define PX4IO_SET_DEBUG _IOC(0xff00, 0) #define PX4IO_INAIR_RESTART_ENABLE _IOC(0xff00, 1) diff --git a/apps/drivers/stm32/adc/adc.cpp b/src/drivers/stm32/adc/adc.cpp similarity index 100% rename from apps/drivers/stm32/adc/adc.cpp rename to src/drivers/stm32/adc/adc.cpp diff --git a/apps/drivers/boards/px4io/Makefile b/src/drivers/stm32/adc/module.mk similarity index 87% rename from apps/drivers/boards/px4io/Makefile rename to src/drivers/stm32/adc/module.mk index 85806fe6f5..48620feea8 100644 --- a/apps/drivers/boards/px4io/Makefile +++ b/src/drivers/stm32/adc/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,10 +32,11 @@ ############################################################################ # -# Board-specific startup code for the PX4IO +# STM32 ADC driver # -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common -LIBNAME = brd_px4io +MODULE_COMMAND = adc -include $(APPDIR)/mk/app.mk +SRCS = adc.cpp + +INCLUDE_DIRS += $(NUTTX_SRC)/arch/arm/src/stm32 $(NUTTX_SRC)/arch/arm/src/common diff --git a/apps/drivers/stm32/drv_hrt.c b/src/drivers/stm32/drv_hrt.c similarity index 100% rename from apps/drivers/stm32/drv_hrt.c rename to src/drivers/stm32/drv_hrt.c diff --git a/apps/drivers/stm32/drv_pwm_servo.c b/src/drivers/stm32/drv_pwm_servo.c similarity index 99% rename from apps/drivers/stm32/drv_pwm_servo.c rename to src/drivers/stm32/drv_pwm_servo.c index d7316e1f76..c1efb8515f 100644 --- a/apps/drivers/stm32/drv_pwm_servo.c +++ b/src/drivers/stm32/drv_pwm_servo.c @@ -290,6 +290,8 @@ up_pwm_servo_set_rate(unsigned rate) { for (unsigned i = 0; i < PWM_SERVO_MAX_TIMERS; i++) up_pwm_servo_set_rate_group_update(i, rate); + + return 0; } uint32_t diff --git a/apps/drivers/stm32/drv_pwm_servo.h b/src/drivers/stm32/drv_pwm_servo.h similarity index 100% rename from apps/drivers/stm32/drv_pwm_servo.h rename to src/drivers/stm32/drv_pwm_servo.h diff --git a/apps/drivers/stm32/Makefile b/src/drivers/stm32/module.mk similarity index 89% rename from apps/drivers/stm32/Makefile rename to src/drivers/stm32/module.mk index 4ad57f4135..bb751c7f68 100644 --- a/apps/drivers/stm32/Makefile +++ b/src/drivers/stm32/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -37,6 +37,7 @@ # Modules in this directory are compiled for all STM32 targets. # -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common +SRCS = drv_hrt.c \ + drv_pwm_servo.c -include $(APPDIR)/mk/app.mk +INCLUDE_DIRS += $(NUTTX_SRC)/arch/arm/src/stm32 $(NUTTX_SRC)/arch/arm/src/common diff --git a/apps/drivers/stm32/tone_alarm/Makefile b/src/drivers/stm32/tone_alarm/module.mk similarity index 87% rename from apps/drivers/stm32/tone_alarm/Makefile rename to src/drivers/stm32/tone_alarm/module.mk index d2ddf95340..827cf30b27 100644 --- a/apps/drivers/stm32/tone_alarm/Makefile +++ b/src/drivers/stm32/tone_alarm/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,9 +35,8 @@ # Tone alarm driver # -APPNAME = tone_alarm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common +MODULE_COMMAND = tone_alarm -include $(APPDIR)/mk/app.mk +SRCS = tone_alarm.cpp + +INCLUDE_DIRS += $(NUTTX_SRC)/arch/arm/src/stm32 $(NUTTX_SRC)/arch/arm/src/common diff --git a/apps/drivers/stm32/tone_alarm/tone_alarm.cpp b/src/drivers/stm32/tone_alarm/tone_alarm.cpp similarity index 100% rename from apps/drivers/stm32/tone_alarm/tone_alarm.cpp rename to src/drivers/stm32/tone_alarm/tone_alarm.cpp diff --git a/apps/px4io/adc.c b/src/modules/px4iofirmware/adc.c similarity index 100% rename from apps/px4io/adc.c rename to src/modules/px4iofirmware/adc.c diff --git a/apps/px4io/controls.c b/src/modules/px4iofirmware/controls.c similarity index 100% rename from apps/px4io/controls.c rename to src/modules/px4iofirmware/controls.c diff --git a/apps/px4io/dsm.c b/src/modules/px4iofirmware/dsm.c similarity index 100% rename from apps/px4io/dsm.c rename to src/modules/px4iofirmware/dsm.c diff --git a/src/modules/px4iofirmware/hx_stream.c b/src/modules/px4iofirmware/hx_stream.c new file mode 100644 index 0000000000..8d77f14a8d --- /dev/null +++ b/src/modules/px4iofirmware/hx_stream.c @@ -0,0 +1,250 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file hx_stream.c + * + * A simple serial line framing protocol based on HDLC + * with 32-bit CRC protection. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "perf_counter.h" + +#include "hx_stream.h" + + +struct hx_stream { + uint8_t buf[HX_STREAM_MAX_FRAME + 4]; + unsigned frame_bytes; + bool escaped; + bool txerror; + + int fd; + hx_stream_rx_callback callback; + void *callback_arg; + + perf_counter_t pc_tx_frames; + perf_counter_t pc_rx_frames; + perf_counter_t pc_rx_errors; +}; + +/* + * Protocol magic numbers, straight out of HDLC. + */ +#define FBO 0x7e /**< Frame Boundary Octet */ +#define CEO 0x7c /**< Control Escape Octet */ + +static void hx_tx_raw(hx_stream_t stream, uint8_t c); +static void hx_tx_raw(hx_stream_t stream, uint8_t c); +static int hx_rx_frame(hx_stream_t stream); + +static void +hx_tx_raw(hx_stream_t stream, uint8_t c) +{ + if (write(stream->fd, &c, 1) != 1) + stream->txerror = true; +} + +static void +hx_tx_byte(hx_stream_t stream, uint8_t c) +{ + switch (c) { + case FBO: + case CEO: + hx_tx_raw(stream, CEO); + c ^= 0x20; + break; + } + + hx_tx_raw(stream, c); +} + +static int +hx_rx_frame(hx_stream_t stream) +{ + union { + uint8_t b[4]; + uint32_t w; + } u; + unsigned length = stream->frame_bytes; + + /* reset the stream */ + stream->frame_bytes = 0; + stream->escaped = false; + + /* not a real frame - too short */ + if (length < 4) { + if (length > 1) + perf_count(stream->pc_rx_errors); + + return 0; + } + + length -= 4; + + /* compute expected CRC */ + u.w = crc32(&stream->buf[0], length); + + /* compare computed and actual CRC */ + for (unsigned i = 0; i < 4; i++) { + if (u.b[i] != stream->buf[length + i]) { + perf_count(stream->pc_rx_errors); + return 0; + } + } + + /* frame is good */ + perf_count(stream->pc_rx_frames); + stream->callback(stream->callback_arg, &stream->buf[0], length); + return 1; +} + +hx_stream_t +hx_stream_init(int fd, + hx_stream_rx_callback callback, + void *arg) +{ + hx_stream_t stream; + + stream = (hx_stream_t)malloc(sizeof(struct hx_stream)); + + if (stream != NULL) { + memset(stream, 0, sizeof(struct hx_stream)); + stream->fd = fd; + stream->callback = callback; + stream->callback_arg = arg; + } + + return stream; +} + +void +hx_stream_free(hx_stream_t stream) +{ + /* free perf counters (OK if they are NULL) */ + perf_free(stream->pc_tx_frames); + perf_free(stream->pc_rx_frames); + perf_free(stream->pc_rx_errors); + + free(stream); +} + +void +hx_stream_set_counters(hx_stream_t stream, + perf_counter_t tx_frames, + perf_counter_t rx_frames, + perf_counter_t rx_errors) +{ + stream->pc_tx_frames = tx_frames; + stream->pc_rx_frames = rx_frames; + stream->pc_rx_errors = rx_errors; +} + +int +hx_stream_send(hx_stream_t stream, + const void *data, + size_t count) +{ + union { + uint8_t b[4]; + uint32_t w; + } u; + const uint8_t *p = (const uint8_t *)data; + unsigned resid = count; + + if (resid > HX_STREAM_MAX_FRAME) + return -EINVAL; + + /* start the frame */ + hx_tx_raw(stream, FBO); + + /* transmit the data */ + while (resid--) + hx_tx_byte(stream, *p++); + + /* compute the CRC */ + u.w = crc32(data, count); + + /* send the CRC */ + p = &u.b[0]; + resid = 4; + + while (resid--) + hx_tx_byte(stream, *p++); + + /* and the trailing frame separator */ + hx_tx_raw(stream, FBO); + + /* check for transmit error */ + if (stream->txerror) { + stream->txerror = false; + return -EIO; + } + + perf_count(stream->pc_tx_frames); + return 0; +} + +void +hx_stream_rx(hx_stream_t stream, uint8_t c) +{ + /* frame end? */ + if (c == FBO) { + hx_rx_frame(stream); + return; + } + + /* escaped? */ + if (stream->escaped) { + stream->escaped = false; + c ^= 0x20; + + } else if (c == CEO) { + /* now escaped, ignore the byte */ + stream->escaped = true; + return; + } + + /* save for later */ + if (stream->frame_bytes < sizeof(stream->buf)) + stream->buf[stream->frame_bytes++] = c; +} diff --git a/src/modules/px4iofirmware/hx_stream.h b/src/modules/px4iofirmware/hx_stream.h new file mode 100644 index 0000000000..128689953a --- /dev/null +++ b/src/modules/px4iofirmware/hx_stream.h @@ -0,0 +1,122 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file hx_stream.h + * + * A simple serial line framing protocol based on HDLC + * with 32-bit CRC protection. + */ + +#ifndef _SYSTEMLIB_HX_STREAM_H +#define _SYSTEMLIB_HX_STREAM_H + +#include + +#include "perf_counter.h" + +struct hx_stream; +typedef struct hx_stream *hx_stream_t; + +#define HX_STREAM_MAX_FRAME 64 + +typedef void (* hx_stream_rx_callback)(void *arg, const void *data, size_t length); + +__BEGIN_DECLS + +/** + * Allocate a new hx_stream object. + * + * @param fd The file handle over which the protocol will + * communicate. + * @param callback Called when a frame is received. + * @param callback_arg Passed to the callback. + * @return A handle to the stream, or NULL if memory could + * not be allocated. + */ +__EXPORT extern hx_stream_t hx_stream_init(int fd, + hx_stream_rx_callback callback, + void *arg); + +/** + * Free a hx_stream object. + * + * @param stream A handle returned from hx_stream_init. + */ +__EXPORT extern void hx_stream_free(hx_stream_t stream); + +/** + * Set performance counters for the stream. + * + * Any counter may be set to NULL to disable counting that datum. + * + * @param tx_frames Counter for transmitted frames. + * @param rx_frames Counter for received frames. + * @param rx_errors Counter for short and corrupt received frames. + */ +__EXPORT extern void hx_stream_set_counters(hx_stream_t stream, + perf_counter_t tx_frames, + perf_counter_t rx_frames, + perf_counter_t rx_errors); + +/** + * Send a frame. + * + * This function will block until all frame bytes are sent if + * the descriptor passed to hx_stream_init is marked blocking, + * otherwise it will return -1 (but may transmit a + * runt frame at the same time). + * + * @todo Handling of non-blocking streams needs to be better. + * + * @param stream A handle returned from hx_stream_init. + * @param data Pointer to the data to send. + * @param count The number of bytes to send. + * @return Zero on success, -errno on error. + */ +__EXPORT extern int hx_stream_send(hx_stream_t stream, + const void *data, + size_t count); + +/** + * Handle a byte from the stream. + * + * @param stream A handle returned from hx_stream_init. + * @param c The character to process. + */ +__EXPORT extern void hx_stream_rx(hx_stream_t stream, + uint8_t c); + +__END_DECLS + +#endif diff --git a/apps/px4io/i2c.c b/src/modules/px4iofirmware/i2c.c similarity index 100% rename from apps/px4io/i2c.c rename to src/modules/px4iofirmware/i2c.c diff --git a/apps/px4io/mixer.cpp b/src/modules/px4iofirmware/mixer.cpp similarity index 100% rename from apps/px4io/mixer.cpp rename to src/modules/px4iofirmware/mixer.cpp diff --git a/src/modules/px4iofirmware/module.mk b/src/modules/px4iofirmware/module.mk new file mode 100644 index 0000000000..085697fbb6 --- /dev/null +++ b/src/modules/px4iofirmware/module.mk @@ -0,0 +1,4 @@ + + +SRCS = adc.c controls.c dsm.c i2c.c mixer.cpp px4io.c registers.c safety.c sbus.c \ + up_cxxinitialize.c hx_stream.c perf_counter.c diff --git a/src/modules/px4iofirmware/perf_counter.c b/src/modules/px4iofirmware/perf_counter.c new file mode 100644 index 0000000000..879f4715af --- /dev/null +++ b/src/modules/px4iofirmware/perf_counter.c @@ -0,0 +1,317 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file perf_counter.c + * + * @brief Performance measuring tools. + */ + +#include +#include +#include +#include + +#include "perf_counter.h" + +/** + * Header common to all counters. + */ +struct perf_ctr_header { + sq_entry_t link; /**< list linkage */ + enum perf_counter_type type; /**< counter type */ + const char *name; /**< counter name */ +}; + +/** + * PC_EVENT counter. + */ +struct perf_ctr_count { + struct perf_ctr_header hdr; + uint64_t event_count; +}; + +/** + * PC_ELAPSED counter. + */ +struct perf_ctr_elapsed { + struct perf_ctr_header hdr; + uint64_t event_count; + uint64_t time_start; + uint64_t time_total; + uint64_t time_least; + uint64_t time_most; +}; + +/** + * PC_INTERVAL counter. + */ +struct perf_ctr_interval { + struct perf_ctr_header hdr; + uint64_t event_count; + uint64_t time_event; + uint64_t time_first; + uint64_t time_last; + uint64_t time_least; + uint64_t time_most; + +}; + +/** + * List of all known counters. + */ +static sq_queue_t perf_counters; + + +perf_counter_t +perf_alloc(enum perf_counter_type type, const char *name) +{ + perf_counter_t ctr = NULL; + + switch (type) { + case PC_COUNT: + ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_count), 1); + break; + + case PC_ELAPSED: + ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_elapsed), 1); + break; + + case PC_INTERVAL: + ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_interval), 1); + break; + + default: + break; + } + + if (ctr != NULL) { + ctr->type = type; + ctr->name = name; + sq_addfirst(&ctr->link, &perf_counters); + } + + return ctr; +} + +void +perf_free(perf_counter_t handle) +{ + if (handle == NULL) + return; + + sq_rem(&handle->link, &perf_counters); + free(handle); +} + +void +perf_count(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_COUNT: + ((struct perf_ctr_count *)handle)->event_count++; + break; + + case PC_INTERVAL: { + struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; + hrt_abstime now = hrt_absolute_time(); + + switch (pci->event_count) { + case 0: + pci->time_first = now; + break; + case 1: + pci->time_least = now - pci->time_last; + pci->time_most = now - pci->time_last; + break; + default: { + hrt_abstime interval = now - pci->time_last; + if (interval < pci->time_least) + pci->time_least = interval; + if (interval > pci->time_most) + pci->time_most = interval; + break; + } + } + pci->time_last = now; + pci->event_count++; + break; + } + + default: + break; + } +} + +void +perf_begin(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_ELAPSED: + ((struct perf_ctr_elapsed *)handle)->time_start = hrt_absolute_time(); + break; + + default: + break; + } +} + +void +perf_end(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_ELAPSED: { + struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; + hrt_abstime elapsed = hrt_absolute_time() - pce->time_start; + + pce->event_count++; + pce->time_total += elapsed; + + if ((pce->time_least > elapsed) || (pce->time_least == 0)) + pce->time_least = elapsed; + + if (pce->time_most < elapsed) + pce->time_most = elapsed; + } + + default: + break; + } +} + +void +perf_reset(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_COUNT: + ((struct perf_ctr_count *)handle)->event_count = 0; + break; + + case PC_ELAPSED: { + struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; + pce->event_count = 0; + pce->time_start = 0; + pce->time_total = 0; + pce->time_least = 0; + pce->time_most = 0; + break; + } + + case PC_INTERVAL: { + struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; + pci->event_count = 0; + pci->time_event = 0; + pci->time_first = 0; + pci->time_last = 0; + pci->time_least = 0; + pci->time_most = 0; + break; + } + } +} + +void +perf_print_counter(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_COUNT: + printf("%s: %llu events\n", + handle->name, + ((struct perf_ctr_count *)handle)->event_count); + break; + + case PC_ELAPSED: { + struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; + + printf("%s: %llu events, %lluus elapsed, min %lluus max %lluus\n", + handle->name, + pce->event_count, + pce->time_total, + pce->time_least, + pce->time_most); + break; + } + + case PC_INTERVAL: { + struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; + + printf("%s: %llu events, %llu avg, min %lluus max %lluus\n", + handle->name, + pci->event_count, + (pci->time_last - pci->time_first) / pci->event_count, + pci->time_least, + pci->time_most); + break; + } + + default: + break; + } +} + +void +perf_print_all(void) +{ + perf_counter_t handle = (perf_counter_t)sq_peek(&perf_counters); + + while (handle != NULL) { + perf_print_counter(handle); + handle = (perf_counter_t)sq_next(&handle->link); + } +} + +void +perf_reset_all(void) +{ + perf_counter_t handle = (perf_counter_t)sq_peek(&perf_counters); + + while (handle != NULL) { + perf_reset(handle); + handle = (perf_counter_t)sq_next(&handle->link); + } +} diff --git a/src/modules/px4iofirmware/perf_counter.h b/src/modules/px4iofirmware/perf_counter.h new file mode 100644 index 0000000000..5c2cb15b2f --- /dev/null +++ b/src/modules/px4iofirmware/perf_counter.h @@ -0,0 +1,128 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file perf_counter.h + * Performance measuring tools. + */ + +#ifndef _SYSTEMLIB_PERF_COUNTER_H +#define _SYSTEMLIB_PERF_COUNTER_H value + +/** + * Counter types. + */ +enum perf_counter_type { + PC_COUNT, /**< count the number of times an event occurs */ + PC_ELAPSED, /**< measure the time elapsed performing an event */ + PC_INTERVAL /**< measure the interval between instances of an event */ +}; + +struct perf_ctr_header; +typedef struct perf_ctr_header *perf_counter_t; + +__BEGIN_DECLS + +/** + * Create a new counter. + * + * @param type The type of the new counter. + * @param name The counter name. + * @return Handle for the new counter, or NULL if a counter + * could not be allocated. + */ +__EXPORT extern perf_counter_t perf_alloc(enum perf_counter_type type, const char *name); + +/** + * Free a counter. + * + * @param handle The performance counter's handle. + */ +__EXPORT extern void perf_free(perf_counter_t handle); + +/** + * Count a performance event. + * + * This call only affects counters that take single events; PC_COUNT etc. + * + * @param handle The handle returned from perf_alloc. + */ +__EXPORT extern void perf_count(perf_counter_t handle); + +/** + * Begin a performance event. + * + * This call applies to counters that operate over ranges of time; PC_ELAPSED etc. + * + * @param handle The handle returned from perf_alloc. + */ +__EXPORT extern void perf_begin(perf_counter_t handle); + +/** + * End a performance event. + * + * This call applies to counters that operate over ranges of time; PC_ELAPSED etc. + * + * @param handle The handle returned from perf_alloc. + */ +__EXPORT extern void perf_end(perf_counter_t handle); + +/** + * Reset a performance event. + * + * This call resets performance counter to initial state + * + * @param handle The handle returned from perf_alloc. + */ +__EXPORT extern void perf_reset(perf_counter_t handle); + +/** + * Print one performance counter. + * + * @param handle The counter to print. + */ +__EXPORT extern void perf_print_counter(perf_counter_t handle); + +/** + * Print all of the performance counters. + */ +__EXPORT extern void perf_print_all(void); + +/** + * Reset all of the performance counters. + */ +__EXPORT extern void perf_reset_all(void); + +__END_DECLS + +#endif diff --git a/apps/px4io/protocol.h b/src/modules/px4iofirmware/protocol.h similarity index 100% rename from apps/px4io/protocol.h rename to src/modules/px4iofirmware/protocol.h diff --git a/apps/px4io/px4io.c b/src/modules/px4iofirmware/px4io.c similarity index 100% rename from apps/px4io/px4io.c rename to src/modules/px4iofirmware/px4io.c diff --git a/apps/px4io/px4io.h b/src/modules/px4iofirmware/px4io.h similarity index 100% rename from apps/px4io/px4io.h rename to src/modules/px4iofirmware/px4io.h diff --git a/apps/px4io/registers.c b/src/modules/px4iofirmware/registers.c similarity index 100% rename from apps/px4io/registers.c rename to src/modules/px4iofirmware/registers.c diff --git a/apps/px4io/safety.c b/src/modules/px4iofirmware/safety.c similarity index 100% rename from apps/px4io/safety.c rename to src/modules/px4iofirmware/safety.c diff --git a/apps/px4io/sbus.c b/src/modules/px4iofirmware/sbus.c similarity index 100% rename from apps/px4io/sbus.c rename to src/modules/px4iofirmware/sbus.c diff --git a/src/modules/px4iofirmware/up_cxxinitialize.c b/src/modules/px4iofirmware/up_cxxinitialize.c new file mode 100644 index 0000000000..c78f295708 --- /dev/null +++ b/src/modules/px4iofirmware/up_cxxinitialize.c @@ -0,0 +1,150 @@ +/************************************************************************************ + * configs/stm32f4discovery/src/up_cxxinitialize.c + * arch/arm/src/board/up_cxxinitialize.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include + +#include + +//#include +//#include "chip.h" + +/************************************************************************************ + * Definitions + ************************************************************************************/ +/* Debug ****************************************************************************/ +/* Non-standard debug that may be enabled just for testing the static constructors */ + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_CXX +#endif + +#ifdef CONFIG_DEBUG_CXX +# define cxxdbg dbg +# define cxxlldbg lldbg +# ifdef CONFIG_DEBUG_VERBOSE +# define cxxvdbg vdbg +# define cxxllvdbg llvdbg +# else +# define cxxvdbg(x...) +# define cxxllvdbg(x...) +# endif +#else +# define cxxdbg(x...) +# define cxxlldbg(x...) +# define cxxvdbg(x...) +# define cxxllvdbg(x...) +#endif + +/************************************************************************************ + * Private Types + ************************************************************************************/ +/* This type defines one entry in initialization array */ + +typedef void (*initializer_t)(void); + +/************************************************************************************ + * External references + ************************************************************************************/ +/* _sinit and _einit are symbols exported by the linker script that mark the + * beginning and the end of the C++ initialization section. + */ + +extern initializer_t _sinit; +extern initializer_t _einit; + +/* _stext and _etext are symbols exported by the linker script that mark the + * beginning and the end of text. + */ + +extern uint32_t _stext; +extern uint32_t _etext; + +/************************************************************************************ + * Private Functions + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/**************************************************************************** + * Name: up_cxxinitialize + * + * Description: + * If C++ and C++ static constructors are supported, then this function + * must be provided by board-specific logic in order to perform + * initialization of the static C++ class instances. + * + * This function should then be called in the application-specific + * user_start logic in order to perform the C++ initialization. NOTE + * that no component of the core NuttX RTOS logic is involved; This + * function defintion only provides the 'contract' between application + * specific C++ code and platform-specific toolchain support + * + ***************************************************************************/ + +__EXPORT void up_cxxinitialize(void) +{ + initializer_t *initp; + + cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n", + &_sinit, &_einit, &_stext, &_etext); + + /* Visit each entry in the initialzation table */ + + for (initp = &_sinit; initp != &_einit; initp++) + { + initializer_t initializer = *initp; + cxxdbg("initp: %p initializer: %p\n", initp, initializer); + + /* Make sure that the address is non-NULL and lies in the text region + * defined by the linker script. Some toolchains may put NULL values + * or counts in the initialization table + */ + + if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext) + { + cxxdbg("Calling %p\n", initializer); + initializer(); + } + } +} From 13fc6703862862f4263d8d5d085b7a16b87190e1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 09:54:11 +0200 Subject: [PATCH 064/129] Moved last libs, drivers and headers, cleaned up IO build --- makefiles/config_px4fmu_default.mk | 16 + makefiles/module.mk | 2 +- makefiles/setup.mk | 1 + {apps => src}/drivers/device/cdev.cpp | 0 {apps => src}/drivers/device/device.cpp | 0 {apps => src}/drivers/device/device.h | 0 {apps => src}/drivers/device/i2c.cpp | 0 {apps => src}/drivers/device/i2c.h | 0 .../Makefile => src/drivers/device/module.mk | 8 +- {apps => src}/drivers/device/pio.cpp | 0 {apps => src}/drivers/device/spi.cpp | 0 {apps => src}/drivers/device/spi.h | 0 {apps => src}/drivers/drv_accel.h | 0 {apps => src}/drivers/drv_adc.h | 0 {apps => src}/drivers/drv_baro.h | 0 {apps => src}/drivers/drv_blinkm.h | 0 {apps => src}/drivers/drv_gpio.h | 0 {apps => src}/drivers/drv_gps.h | 0 {apps => src}/drivers/drv_gyro.h | 0 {apps => src}/drivers/drv_hrt.h | 0 {apps => src}/drivers/drv_led.h | 0 {apps => src}/drivers/drv_mag.h | 0 {apps => src}/drivers/drv_mixer.h | 0 {apps => src}/drivers/drv_orb_dev.h | 2 +- {apps => src}/drivers/drv_pwm_output.h | 0 {apps => src}/drivers/drv_range_finder.h | 0 {apps => src}/drivers/drv_rc_input.h | 0 {apps => src}/drivers/drv_sensor.h | 0 {apps => src}/drivers/drv_tone_alarm.h | 0 {apps => src}/drivers/led/Makefile | 0 {apps => src}/drivers/led/led.cpp | 0 .../examples/math_demo/math_demo.cpp | 5 +- .../examples/math_demo/module.mk | 11 +- .../modules}/controllib/block/Block.cpp | 0 .../modules}/controllib/block/Block.hpp | 0 .../modules}/controllib/block/BlockParam.cpp | 0 .../modules}/controllib/block/BlockParam.hpp | 0 .../modules}/controllib/block/List.hpp | 0 .../controllib/block/UOrbPublication.cpp | 0 .../controllib/block/UOrbPublication.hpp | 0 .../controllib/block/UOrbSubscription.cpp | 0 .../controllib/block/UOrbSubscription.hpp | 0 {apps => src/modules}/controllib/blocks.cpp | 0 {apps => src/modules}/controllib/blocks.hpp | 0 .../modules}/controllib/fixedwing.cpp | 0 .../modules}/controllib/fixedwing.hpp | 0 .../modules/controllib/module.mk | 9 +- .../modules}/controllib/test_params.c | 0 .../Source/BasicMathFunctions/arm_abs_f32.c | 0 .../Source/BasicMathFunctions/arm_abs_q15.c | 0 .../Source/BasicMathFunctions/arm_abs_q31.c | 0 .../Source/BasicMathFunctions/arm_abs_q7.c | 0 .../Source/BasicMathFunctions/arm_add_f32.c | 0 .../Source/BasicMathFunctions/arm_add_q15.c | 0 .../Source/BasicMathFunctions/arm_add_q31.c | 0 .../Source/BasicMathFunctions/arm_add_q7.c | 0 .../BasicMathFunctions/arm_dot_prod_f32.c | 0 .../BasicMathFunctions/arm_dot_prod_q15.c | 0 .../BasicMathFunctions/arm_dot_prod_q31.c | 0 .../BasicMathFunctions/arm_dot_prod_q7.c | 0 .../Source/BasicMathFunctions/arm_mult_f32.c | 0 .../Source/BasicMathFunctions/arm_mult_q15.c | 0 .../Source/BasicMathFunctions/arm_mult_q31.c | 0 .../Source/BasicMathFunctions/arm_mult_q7.c | 0 .../BasicMathFunctions/arm_negate_f32.c | 0 .../BasicMathFunctions/arm_negate_q15.c | 0 .../BasicMathFunctions/arm_negate_q31.c | 0 .../Source/BasicMathFunctions/arm_negate_q7.c | 0 .../BasicMathFunctions/arm_offset_f32.c | 0 .../BasicMathFunctions/arm_offset_q15.c | 0 .../BasicMathFunctions/arm_offset_q31.c | 0 .../Source/BasicMathFunctions/arm_offset_q7.c | 0 .../Source/BasicMathFunctions/arm_scale_f32.c | 0 .../Source/BasicMathFunctions/arm_scale_q15.c | 0 .../Source/BasicMathFunctions/arm_scale_q31.c | 0 .../Source/BasicMathFunctions/arm_scale_q7.c | 0 .../Source/BasicMathFunctions/arm_shift_q15.c | 0 .../Source/BasicMathFunctions/arm_shift_q31.c | 0 .../Source/BasicMathFunctions/arm_shift_q7.c | 0 .../Source/BasicMathFunctions/arm_sub_f32.c | 0 .../Source/BasicMathFunctions/arm_sub_q15.c | 0 .../Source/BasicMathFunctions/arm_sub_q31.c | 0 .../Source/BasicMathFunctions/arm_sub_q7.c | 0 .../Source/CommonTables/arm_common_tables.c | 0 .../ComplexMathFunctions/arm_cmplx_conj_f32.c | 0 .../ComplexMathFunctions/arm_cmplx_conj_q15.c | 0 .../ComplexMathFunctions/arm_cmplx_conj_q31.c | 0 .../arm_cmplx_dot_prod_f32.c | 0 .../arm_cmplx_dot_prod_q15.c | 0 .../arm_cmplx_dot_prod_q31.c | 0 .../ComplexMathFunctions/arm_cmplx_mag_f32.c | 0 .../ComplexMathFunctions/arm_cmplx_mag_q15.c | 0 .../ComplexMathFunctions/arm_cmplx_mag_q31.c | 0 .../arm_cmplx_mag_squared_f32.c | 0 .../arm_cmplx_mag_squared_q15.c | 0 .../arm_cmplx_mag_squared_q31.c | 0 .../arm_cmplx_mult_cmplx_f32.c | 0 .../arm_cmplx_mult_cmplx_q15.c | 0 .../arm_cmplx_mult_cmplx_q31.c | 0 .../arm_cmplx_mult_real_f32.c | 0 .../arm_cmplx_mult_real_q15.c | 0 .../arm_cmplx_mult_real_q31.c | 0 .../ControllerFunctions/arm_pid_init_f32.c | 0 .../ControllerFunctions/arm_pid_init_q15.c | 0 .../ControllerFunctions/arm_pid_init_q31.c | 0 .../ControllerFunctions/arm_pid_reset_f32.c | 0 .../ControllerFunctions/arm_pid_reset_q15.c | 0 .../ControllerFunctions/arm_pid_reset_q31.c | 0 .../ControllerFunctions/arm_sin_cos_f32.c | 0 .../ControllerFunctions/arm_sin_cos_q31.c | 0 .../Source/FastMathFunctions/arm_cos_f32.c | 0 .../Source/FastMathFunctions/arm_cos_q15.c | 0 .../Source/FastMathFunctions/arm_cos_q31.c | 0 .../Source/FastMathFunctions/arm_sin_f32.c | 0 .../Source/FastMathFunctions/arm_sin_q15.c | 0 .../Source/FastMathFunctions/arm_sin_q31.c | 0 .../Source/FastMathFunctions/arm_sqrt_q15.c | 0 .../Source/FastMathFunctions/arm_sqrt_q31.c | 0 .../arm_biquad_cascade_df1_32x64_init_q31.c | 0 .../arm_biquad_cascade_df1_32x64_q31.c | 0 .../arm_biquad_cascade_df1_f32.c | 0 .../arm_biquad_cascade_df1_fast_q15.c | 0 .../arm_biquad_cascade_df1_fast_q31.c | 0 .../arm_biquad_cascade_df1_init_f32.c | 0 .../arm_biquad_cascade_df1_init_q15.c | 0 .../arm_biquad_cascade_df1_init_q31.c | 0 .../arm_biquad_cascade_df1_q15.c | 0 .../arm_biquad_cascade_df1_q31.c | 0 .../arm_biquad_cascade_df2T_f32.c | 0 .../arm_biquad_cascade_df2T_init_f32.c | 0 .../Source/FilteringFunctions/arm_conv_f32.c | 0 .../arm_conv_fast_opt_q15.c | 0 .../FilteringFunctions/arm_conv_fast_q15.c | 0 .../FilteringFunctions/arm_conv_fast_q31.c | 0 .../FilteringFunctions/arm_conv_opt_q15.c | 0 .../FilteringFunctions/arm_conv_opt_q7.c | 0 .../FilteringFunctions/arm_conv_partial_f32.c | 0 .../arm_conv_partial_fast_opt_q15.c | 0 .../arm_conv_partial_fast_q15.c | 0 .../arm_conv_partial_fast_q31.c | 0 .../arm_conv_partial_opt_q15.c | 0 .../arm_conv_partial_opt_q7.c | 0 .../FilteringFunctions/arm_conv_partial_q15.c | 0 .../FilteringFunctions/arm_conv_partial_q31.c | 0 .../FilteringFunctions/arm_conv_partial_q7.c | 0 .../Source/FilteringFunctions/arm_conv_q15.c | 0 .../Source/FilteringFunctions/arm_conv_q31.c | 0 .../Source/FilteringFunctions/arm_conv_q7.c | 0 .../FilteringFunctions/arm_correlate_f32.c | 0 .../arm_correlate_fast_opt_q15.c | 0 .../arm_correlate_fast_q15.c | 0 .../arm_correlate_fast_q31.c | 0 .../arm_correlate_opt_q15.c | 0 .../FilteringFunctions/arm_correlate_opt_q7.c | 0 .../FilteringFunctions/arm_correlate_q15.c | 0 .../FilteringFunctions/arm_correlate_q31.c | 0 .../FilteringFunctions/arm_correlate_q7.c | 0 .../FilteringFunctions/arm_fir_decimate_f32.c | 0 .../arm_fir_decimate_fast_q15.c | 0 .../arm_fir_decimate_fast_q31.c | 0 .../arm_fir_decimate_init_f32.c | 0 .../arm_fir_decimate_init_q15.c | 0 .../arm_fir_decimate_init_q31.c | 0 .../FilteringFunctions/arm_fir_decimate_q15.c | 0 .../FilteringFunctions/arm_fir_decimate_q31.c | 0 .../Source/FilteringFunctions/arm_fir_f32.c | 0 .../FilteringFunctions/arm_fir_fast_q15.c | 0 .../FilteringFunctions/arm_fir_fast_q31.c | 0 .../FilteringFunctions/arm_fir_init_f32.c | 0 .../FilteringFunctions/arm_fir_init_q15.c | 0 .../FilteringFunctions/arm_fir_init_q31.c | 0 .../FilteringFunctions/arm_fir_init_q7.c | 0 .../arm_fir_interpolate_f32.c | 0 .../arm_fir_interpolate_init_f32.c | 0 .../arm_fir_interpolate_init_q15.c | 0 .../arm_fir_interpolate_init_q31.c | 0 .../arm_fir_interpolate_q15.c | 0 .../arm_fir_interpolate_q31.c | 0 .../FilteringFunctions/arm_fir_lattice_f32.c | 0 .../arm_fir_lattice_init_f32.c | 0 .../arm_fir_lattice_init_q15.c | 0 .../arm_fir_lattice_init_q31.c | 0 .../FilteringFunctions/arm_fir_lattice_q15.c | 0 .../FilteringFunctions/arm_fir_lattice_q31.c | 0 .../Source/FilteringFunctions/arm_fir_q15.c | 0 .../Source/FilteringFunctions/arm_fir_q31.c | 0 .../Source/FilteringFunctions/arm_fir_q7.c | 0 .../FilteringFunctions/arm_fir_sparse_f32.c | 0 .../arm_fir_sparse_init_f32.c | 0 .../arm_fir_sparse_init_q15.c | 0 .../arm_fir_sparse_init_q31.c | 0 .../arm_fir_sparse_init_q7.c | 0 .../FilteringFunctions/arm_fir_sparse_q15.c | 0 .../FilteringFunctions/arm_fir_sparse_q31.c | 0 .../FilteringFunctions/arm_fir_sparse_q7.c | 0 .../FilteringFunctions/arm_iir_lattice_f32.c | 0 .../arm_iir_lattice_init_f32.c | 0 .../arm_iir_lattice_init_q15.c | 0 .../arm_iir_lattice_init_q31.c | 0 .../FilteringFunctions/arm_iir_lattice_q15.c | 0 .../FilteringFunctions/arm_iir_lattice_q31.c | 0 .../Source/FilteringFunctions/arm_lms_f32.c | 0 .../FilteringFunctions/arm_lms_init_f32.c | 0 .../FilteringFunctions/arm_lms_init_q15.c | 0 .../FilteringFunctions/arm_lms_init_q31.c | 0 .../FilteringFunctions/arm_lms_norm_f32.c | 0 .../arm_lms_norm_init_f32.c | 0 .../arm_lms_norm_init_q15.c | 0 .../arm_lms_norm_init_q31.c | 0 .../FilteringFunctions/arm_lms_norm_q15.c | 0 .../FilteringFunctions/arm_lms_norm_q31.c | 0 .../Source/FilteringFunctions/arm_lms_q15.c | 0 .../Source/FilteringFunctions/arm_lms_q31.c | 0 .../Source/MatrixFunctions/arm_mat_add_f32.c | 0 .../Source/MatrixFunctions/arm_mat_add_q15.c | 0 .../Source/MatrixFunctions/arm_mat_add_q31.c | 0 .../Source/MatrixFunctions/arm_mat_init_f32.c | 0 .../Source/MatrixFunctions/arm_mat_init_q15.c | 0 .../Source/MatrixFunctions/arm_mat_init_q31.c | 0 .../MatrixFunctions/arm_mat_inverse_f32.c | 0 .../Source/MatrixFunctions/arm_mat_mult_f32.c | 0 .../MatrixFunctions/arm_mat_mult_fast_q15.c | 0 .../MatrixFunctions/arm_mat_mult_fast_q31.c | 0 .../Source/MatrixFunctions/arm_mat_mult_q15.c | 0 .../Source/MatrixFunctions/arm_mat_mult_q31.c | 0 .../MatrixFunctions/arm_mat_scale_f32.c | 0 .../MatrixFunctions/arm_mat_scale_q15.c | 0 .../MatrixFunctions/arm_mat_scale_q31.c | 0 .../Source/MatrixFunctions/arm_mat_sub_f32.c | 0 .../Source/MatrixFunctions/arm_mat_sub_q15.c | 0 .../Source/MatrixFunctions/arm_mat_sub_q31.c | 0 .../MatrixFunctions/arm_mat_trans_f32.c | 0 .../MatrixFunctions/arm_mat_trans_q15.c | 0 .../MatrixFunctions/arm_mat_trans_q31.c | 0 .../Source/StatisticsFunctions/arm_max_f32.c | 0 .../Source/StatisticsFunctions/arm_max_q15.c | 0 .../Source/StatisticsFunctions/arm_max_q31.c | 0 .../Source/StatisticsFunctions/arm_max_q7.c | 0 .../Source/StatisticsFunctions/arm_mean_f32.c | 0 .../Source/StatisticsFunctions/arm_mean_q15.c | 0 .../Source/StatisticsFunctions/arm_mean_q31.c | 0 .../Source/StatisticsFunctions/arm_mean_q7.c | 0 .../Source/StatisticsFunctions/arm_min_f32.c | 0 .../Source/StatisticsFunctions/arm_min_q15.c | 0 .../Source/StatisticsFunctions/arm_min_q31.c | 0 .../Source/StatisticsFunctions/arm_min_q7.c | 0 .../StatisticsFunctions/arm_power_f32.c | 0 .../StatisticsFunctions/arm_power_q15.c | 0 .../StatisticsFunctions/arm_power_q31.c | 0 .../Source/StatisticsFunctions/arm_power_q7.c | 0 .../Source/StatisticsFunctions/arm_rms_f32.c | 0 .../Source/StatisticsFunctions/arm_rms_q15.c | 0 .../Source/StatisticsFunctions/arm_rms_q31.c | 0 .../Source/StatisticsFunctions/arm_std_f32.c | 0 .../Source/StatisticsFunctions/arm_std_q15.c | 0 .../Source/StatisticsFunctions/arm_std_q31.c | 0 .../Source/StatisticsFunctions/arm_var_f32.c | 0 .../Source/StatisticsFunctions/arm_var_q15.c | 0 .../Source/StatisticsFunctions/arm_var_q31.c | 0 .../Source/SupportFunctions/arm_copy_f32.c | 0 .../Source/SupportFunctions/arm_copy_q15.c | 0 .../Source/SupportFunctions/arm_copy_q31.c | 0 .../Source/SupportFunctions/arm_copy_q7.c | 0 .../Source/SupportFunctions/arm_fill_f32.c | 0 .../Source/SupportFunctions/arm_fill_q15.c | 0 .../Source/SupportFunctions/arm_fill_q31.c | 0 .../Source/SupportFunctions/arm_fill_q7.c | 0 .../SupportFunctions/arm_float_to_q15.c | 0 .../SupportFunctions/arm_float_to_q31.c | 0 .../Source/SupportFunctions/arm_float_to_q7.c | 0 .../SupportFunctions/arm_q15_to_float.c | 0 .../Source/SupportFunctions/arm_q15_to_q31.c | 0 .../Source/SupportFunctions/arm_q15_to_q7.c | 0 .../SupportFunctions/arm_q31_to_float.c | 0 .../Source/SupportFunctions/arm_q31_to_q15.c | 0 .../Source/SupportFunctions/arm_q31_to_q7.c | 0 .../Source/SupportFunctions/arm_q7_to_float.c | 0 .../Source/SupportFunctions/arm_q7_to_q15.c | 0 .../Source/SupportFunctions/arm_q7_to_q31.c | 0 .../TransformFunctions/arm_bitreversal.c | 0 .../TransformFunctions/arm_cfft_radix2_f32.c | 0 .../arm_cfft_radix2_init_f32.c | 0 .../arm_cfft_radix2_init_q15.c | 0 .../arm_cfft_radix2_init_q31.c | 0 .../TransformFunctions/arm_cfft_radix2_q15.c | 0 .../TransformFunctions/arm_cfft_radix2_q31.c | 0 .../TransformFunctions/arm_cfft_radix4_f32.c | 0 .../arm_cfft_radix4_init_f32.c | 0 .../arm_cfft_radix4_init_q15.c | 0 .../arm_cfft_radix4_init_q31.c | 0 .../TransformFunctions/arm_cfft_radix4_q15.c | 0 .../TransformFunctions/arm_cfft_radix4_q31.c | 0 .../Source/TransformFunctions/arm_dct4_f32.c | 0 .../TransformFunctions/arm_dct4_init_f32.c | 0 .../TransformFunctions/arm_dct4_init_q15.c | 0 .../TransformFunctions/arm_dct4_init_q31.c | 0 .../Source/TransformFunctions/arm_dct4_q15.c | 0 .../Source/TransformFunctions/arm_dct4_q31.c | 0 .../Source/TransformFunctions/arm_rfft_f32.c | 0 .../TransformFunctions/arm_rfft_init_f32.c | 0 .../TransformFunctions/arm_rfft_init_q15.c | 0 .../TransformFunctions/arm_rfft_init_q31.c | 0 .../Source/TransformFunctions/arm_rfft_q15.c | 0 .../Source/TransformFunctions/arm_rfft_q31.c | 0 .../CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h | 0 .../CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h | 0 .../mathlib/CMSIS/Include/arm_common_tables.h | 0 .../modules}/mathlib/CMSIS/Include/arm_math.h | 0 .../modules}/mathlib/CMSIS/Include/core_cm3.h | 0 .../modules}/mathlib/CMSIS/Include/core_cm4.h | 0 .../mathlib/CMSIS/Include/core_cm4_simd.h | 0 .../mathlib/CMSIS/Include/core_cmFunc.h | 0 .../mathlib/CMSIS/Include/core_cmInstr.h | 0 .../modules/mathlib/CMSIS/module.mk | 10 +- {apps => src/modules}/mathlib/math/Dcm.cpp | 2 +- {apps => src/modules}/mathlib/math/Dcm.hpp | 0 .../modules}/mathlib/math/EulerAngles.cpp | 2 +- .../modules}/mathlib/math/EulerAngles.hpp | 0 {apps => src/modules}/mathlib/math/Matrix.cpp | 2 +- {apps => src/modules}/mathlib/math/Matrix.hpp | 0 .../modules}/mathlib/math/Quaternion.cpp | 2 +- .../modules}/mathlib/math/Quaternion.hpp | 0 {apps => src/modules}/mathlib/math/Vector.cpp | 2 +- {apps => src/modules}/mathlib/math/Vector.hpp | 0 .../modules}/mathlib/math/Vector3.cpp | 2 +- .../modules}/mathlib/math/Vector3.hpp | 0 .../modules}/mathlib/math/arm/Matrix.cpp | 0 .../modules}/mathlib/math/arm/Matrix.hpp | 0 .../modules}/mathlib/math/arm/Vector.cpp | 0 .../modules}/mathlib/math/arm/Vector.hpp | 0 .../modules}/mathlib/math/generic/Matrix.cpp | 0 .../modules}/mathlib/math/generic/Matrix.hpp | 0 .../modules}/mathlib/math/generic/Vector.cpp | 0 .../modules}/mathlib/math/generic/Vector.hpp | 0 .../mathlib/math/nasa_rotation_def.pdf | Bin .../modules}/mathlib/math/test/test.cpp | 1 + .../modules}/mathlib/math/test/test.hpp | 6 +- .../modules}/mathlib/math/test_math.sce | 0 {apps => src/modules}/mathlib/mathlib.h | 0 .../Makefile => src/modules/mathlib/module.mk | 16 +- src/modules/px4iofirmware/hx_stream.c | 250 -------------- src/modules/px4iofirmware/hx_stream.h | 122 ------- src/modules/px4iofirmware/module.mk | 18 +- src/modules/px4iofirmware/perf_counter.c | 317 ------------------ src/modules/px4iofirmware/perf_counter.h | 128 ------- src/modules/px4iofirmware/up_cxxinitialize.c | 150 --------- {apps => src/modules}/systemlib/airspeed.c | 0 {apps => src/modules}/systemlib/airspeed.h | 0 .../modules}/systemlib/bson/tinybson.c | 2 +- .../modules}/systemlib/bson/tinybson.h | 0 {apps => src/modules}/systemlib/conversions.c | 0 {apps => src/modules}/systemlib/conversions.h | 0 {apps => src/modules}/systemlib/cpuload.c | 0 {apps => src/modules}/systemlib/cpuload.h | 0 {apps => src/modules}/systemlib/err.c | 0 {apps => src/modules}/systemlib/err.h | 0 {apps => src/modules}/systemlib/geo/geo.c | 0 {apps => src/modules}/systemlib/geo/geo.h | 0 {apps => src/modules}/systemlib/getopt_long.c | 0 {apps => src/modules}/systemlib/getopt_long.h | 0 {apps => src/modules}/systemlib/hx_stream.c | 0 {apps => src/modules}/systemlib/hx_stream.h | 0 .../modules}/systemlib/mixer/mixer.cpp | 0 {apps => src/modules}/systemlib/mixer/mixer.h | 0 .../modules}/systemlib/mixer/mixer_group.cpp | 0 .../systemlib/mixer/mixer_multirotor.cpp | 0 .../modules}/systemlib/mixer/mixer_simple.cpp | 0 .../modules/systemlib/mixer/module.mk | 7 +- .../modules}/systemlib/mixer/multi_tables | 0 .../modules/systemlib/module.mk | 4 +- {apps => src/modules}/systemlib/param/param.c | 2 +- {apps => src/modules}/systemlib/param/param.h | 0 .../modules}/systemlib/perf_counter.c | 0 .../modules}/systemlib/perf_counter.h | 0 {apps => src/modules}/systemlib/pid/pid.c | 0 {apps => src/modules}/systemlib/pid/pid.h | 0 {apps => src/modules}/systemlib/ppm_decode.c | 0 {apps => src/modules}/systemlib/ppm_decode.h | 0 .../systemlib/scheduling_priorities.h | 0 {apps => src/modules}/systemlib/systemlib.c | 0 {apps => src/modules}/systemlib/systemlib.h | 0 .../modules}/systemlib/up_cxxinitialize.c | 0 .../systemlib/uthash/doc/userguide.txt | 0 .../modules}/systemlib/uthash/doc/utarray.txt | 0 .../modules}/systemlib/uthash/doc/utlist.txt | 0 .../systemlib/uthash/doc/utstring.txt | 0 .../modules}/systemlib/uthash/utarray.h | 0 .../modules}/systemlib/uthash/uthash.h | 0 .../modules}/systemlib/uthash/utlist.h | 0 .../modules}/systemlib/uthash/utstring.h | 0 {apps => src/modules}/systemlib/visibility.h | 0 {apps => src/modules}/uORB/.context | 0 .../Makefile => src/modules/uORB/module.mk | 14 +- {apps => src/modules}/uORB/objects_common.cpp | 0 .../modules}/uORB/topics/actuator_controls.h | 0 .../uORB/topics/actuator_controls_effective.h | 0 .../modules}/uORB/topics/actuator_outputs.h | 0 .../modules}/uORB/topics/battery_status.h | 0 .../modules}/uORB/topics/debug_key_value.h | 0 .../uORB/topics/differential_pressure.h | 0 .../modules}/uORB/topics/home_position.h | 0 .../uORB/topics/manual_control_setpoint.h | 0 .../uORB/topics/offboard_control_setpoint.h | 0 .../uORB/topics/omnidirectional_flow.h | 0 .../modules}/uORB/topics/optical_flow.h | 0 .../modules}/uORB/topics/parameter_update.h | 0 .../modules}/uORB/topics/rc_channels.h | 0 .../modules}/uORB/topics/sensor_combined.h | 0 .../modules}/uORB/topics/subsystem_info.h | 0 .../modules}/uORB/topics/vehicle_attitude.h | 0 .../uORB/topics/vehicle_attitude_setpoint.h | 0 .../modules}/uORB/topics/vehicle_command.h | 0 .../uORB/topics/vehicle_global_position.h | 0 .../vehicle_global_position_set_triplet.h | 0 .../topics/vehicle_global_position_setpoint.h | 0 .../uORB/topics/vehicle_gps_position.h | 0 .../uORB/topics/vehicle_local_position.h | 0 .../topics/vehicle_local_position_setpoint.h | 0 .../uORB/topics/vehicle_rates_setpoint.h | 0 .../modules}/uORB/topics/vehicle_status.h | 0 .../uORB/topics/vehicle_vicon_position.h | 0 {apps => src/modules}/uORB/uORB.cpp | 0 {apps => src/modules}/uORB/uORB.h | 0 423 files changed, 89 insertions(+), 1024 deletions(-) rename {apps => src}/drivers/device/cdev.cpp (100%) rename {apps => src}/drivers/device/device.cpp (100%) rename {apps => src}/drivers/device/device.h (100%) rename {apps => src}/drivers/device/i2c.cpp (100%) rename {apps => src}/drivers/device/i2c.h (100%) rename apps/drivers/device/Makefile => src/drivers/device/module.mk (91%) rename {apps => src}/drivers/device/pio.cpp (100%) rename {apps => src}/drivers/device/spi.cpp (100%) rename {apps => src}/drivers/device/spi.h (100%) rename {apps => src}/drivers/drv_accel.h (100%) rename {apps => src}/drivers/drv_adc.h (100%) rename {apps => src}/drivers/drv_baro.h (100%) rename {apps => src}/drivers/drv_blinkm.h (100%) rename {apps => src}/drivers/drv_gpio.h (100%) rename {apps => src}/drivers/drv_gps.h (100%) rename {apps => src}/drivers/drv_gyro.h (100%) rename {apps => src}/drivers/drv_hrt.h (100%) rename {apps => src}/drivers/drv_led.h (100%) rename {apps => src}/drivers/drv_mag.h (100%) rename {apps => src}/drivers/drv_mixer.h (100%) rename {apps => src}/drivers/drv_orb_dev.h (98%) rename {apps => src}/drivers/drv_pwm_output.h (100%) rename {apps => src}/drivers/drv_range_finder.h (100%) rename {apps => src}/drivers/drv_rc_input.h (100%) rename {apps => src}/drivers/drv_sensor.h (100%) rename {apps => src}/drivers/drv_tone_alarm.h (100%) rename {apps => src}/drivers/led/Makefile (100%) rename {apps => src}/drivers/led/led.cpp (100%) rename {apps => src}/examples/math_demo/math_demo.cpp (95%) rename apps/uORB/Makefile => src/examples/math_demo/module.mk (89%) rename {apps => src/modules}/controllib/block/Block.cpp (100%) rename {apps => src/modules}/controllib/block/Block.hpp (100%) rename {apps => src/modules}/controllib/block/BlockParam.cpp (100%) rename {apps => src/modules}/controllib/block/BlockParam.hpp (100%) rename {apps => src/modules}/controllib/block/List.hpp (100%) rename {apps => src/modules}/controllib/block/UOrbPublication.cpp (100%) rename {apps => src/modules}/controllib/block/UOrbPublication.hpp (100%) rename {apps => src/modules}/controllib/block/UOrbSubscription.cpp (100%) rename {apps => src/modules}/controllib/block/UOrbSubscription.hpp (100%) rename {apps => src/modules}/controllib/blocks.cpp (100%) rename {apps => src/modules}/controllib/blocks.hpp (100%) rename {apps => src/modules}/controllib/fixedwing.cpp (100%) rename {apps => src/modules}/controllib/fixedwing.hpp (100%) rename apps/controllib/Makefile => src/modules/controllib/module.mk (92%) rename {apps => src/modules}/controllib/test_params.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c (100%) rename {apps => src/modules}/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c (100%) rename {apps => src/modules}/mathlib/CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/arm_common_tables.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/arm_math.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/core_cm3.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/core_cm4.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/core_cm4_simd.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/core_cmFunc.h (100%) rename {apps => src/modules}/mathlib/CMSIS/Include/core_cmInstr.h (100%) rename apps/mathlib/CMSIS/Makefile => src/modules/mathlib/CMSIS/module.mk (89%) rename {apps => src/modules}/mathlib/math/Dcm.cpp (99%) rename {apps => src/modules}/mathlib/math/Dcm.hpp (100%) rename {apps => src/modules}/mathlib/math/EulerAngles.cpp (99%) rename {apps => src/modules}/mathlib/math/EulerAngles.hpp (100%) rename {apps => src/modules}/mathlib/math/Matrix.cpp (99%) rename {apps => src/modules}/mathlib/math/Matrix.hpp (100%) rename {apps => src/modules}/mathlib/math/Quaternion.cpp (99%) rename {apps => src/modules}/mathlib/math/Quaternion.hpp (100%) rename {apps => src/modules}/mathlib/math/Vector.cpp (98%) rename {apps => src/modules}/mathlib/math/Vector.hpp (100%) rename {apps => src/modules}/mathlib/math/Vector3.cpp (98%) rename {apps => src/modules}/mathlib/math/Vector3.hpp (100%) rename {apps => src/modules}/mathlib/math/arm/Matrix.cpp (100%) rename {apps => src/modules}/mathlib/math/arm/Matrix.hpp (100%) rename {apps => src/modules}/mathlib/math/arm/Vector.cpp (100%) rename {apps => src/modules}/mathlib/math/arm/Vector.hpp (100%) rename {apps => src/modules}/mathlib/math/generic/Matrix.cpp (100%) rename {apps => src/modules}/mathlib/math/generic/Matrix.hpp (100%) rename {apps => src/modules}/mathlib/math/generic/Vector.cpp (100%) rename {apps => src/modules}/mathlib/math/generic/Vector.hpp (100%) rename {apps => src/modules}/mathlib/math/nasa_rotation_def.pdf (100%) rename {apps => src/modules}/mathlib/math/test/test.cpp (99%) rename {apps => src/modules}/mathlib/math/test/test.hpp (96%) rename {apps => src/modules}/mathlib/math/test_math.sce (100%) rename {apps => src/modules}/mathlib/mathlib.h (100%) rename apps/mathlib/Makefile => src/modules/mathlib/module.mk (88%) delete mode 100644 src/modules/px4iofirmware/hx_stream.c delete mode 100644 src/modules/px4iofirmware/hx_stream.h delete mode 100644 src/modules/px4iofirmware/perf_counter.c delete mode 100644 src/modules/px4iofirmware/perf_counter.h delete mode 100644 src/modules/px4iofirmware/up_cxxinitialize.c rename {apps => src/modules}/systemlib/airspeed.c (100%) rename {apps => src/modules}/systemlib/airspeed.h (100%) rename {apps => src/modules}/systemlib/bson/tinybson.c (99%) rename {apps => src/modules}/systemlib/bson/tinybson.h (100%) rename {apps => src/modules}/systemlib/conversions.c (100%) rename {apps => src/modules}/systemlib/conversions.h (100%) rename {apps => src/modules}/systemlib/cpuload.c (100%) rename {apps => src/modules}/systemlib/cpuload.h (100%) rename {apps => src/modules}/systemlib/err.c (100%) rename {apps => src/modules}/systemlib/err.h (100%) rename {apps => src/modules}/systemlib/geo/geo.c (100%) rename {apps => src/modules}/systemlib/geo/geo.h (100%) rename {apps => src/modules}/systemlib/getopt_long.c (100%) rename {apps => src/modules}/systemlib/getopt_long.h (100%) rename {apps => src/modules}/systemlib/hx_stream.c (100%) rename {apps => src/modules}/systemlib/hx_stream.h (100%) rename {apps => src/modules}/systemlib/mixer/mixer.cpp (100%) rename {apps => src/modules}/systemlib/mixer/mixer.h (100%) rename {apps => src/modules}/systemlib/mixer/mixer_group.cpp (100%) rename {apps => src/modules}/systemlib/mixer/mixer_multirotor.cpp (100%) rename {apps => src/modules}/systemlib/mixer/mixer_simple.cpp (100%) rename apps/systemlib/mixer/Makefile => src/modules/systemlib/mixer/module.mk (91%) rename {apps => src/modules}/systemlib/mixer/multi_tables (100%) rename apps/systemlib/Makefile => src/modules/systemlib/module.mk (97%) rename {apps => src/modules}/systemlib/param/param.c (99%) rename {apps => src/modules}/systemlib/param/param.h (100%) rename {apps => src/modules}/systemlib/perf_counter.c (100%) rename {apps => src/modules}/systemlib/perf_counter.h (100%) rename {apps => src/modules}/systemlib/pid/pid.c (100%) rename {apps => src/modules}/systemlib/pid/pid.h (100%) rename {apps => src/modules}/systemlib/ppm_decode.c (100%) rename {apps => src/modules}/systemlib/ppm_decode.h (100%) rename {apps => src/modules}/systemlib/scheduling_priorities.h (100%) rename {apps => src/modules}/systemlib/systemlib.c (100%) rename {apps => src/modules}/systemlib/systemlib.h (100%) rename {apps => src/modules}/systemlib/up_cxxinitialize.c (100%) rename {apps => src/modules}/systemlib/uthash/doc/userguide.txt (100%) rename {apps => src/modules}/systemlib/uthash/doc/utarray.txt (100%) rename {apps => src/modules}/systemlib/uthash/doc/utlist.txt (100%) rename {apps => src/modules}/systemlib/uthash/doc/utstring.txt (100%) rename {apps => src/modules}/systemlib/uthash/utarray.h (100%) rename {apps => src/modules}/systemlib/uthash/uthash.h (100%) rename {apps => src/modules}/systemlib/uthash/utlist.h (100%) rename {apps => src/modules}/systemlib/uthash/utstring.h (100%) rename {apps => src/modules}/systemlib/visibility.h (100%) rename {apps => src/modules}/uORB/.context (100%) rename apps/examples/math_demo/Makefile => src/modules/uORB/module.mk (87%) rename {apps => src/modules}/uORB/objects_common.cpp (100%) rename {apps => src/modules}/uORB/topics/actuator_controls.h (100%) rename {apps => src/modules}/uORB/topics/actuator_controls_effective.h (100%) rename {apps => src/modules}/uORB/topics/actuator_outputs.h (100%) rename {apps => src/modules}/uORB/topics/battery_status.h (100%) rename {apps => src/modules}/uORB/topics/debug_key_value.h (100%) rename {apps => src/modules}/uORB/topics/differential_pressure.h (100%) rename {apps => src/modules}/uORB/topics/home_position.h (100%) rename {apps => src/modules}/uORB/topics/manual_control_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/offboard_control_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/omnidirectional_flow.h (100%) rename {apps => src/modules}/uORB/topics/optical_flow.h (100%) rename {apps => src/modules}/uORB/topics/parameter_update.h (100%) rename {apps => src/modules}/uORB/topics/rc_channels.h (100%) rename {apps => src/modules}/uORB/topics/sensor_combined.h (100%) rename {apps => src/modules}/uORB/topics/subsystem_info.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_attitude.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_attitude_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_command.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_global_position.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_global_position_set_triplet.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_global_position_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_gps_position.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_local_position.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_local_position_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_rates_setpoint.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_status.h (100%) rename {apps => src/modules}/uORB/topics/vehicle_vicon_position.h (100%) rename {apps => src/modules}/uORB/uORB.cpp (100%) rename {apps => src/modules}/uORB/uORB.h (100%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 47e15b3444..bc3031cd67 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -10,6 +10,7 @@ ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common # # Board support modules # +MODULES += drivers/device MODULES += drivers/stm32 MODULES += drivers/stm32/adc MODULES += drivers/stm32/tone_alarm @@ -74,6 +75,21 @@ MODULES += modules/multirotor_pos_control # MODULES += modules/sdlog +# +# Libraries +# +MODULES += modules/systemlib +MODULES += modules/systemlib/mixer +MODULES += modules/mathlib +MODULES += modules/mathlib/CMSIS +MODULES += modules/controllib +MODULES += modules/uORB + +# +# Demo apps +# +MODULES += examples/math_demo + # # Transitional support - add commands from the NuttX export archive. # diff --git a/makefiles/module.mk b/makefiles/module.mk index 253b3cd524..86810627b2 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -186,7 +186,7 @@ define SRC_SEARCH $(abspath $(firstword $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) endef -ABS_SRCS := $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) +ABS_SRCS ?= $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) ifneq ($(MISSING_SRCS),) $(error $(MODULE_MK): missing in SRCS: $(MISSING_SRCS)) diff --git a/makefiles/setup.mk b/makefiles/setup.mk index b798f7cabe..3c910bcfaa 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -56,6 +56,7 @@ export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/ # Default include paths # export INCLUDE_DIRS := $(PX4_MODULE_SRC) \ + $(PX4_MODULE_SRC)/modules/ \ $(PX4_INCLUDE_DIR) # Include from legacy app/library path diff --git a/apps/drivers/device/cdev.cpp b/src/drivers/device/cdev.cpp similarity index 100% rename from apps/drivers/device/cdev.cpp rename to src/drivers/device/cdev.cpp diff --git a/apps/drivers/device/device.cpp b/src/drivers/device/device.cpp similarity index 100% rename from apps/drivers/device/device.cpp rename to src/drivers/device/device.cpp diff --git a/apps/drivers/device/device.h b/src/drivers/device/device.h similarity index 100% rename from apps/drivers/device/device.h rename to src/drivers/device/device.h diff --git a/apps/drivers/device/i2c.cpp b/src/drivers/device/i2c.cpp similarity index 100% rename from apps/drivers/device/i2c.cpp rename to src/drivers/device/i2c.cpp diff --git a/apps/drivers/device/i2c.h b/src/drivers/device/i2c.h similarity index 100% rename from apps/drivers/device/i2c.h rename to src/drivers/device/i2c.h diff --git a/apps/drivers/device/Makefile b/src/drivers/device/module.mk similarity index 91% rename from apps/drivers/device/Makefile rename to src/drivers/device/module.mk index f7b1fff888..8c716d9cdb 100644 --- a/apps/drivers/device/Makefile +++ b/src/drivers/device/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,4 +35,8 @@ # Build the device driver framework. # -include $(APPDIR)/mk/app.mk +SRCS = cdev.cpp \ + device.cpp \ + i2c.cpp \ + pio.cpp \ + spi.cpp diff --git a/apps/drivers/device/pio.cpp b/src/drivers/device/pio.cpp similarity index 100% rename from apps/drivers/device/pio.cpp rename to src/drivers/device/pio.cpp diff --git a/apps/drivers/device/spi.cpp b/src/drivers/device/spi.cpp similarity index 100% rename from apps/drivers/device/spi.cpp rename to src/drivers/device/spi.cpp diff --git a/apps/drivers/device/spi.h b/src/drivers/device/spi.h similarity index 100% rename from apps/drivers/device/spi.h rename to src/drivers/device/spi.h diff --git a/apps/drivers/drv_accel.h b/src/drivers/drv_accel.h similarity index 100% rename from apps/drivers/drv_accel.h rename to src/drivers/drv_accel.h diff --git a/apps/drivers/drv_adc.h b/src/drivers/drv_adc.h similarity index 100% rename from apps/drivers/drv_adc.h rename to src/drivers/drv_adc.h diff --git a/apps/drivers/drv_baro.h b/src/drivers/drv_baro.h similarity index 100% rename from apps/drivers/drv_baro.h rename to src/drivers/drv_baro.h diff --git a/apps/drivers/drv_blinkm.h b/src/drivers/drv_blinkm.h similarity index 100% rename from apps/drivers/drv_blinkm.h rename to src/drivers/drv_blinkm.h diff --git a/apps/drivers/drv_gpio.h b/src/drivers/drv_gpio.h similarity index 100% rename from apps/drivers/drv_gpio.h rename to src/drivers/drv_gpio.h diff --git a/apps/drivers/drv_gps.h b/src/drivers/drv_gps.h similarity index 100% rename from apps/drivers/drv_gps.h rename to src/drivers/drv_gps.h diff --git a/apps/drivers/drv_gyro.h b/src/drivers/drv_gyro.h similarity index 100% rename from apps/drivers/drv_gyro.h rename to src/drivers/drv_gyro.h diff --git a/apps/drivers/drv_hrt.h b/src/drivers/drv_hrt.h similarity index 100% rename from apps/drivers/drv_hrt.h rename to src/drivers/drv_hrt.h diff --git a/apps/drivers/drv_led.h b/src/drivers/drv_led.h similarity index 100% rename from apps/drivers/drv_led.h rename to src/drivers/drv_led.h diff --git a/apps/drivers/drv_mag.h b/src/drivers/drv_mag.h similarity index 100% rename from apps/drivers/drv_mag.h rename to src/drivers/drv_mag.h diff --git a/apps/drivers/drv_mixer.h b/src/drivers/drv_mixer.h similarity index 100% rename from apps/drivers/drv_mixer.h rename to src/drivers/drv_mixer.h diff --git a/apps/drivers/drv_orb_dev.h b/src/drivers/drv_orb_dev.h similarity index 98% rename from apps/drivers/drv_orb_dev.h rename to src/drivers/drv_orb_dev.h index 8495780d56..713618545d 100644 --- a/apps/drivers/drv_orb_dev.h +++ b/src/drivers/drv_orb_dev.h @@ -43,7 +43,7 @@ #include /* XXX for ORB_DECLARE used in many drivers */ -#include "../uORB/uORB.h" +#include "../modules/uORB/uORB.h" /* * ioctl() definitions diff --git a/apps/drivers/drv_pwm_output.h b/src/drivers/drv_pwm_output.h similarity index 100% rename from apps/drivers/drv_pwm_output.h rename to src/drivers/drv_pwm_output.h diff --git a/apps/drivers/drv_range_finder.h b/src/drivers/drv_range_finder.h similarity index 100% rename from apps/drivers/drv_range_finder.h rename to src/drivers/drv_range_finder.h diff --git a/apps/drivers/drv_rc_input.h b/src/drivers/drv_rc_input.h similarity index 100% rename from apps/drivers/drv_rc_input.h rename to src/drivers/drv_rc_input.h diff --git a/apps/drivers/drv_sensor.h b/src/drivers/drv_sensor.h similarity index 100% rename from apps/drivers/drv_sensor.h rename to src/drivers/drv_sensor.h diff --git a/apps/drivers/drv_tone_alarm.h b/src/drivers/drv_tone_alarm.h similarity index 100% rename from apps/drivers/drv_tone_alarm.h rename to src/drivers/drv_tone_alarm.h diff --git a/apps/drivers/led/Makefile b/src/drivers/led/Makefile similarity index 100% rename from apps/drivers/led/Makefile rename to src/drivers/led/Makefile diff --git a/apps/drivers/led/led.cpp b/src/drivers/led/led.cpp similarity index 100% rename from apps/drivers/led/led.cpp rename to src/drivers/led/led.cpp diff --git a/apps/examples/math_demo/math_demo.cpp b/src/examples/math_demo/math_demo.cpp similarity index 95% rename from apps/examples/math_demo/math_demo.cpp rename to src/examples/math_demo/math_demo.cpp index a9c5567480..36d3c2e849 100644 --- a/apps/examples/math_demo/math_demo.cpp +++ b/src/examples/math_demo/math_demo.cpp @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Example User + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: James Goppert * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ /** * @file math_demo.cpp + * @author James Goppert * Demonstration of math library */ diff --git a/apps/uORB/Makefile b/src/examples/math_demo/module.mk similarity index 89% rename from apps/uORB/Makefile rename to src/examples/math_demo/module.mk index 64ba52e9c5..deba13fd08 100644 --- a/apps/uORB/Makefile +++ b/src/examples/math_demo/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,10 @@ ############################################################################ # -# Makefile to build uORB +# Mathlib / operations demo application # -APPNAME = uorb -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = math_demo +MODULE_STACKSIZE = 12000 -include $(APPDIR)/mk/app.mk +SRCS = math_demo.cpp diff --git a/apps/controllib/block/Block.cpp b/src/modules/controllib/block/Block.cpp similarity index 100% rename from apps/controllib/block/Block.cpp rename to src/modules/controllib/block/Block.cpp diff --git a/apps/controllib/block/Block.hpp b/src/modules/controllib/block/Block.hpp similarity index 100% rename from apps/controllib/block/Block.hpp rename to src/modules/controllib/block/Block.hpp diff --git a/apps/controllib/block/BlockParam.cpp b/src/modules/controllib/block/BlockParam.cpp similarity index 100% rename from apps/controllib/block/BlockParam.cpp rename to src/modules/controllib/block/BlockParam.cpp diff --git a/apps/controllib/block/BlockParam.hpp b/src/modules/controllib/block/BlockParam.hpp similarity index 100% rename from apps/controllib/block/BlockParam.hpp rename to src/modules/controllib/block/BlockParam.hpp diff --git a/apps/controllib/block/List.hpp b/src/modules/controllib/block/List.hpp similarity index 100% rename from apps/controllib/block/List.hpp rename to src/modules/controllib/block/List.hpp diff --git a/apps/controllib/block/UOrbPublication.cpp b/src/modules/controllib/block/UOrbPublication.cpp similarity index 100% rename from apps/controllib/block/UOrbPublication.cpp rename to src/modules/controllib/block/UOrbPublication.cpp diff --git a/apps/controllib/block/UOrbPublication.hpp b/src/modules/controllib/block/UOrbPublication.hpp similarity index 100% rename from apps/controllib/block/UOrbPublication.hpp rename to src/modules/controllib/block/UOrbPublication.hpp diff --git a/apps/controllib/block/UOrbSubscription.cpp b/src/modules/controllib/block/UOrbSubscription.cpp similarity index 100% rename from apps/controllib/block/UOrbSubscription.cpp rename to src/modules/controllib/block/UOrbSubscription.cpp diff --git a/apps/controllib/block/UOrbSubscription.hpp b/src/modules/controllib/block/UOrbSubscription.hpp similarity index 100% rename from apps/controllib/block/UOrbSubscription.hpp rename to src/modules/controllib/block/UOrbSubscription.hpp diff --git a/apps/controllib/blocks.cpp b/src/modules/controllib/blocks.cpp similarity index 100% rename from apps/controllib/blocks.cpp rename to src/modules/controllib/blocks.cpp diff --git a/apps/controllib/blocks.hpp b/src/modules/controllib/blocks.hpp similarity index 100% rename from apps/controllib/blocks.hpp rename to src/modules/controllib/blocks.hpp diff --git a/apps/controllib/fixedwing.cpp b/src/modules/controllib/fixedwing.cpp similarity index 100% rename from apps/controllib/fixedwing.cpp rename to src/modules/controllib/fixedwing.cpp diff --git a/apps/controllib/fixedwing.hpp b/src/modules/controllib/fixedwing.hpp similarity index 100% rename from apps/controllib/fixedwing.hpp rename to src/modules/controllib/fixedwing.hpp diff --git a/apps/controllib/Makefile b/src/modules/controllib/module.mk similarity index 92% rename from apps/controllib/Makefile rename to src/modules/controllib/module.mk index 6749b805fa..13d1069c7a 100644 --- a/apps/controllib/Makefile +++ b/src/modules/controllib/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -34,13 +34,10 @@ # # Control library # -CSRCS = test_params.c - -CXXSRCS = block/Block.cpp \ +SRCS = test_params.c \ + block/Block.cpp \ block/BlockParam.cpp \ block/UOrbPublication.cpp \ block/UOrbSubscription.cpp \ blocks.cpp \ fixedwing.cpp - -include $(APPDIR)/mk/app.mk diff --git a/apps/controllib/test_params.c b/src/modules/controllib/test_params.c similarity index 100% rename from apps/controllib/test_params.c rename to src/modules/controllib/test_params.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/CommonTables/arm_common_tables.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c diff --git a/apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c b/src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c similarity index 100% rename from apps/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c rename to src/modules/mathlib/CMSIS/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c diff --git a/apps/mathlib/CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h b/src/modules/mathlib/CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h similarity index 100% rename from apps/mathlib/CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h rename to src/modules/mathlib/CMSIS/Device/ARM/ARMCM3/Include/ARMCM3.h diff --git a/apps/mathlib/CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h b/src/modules/mathlib/CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h similarity index 100% rename from apps/mathlib/CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h rename to src/modules/mathlib/CMSIS/Device/ARM/ARMCM4/Include/ARMCM4.h diff --git a/apps/mathlib/CMSIS/Include/arm_common_tables.h b/src/modules/mathlib/CMSIS/Include/arm_common_tables.h similarity index 100% rename from apps/mathlib/CMSIS/Include/arm_common_tables.h rename to src/modules/mathlib/CMSIS/Include/arm_common_tables.h diff --git a/apps/mathlib/CMSIS/Include/arm_math.h b/src/modules/mathlib/CMSIS/Include/arm_math.h similarity index 100% rename from apps/mathlib/CMSIS/Include/arm_math.h rename to src/modules/mathlib/CMSIS/Include/arm_math.h diff --git a/apps/mathlib/CMSIS/Include/core_cm3.h b/src/modules/mathlib/CMSIS/Include/core_cm3.h similarity index 100% rename from apps/mathlib/CMSIS/Include/core_cm3.h rename to src/modules/mathlib/CMSIS/Include/core_cm3.h diff --git a/apps/mathlib/CMSIS/Include/core_cm4.h b/src/modules/mathlib/CMSIS/Include/core_cm4.h similarity index 100% rename from apps/mathlib/CMSIS/Include/core_cm4.h rename to src/modules/mathlib/CMSIS/Include/core_cm4.h diff --git a/apps/mathlib/CMSIS/Include/core_cm4_simd.h b/src/modules/mathlib/CMSIS/Include/core_cm4_simd.h similarity index 100% rename from apps/mathlib/CMSIS/Include/core_cm4_simd.h rename to src/modules/mathlib/CMSIS/Include/core_cm4_simd.h diff --git a/apps/mathlib/CMSIS/Include/core_cmFunc.h b/src/modules/mathlib/CMSIS/Include/core_cmFunc.h similarity index 100% rename from apps/mathlib/CMSIS/Include/core_cmFunc.h rename to src/modules/mathlib/CMSIS/Include/core_cmFunc.h diff --git a/apps/mathlib/CMSIS/Include/core_cmInstr.h b/src/modules/mathlib/CMSIS/Include/core_cmInstr.h similarity index 100% rename from apps/mathlib/CMSIS/Include/core_cmInstr.h rename to src/modules/mathlib/CMSIS/Include/core_cmInstr.h diff --git a/apps/mathlib/CMSIS/Makefile b/src/modules/mathlib/CMSIS/module.mk similarity index 89% rename from apps/mathlib/CMSIS/Makefile rename to src/modules/mathlib/CMSIS/module.mk index 9e28518bc7..c676f32618 100644 --- a/apps/mathlib/CMSIS/Makefile +++ b/src/modules/mathlib/CMSIS/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -38,10 +38,10 @@ # # Find sources # -DSPLIB_SRCDIR := $(dir $(lastword $(MAKEFILE_LIST))) -CSRCS := $(wildcard $(DSPLIB_SRCDIR)/DSP_Lib/Source/*/*.c) +DSPLIB_SRCDIR := $(PX4_MODULE_SRC)/modules/mathlib/CMSIS +ABS_SRCS := $(wildcard $(DSPLIB_SRCDIR)/DSP_Lib/Source/*/*.c) -INCLUDES += $(DSPLIB_SRCDIR)/Include \ +INCLUDE_DIRS += $(DSPLIB_SRCDIR)/Include \ $(DSPLIB_SRCDIR)/Device/ARM/ARMCM4/Include \ $(DSPLIB_SRCDIR)/Device/ARM/ARMCM3/Include @@ -57,5 +57,3 @@ EXTRADEFINES += -Wno-unsuffixed-float-constants \ # have anything we can use to mark exported symbols. # DEFAULT_VISIBILITY = YES - -include $(APPDIR)/mk/app.mk diff --git a/apps/mathlib/math/Dcm.cpp b/src/modules/mathlib/math/Dcm.cpp similarity index 99% rename from apps/mathlib/math/Dcm.cpp rename to src/modules/mathlib/math/Dcm.cpp index df0f09b205..c3742e2886 100644 --- a/apps/mathlib/math/Dcm.cpp +++ b/src/modules/mathlib/math/Dcm.cpp @@ -37,7 +37,7 @@ * math direction cosine matrix */ -#include "math/test/test.hpp" +#include #include "Dcm.hpp" #include "Quaternion.hpp" diff --git a/apps/mathlib/math/Dcm.hpp b/src/modules/mathlib/math/Dcm.hpp similarity index 100% rename from apps/mathlib/math/Dcm.hpp rename to src/modules/mathlib/math/Dcm.hpp diff --git a/apps/mathlib/math/EulerAngles.cpp b/src/modules/mathlib/math/EulerAngles.cpp similarity index 99% rename from apps/mathlib/math/EulerAngles.cpp rename to src/modules/mathlib/math/EulerAngles.cpp index 2e96fef4cb..e733d23bb0 100644 --- a/apps/mathlib/math/EulerAngles.cpp +++ b/src/modules/mathlib/math/EulerAngles.cpp @@ -37,7 +37,7 @@ * math vector */ -#include "math/test/test.hpp" +#include "test/test.hpp" #include "EulerAngles.hpp" #include "Quaternion.hpp" diff --git a/apps/mathlib/math/EulerAngles.hpp b/src/modules/mathlib/math/EulerAngles.hpp similarity index 100% rename from apps/mathlib/math/EulerAngles.hpp rename to src/modules/mathlib/math/EulerAngles.hpp diff --git a/apps/mathlib/math/Matrix.cpp b/src/modules/mathlib/math/Matrix.cpp similarity index 99% rename from apps/mathlib/math/Matrix.cpp rename to src/modules/mathlib/math/Matrix.cpp index 9817323702..ebd1aeda3d 100644 --- a/apps/mathlib/math/Matrix.cpp +++ b/src/modules/mathlib/math/Matrix.cpp @@ -37,7 +37,7 @@ * matrix code */ -#include "math/test/test.hpp" +#include "test/test.hpp" #include #include "Matrix.hpp" diff --git a/apps/mathlib/math/Matrix.hpp b/src/modules/mathlib/math/Matrix.hpp similarity index 100% rename from apps/mathlib/math/Matrix.hpp rename to src/modules/mathlib/math/Matrix.hpp diff --git a/apps/mathlib/math/Quaternion.cpp b/src/modules/mathlib/math/Quaternion.cpp similarity index 99% rename from apps/mathlib/math/Quaternion.cpp rename to src/modules/mathlib/math/Quaternion.cpp index 78481b2868..02fec4ca66 100644 --- a/apps/mathlib/math/Quaternion.cpp +++ b/src/modules/mathlib/math/Quaternion.cpp @@ -37,7 +37,7 @@ * math vector */ -#include "math/test/test.hpp" +#include "test/test.hpp" #include "Quaternion.hpp" diff --git a/apps/mathlib/math/Quaternion.hpp b/src/modules/mathlib/math/Quaternion.hpp similarity index 100% rename from apps/mathlib/math/Quaternion.hpp rename to src/modules/mathlib/math/Quaternion.hpp diff --git a/apps/mathlib/math/Vector.cpp b/src/modules/mathlib/math/Vector.cpp similarity index 98% rename from apps/mathlib/math/Vector.cpp rename to src/modules/mathlib/math/Vector.cpp index d58e719dbc..35158a396c 100644 --- a/apps/mathlib/math/Vector.cpp +++ b/src/modules/mathlib/math/Vector.cpp @@ -37,7 +37,7 @@ * math vector */ -#include "math/test/test.hpp" +#include "test/test.hpp" #include "Vector.hpp" diff --git a/apps/mathlib/math/Vector.hpp b/src/modules/mathlib/math/Vector.hpp similarity index 100% rename from apps/mathlib/math/Vector.hpp rename to src/modules/mathlib/math/Vector.hpp diff --git a/apps/mathlib/math/Vector3.cpp b/src/modules/mathlib/math/Vector3.cpp similarity index 98% rename from apps/mathlib/math/Vector3.cpp rename to src/modules/mathlib/math/Vector3.cpp index 9c57506da3..61fcc442f3 100644 --- a/apps/mathlib/math/Vector3.cpp +++ b/src/modules/mathlib/math/Vector3.cpp @@ -37,7 +37,7 @@ * math vector */ -#include "math/test/test.hpp" +#include "test/test.hpp" #include "Vector3.hpp" diff --git a/apps/mathlib/math/Vector3.hpp b/src/modules/mathlib/math/Vector3.hpp similarity index 100% rename from apps/mathlib/math/Vector3.hpp rename to src/modules/mathlib/math/Vector3.hpp diff --git a/apps/mathlib/math/arm/Matrix.cpp b/src/modules/mathlib/math/arm/Matrix.cpp similarity index 100% rename from apps/mathlib/math/arm/Matrix.cpp rename to src/modules/mathlib/math/arm/Matrix.cpp diff --git a/apps/mathlib/math/arm/Matrix.hpp b/src/modules/mathlib/math/arm/Matrix.hpp similarity index 100% rename from apps/mathlib/math/arm/Matrix.hpp rename to src/modules/mathlib/math/arm/Matrix.hpp diff --git a/apps/mathlib/math/arm/Vector.cpp b/src/modules/mathlib/math/arm/Vector.cpp similarity index 100% rename from apps/mathlib/math/arm/Vector.cpp rename to src/modules/mathlib/math/arm/Vector.cpp diff --git a/apps/mathlib/math/arm/Vector.hpp b/src/modules/mathlib/math/arm/Vector.hpp similarity index 100% rename from apps/mathlib/math/arm/Vector.hpp rename to src/modules/mathlib/math/arm/Vector.hpp diff --git a/apps/mathlib/math/generic/Matrix.cpp b/src/modules/mathlib/math/generic/Matrix.cpp similarity index 100% rename from apps/mathlib/math/generic/Matrix.cpp rename to src/modules/mathlib/math/generic/Matrix.cpp diff --git a/apps/mathlib/math/generic/Matrix.hpp b/src/modules/mathlib/math/generic/Matrix.hpp similarity index 100% rename from apps/mathlib/math/generic/Matrix.hpp rename to src/modules/mathlib/math/generic/Matrix.hpp diff --git a/apps/mathlib/math/generic/Vector.cpp b/src/modules/mathlib/math/generic/Vector.cpp similarity index 100% rename from apps/mathlib/math/generic/Vector.cpp rename to src/modules/mathlib/math/generic/Vector.cpp diff --git a/apps/mathlib/math/generic/Vector.hpp b/src/modules/mathlib/math/generic/Vector.hpp similarity index 100% rename from apps/mathlib/math/generic/Vector.hpp rename to src/modules/mathlib/math/generic/Vector.hpp diff --git a/apps/mathlib/math/nasa_rotation_def.pdf b/src/modules/mathlib/math/nasa_rotation_def.pdf similarity index 100% rename from apps/mathlib/math/nasa_rotation_def.pdf rename to src/modules/mathlib/math/nasa_rotation_def.pdf diff --git a/apps/mathlib/math/test/test.cpp b/src/modules/mathlib/math/test/test.cpp similarity index 99% rename from apps/mathlib/math/test/test.cpp rename to src/modules/mathlib/math/test/test.cpp index f5db76d704..2fa2f7e7c4 100644 --- a/apps/mathlib/math/test/test.cpp +++ b/src/modules/mathlib/math/test/test.cpp @@ -39,6 +39,7 @@ #include #include +#include #include "test.hpp" diff --git a/apps/mathlib/math/test/test.hpp b/src/modules/mathlib/math/test/test.hpp similarity index 96% rename from apps/mathlib/math/test/test.hpp rename to src/modules/mathlib/math/test/test.hpp index 841c421445..2027bb827c 100644 --- a/apps/mathlib/math/test/test.hpp +++ b/src/modules/mathlib/math/test/test.hpp @@ -39,9 +39,9 @@ #pragma once -#include -#include -#include +//#include +//#include +//#include bool equal(float a, float b, float eps = 1e-5); void float2SigExp( diff --git a/apps/mathlib/math/test_math.sce b/src/modules/mathlib/math/test_math.sce similarity index 100% rename from apps/mathlib/math/test_math.sce rename to src/modules/mathlib/math/test_math.sce diff --git a/apps/mathlib/mathlib.h b/src/modules/mathlib/mathlib.h similarity index 100% rename from apps/mathlib/mathlib.h rename to src/modules/mathlib/mathlib.h diff --git a/apps/mathlib/Makefile b/src/modules/mathlib/module.mk similarity index 88% rename from apps/mathlib/Makefile rename to src/modules/mathlib/module.mk index 7eebd6ae0b..bcdb2afe50 100644 --- a/apps/mathlib/Makefile +++ b/src/modules/mathlib/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ # # Math library # -CXXSRCS = math/test/test.cpp \ +SRCS = math/test/test.cpp \ math/Vector.cpp \ math/Vector3.cpp \ math/EulerAngles.cpp \ @@ -50,13 +50,11 @@ APP_MAKEFILE := $(lastword $(MAKEFILE_LIST)) -include $(TOPDIR)/.config ifeq ($(CONFIG_ARCH_CORTEXM4)$(CONFIG_ARCH_FPU),yy) -INCLUDES += math/arm -CXXSRCS += math/arm/Vector.cpp \ +INCLUDE_DIRS += math/arm +SRCS += math/arm/Vector.cpp \ math/arm/Matrix.cpp else -INCLUDES += math/generic -CXXSRCS += math/generic/Vector.cpp \ - math/generic/Matrix.cpp +#INCLUDE_DIRS += math/generic +#SRCS += math/generic/Vector.cpp \ +# math/generic/Matrix.cpp endif - -include $(APPDIR)/mk/app.mk diff --git a/src/modules/px4iofirmware/hx_stream.c b/src/modules/px4iofirmware/hx_stream.c deleted file mode 100644 index 8d77f14a8d..0000000000 --- a/src/modules/px4iofirmware/hx_stream.c +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file hx_stream.c - * - * A simple serial line framing protocol based on HDLC - * with 32-bit CRC protection. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "perf_counter.h" - -#include "hx_stream.h" - - -struct hx_stream { - uint8_t buf[HX_STREAM_MAX_FRAME + 4]; - unsigned frame_bytes; - bool escaped; - bool txerror; - - int fd; - hx_stream_rx_callback callback; - void *callback_arg; - - perf_counter_t pc_tx_frames; - perf_counter_t pc_rx_frames; - perf_counter_t pc_rx_errors; -}; - -/* - * Protocol magic numbers, straight out of HDLC. - */ -#define FBO 0x7e /**< Frame Boundary Octet */ -#define CEO 0x7c /**< Control Escape Octet */ - -static void hx_tx_raw(hx_stream_t stream, uint8_t c); -static void hx_tx_raw(hx_stream_t stream, uint8_t c); -static int hx_rx_frame(hx_stream_t stream); - -static void -hx_tx_raw(hx_stream_t stream, uint8_t c) -{ - if (write(stream->fd, &c, 1) != 1) - stream->txerror = true; -} - -static void -hx_tx_byte(hx_stream_t stream, uint8_t c) -{ - switch (c) { - case FBO: - case CEO: - hx_tx_raw(stream, CEO); - c ^= 0x20; - break; - } - - hx_tx_raw(stream, c); -} - -static int -hx_rx_frame(hx_stream_t stream) -{ - union { - uint8_t b[4]; - uint32_t w; - } u; - unsigned length = stream->frame_bytes; - - /* reset the stream */ - stream->frame_bytes = 0; - stream->escaped = false; - - /* not a real frame - too short */ - if (length < 4) { - if (length > 1) - perf_count(stream->pc_rx_errors); - - return 0; - } - - length -= 4; - - /* compute expected CRC */ - u.w = crc32(&stream->buf[0], length); - - /* compare computed and actual CRC */ - for (unsigned i = 0; i < 4; i++) { - if (u.b[i] != stream->buf[length + i]) { - perf_count(stream->pc_rx_errors); - return 0; - } - } - - /* frame is good */ - perf_count(stream->pc_rx_frames); - stream->callback(stream->callback_arg, &stream->buf[0], length); - return 1; -} - -hx_stream_t -hx_stream_init(int fd, - hx_stream_rx_callback callback, - void *arg) -{ - hx_stream_t stream; - - stream = (hx_stream_t)malloc(sizeof(struct hx_stream)); - - if (stream != NULL) { - memset(stream, 0, sizeof(struct hx_stream)); - stream->fd = fd; - stream->callback = callback; - stream->callback_arg = arg; - } - - return stream; -} - -void -hx_stream_free(hx_stream_t stream) -{ - /* free perf counters (OK if they are NULL) */ - perf_free(stream->pc_tx_frames); - perf_free(stream->pc_rx_frames); - perf_free(stream->pc_rx_errors); - - free(stream); -} - -void -hx_stream_set_counters(hx_stream_t stream, - perf_counter_t tx_frames, - perf_counter_t rx_frames, - perf_counter_t rx_errors) -{ - stream->pc_tx_frames = tx_frames; - stream->pc_rx_frames = rx_frames; - stream->pc_rx_errors = rx_errors; -} - -int -hx_stream_send(hx_stream_t stream, - const void *data, - size_t count) -{ - union { - uint8_t b[4]; - uint32_t w; - } u; - const uint8_t *p = (const uint8_t *)data; - unsigned resid = count; - - if (resid > HX_STREAM_MAX_FRAME) - return -EINVAL; - - /* start the frame */ - hx_tx_raw(stream, FBO); - - /* transmit the data */ - while (resid--) - hx_tx_byte(stream, *p++); - - /* compute the CRC */ - u.w = crc32(data, count); - - /* send the CRC */ - p = &u.b[0]; - resid = 4; - - while (resid--) - hx_tx_byte(stream, *p++); - - /* and the trailing frame separator */ - hx_tx_raw(stream, FBO); - - /* check for transmit error */ - if (stream->txerror) { - stream->txerror = false; - return -EIO; - } - - perf_count(stream->pc_tx_frames); - return 0; -} - -void -hx_stream_rx(hx_stream_t stream, uint8_t c) -{ - /* frame end? */ - if (c == FBO) { - hx_rx_frame(stream); - return; - } - - /* escaped? */ - if (stream->escaped) { - stream->escaped = false; - c ^= 0x20; - - } else if (c == CEO) { - /* now escaped, ignore the byte */ - stream->escaped = true; - return; - } - - /* save for later */ - if (stream->frame_bytes < sizeof(stream->buf)) - stream->buf[stream->frame_bytes++] = c; -} diff --git a/src/modules/px4iofirmware/hx_stream.h b/src/modules/px4iofirmware/hx_stream.h deleted file mode 100644 index 128689953a..0000000000 --- a/src/modules/px4iofirmware/hx_stream.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file hx_stream.h - * - * A simple serial line framing protocol based on HDLC - * with 32-bit CRC protection. - */ - -#ifndef _SYSTEMLIB_HX_STREAM_H -#define _SYSTEMLIB_HX_STREAM_H - -#include - -#include "perf_counter.h" - -struct hx_stream; -typedef struct hx_stream *hx_stream_t; - -#define HX_STREAM_MAX_FRAME 64 - -typedef void (* hx_stream_rx_callback)(void *arg, const void *data, size_t length); - -__BEGIN_DECLS - -/** - * Allocate a new hx_stream object. - * - * @param fd The file handle over which the protocol will - * communicate. - * @param callback Called when a frame is received. - * @param callback_arg Passed to the callback. - * @return A handle to the stream, or NULL if memory could - * not be allocated. - */ -__EXPORT extern hx_stream_t hx_stream_init(int fd, - hx_stream_rx_callback callback, - void *arg); - -/** - * Free a hx_stream object. - * - * @param stream A handle returned from hx_stream_init. - */ -__EXPORT extern void hx_stream_free(hx_stream_t stream); - -/** - * Set performance counters for the stream. - * - * Any counter may be set to NULL to disable counting that datum. - * - * @param tx_frames Counter for transmitted frames. - * @param rx_frames Counter for received frames. - * @param rx_errors Counter for short and corrupt received frames. - */ -__EXPORT extern void hx_stream_set_counters(hx_stream_t stream, - perf_counter_t tx_frames, - perf_counter_t rx_frames, - perf_counter_t rx_errors); - -/** - * Send a frame. - * - * This function will block until all frame bytes are sent if - * the descriptor passed to hx_stream_init is marked blocking, - * otherwise it will return -1 (but may transmit a - * runt frame at the same time). - * - * @todo Handling of non-blocking streams needs to be better. - * - * @param stream A handle returned from hx_stream_init. - * @param data Pointer to the data to send. - * @param count The number of bytes to send. - * @return Zero on success, -errno on error. - */ -__EXPORT extern int hx_stream_send(hx_stream_t stream, - const void *data, - size_t count); - -/** - * Handle a byte from the stream. - * - * @param stream A handle returned from hx_stream_init. - * @param c The character to process. - */ -__EXPORT extern void hx_stream_rx(hx_stream_t stream, - uint8_t c); - -__END_DECLS - -#endif diff --git a/src/modules/px4iofirmware/module.mk b/src/modules/px4iofirmware/module.mk index 085697fbb6..82b8f16d3c 100644 --- a/src/modules/px4iofirmware/module.mk +++ b/src/modules/px4iofirmware/module.mk @@ -1,4 +1,18 @@ -SRCS = adc.c controls.c dsm.c i2c.c mixer.cpp px4io.c registers.c safety.c sbus.c \ - up_cxxinitialize.c hx_stream.c perf_counter.c +SRCS = adc.c \ + controls.c \ + dsm.c \ + i2c.c \ + px4io.c \ + registers.c \ + safety.c \ + sbus.c \ + mixer.cpp \ + ../systemlib/mixer/mixer.cpp \ + ../systemlib/mixer/mixer_group.cpp \ + ../systemlib/mixer/mixer_multirotor.cpp \ + ../systemlib/mixer/mixer_simple.cpp \ + ../systemlib/up_cxxinitialize.c \ + ../systemlib/hx_stream.c \ + ../systemlib/perf_counter.c diff --git a/src/modules/px4iofirmware/perf_counter.c b/src/modules/px4iofirmware/perf_counter.c deleted file mode 100644 index 879f4715af..0000000000 --- a/src/modules/px4iofirmware/perf_counter.c +++ /dev/null @@ -1,317 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file perf_counter.c - * - * @brief Performance measuring tools. - */ - -#include -#include -#include -#include - -#include "perf_counter.h" - -/** - * Header common to all counters. - */ -struct perf_ctr_header { - sq_entry_t link; /**< list linkage */ - enum perf_counter_type type; /**< counter type */ - const char *name; /**< counter name */ -}; - -/** - * PC_EVENT counter. - */ -struct perf_ctr_count { - struct perf_ctr_header hdr; - uint64_t event_count; -}; - -/** - * PC_ELAPSED counter. - */ -struct perf_ctr_elapsed { - struct perf_ctr_header hdr; - uint64_t event_count; - uint64_t time_start; - uint64_t time_total; - uint64_t time_least; - uint64_t time_most; -}; - -/** - * PC_INTERVAL counter. - */ -struct perf_ctr_interval { - struct perf_ctr_header hdr; - uint64_t event_count; - uint64_t time_event; - uint64_t time_first; - uint64_t time_last; - uint64_t time_least; - uint64_t time_most; - -}; - -/** - * List of all known counters. - */ -static sq_queue_t perf_counters; - - -perf_counter_t -perf_alloc(enum perf_counter_type type, const char *name) -{ - perf_counter_t ctr = NULL; - - switch (type) { - case PC_COUNT: - ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_count), 1); - break; - - case PC_ELAPSED: - ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_elapsed), 1); - break; - - case PC_INTERVAL: - ctr = (perf_counter_t)calloc(sizeof(struct perf_ctr_interval), 1); - break; - - default: - break; - } - - if (ctr != NULL) { - ctr->type = type; - ctr->name = name; - sq_addfirst(&ctr->link, &perf_counters); - } - - return ctr; -} - -void -perf_free(perf_counter_t handle) -{ - if (handle == NULL) - return; - - sq_rem(&handle->link, &perf_counters); - free(handle); -} - -void -perf_count(perf_counter_t handle) -{ - if (handle == NULL) - return; - - switch (handle->type) { - case PC_COUNT: - ((struct perf_ctr_count *)handle)->event_count++; - break; - - case PC_INTERVAL: { - struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; - hrt_abstime now = hrt_absolute_time(); - - switch (pci->event_count) { - case 0: - pci->time_first = now; - break; - case 1: - pci->time_least = now - pci->time_last; - pci->time_most = now - pci->time_last; - break; - default: { - hrt_abstime interval = now - pci->time_last; - if (interval < pci->time_least) - pci->time_least = interval; - if (interval > pci->time_most) - pci->time_most = interval; - break; - } - } - pci->time_last = now; - pci->event_count++; - break; - } - - default: - break; - } -} - -void -perf_begin(perf_counter_t handle) -{ - if (handle == NULL) - return; - - switch (handle->type) { - case PC_ELAPSED: - ((struct perf_ctr_elapsed *)handle)->time_start = hrt_absolute_time(); - break; - - default: - break; - } -} - -void -perf_end(perf_counter_t handle) -{ - if (handle == NULL) - return; - - switch (handle->type) { - case PC_ELAPSED: { - struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; - hrt_abstime elapsed = hrt_absolute_time() - pce->time_start; - - pce->event_count++; - pce->time_total += elapsed; - - if ((pce->time_least > elapsed) || (pce->time_least == 0)) - pce->time_least = elapsed; - - if (pce->time_most < elapsed) - pce->time_most = elapsed; - } - - default: - break; - } -} - -void -perf_reset(perf_counter_t handle) -{ - if (handle == NULL) - return; - - switch (handle->type) { - case PC_COUNT: - ((struct perf_ctr_count *)handle)->event_count = 0; - break; - - case PC_ELAPSED: { - struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; - pce->event_count = 0; - pce->time_start = 0; - pce->time_total = 0; - pce->time_least = 0; - pce->time_most = 0; - break; - } - - case PC_INTERVAL: { - struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; - pci->event_count = 0; - pci->time_event = 0; - pci->time_first = 0; - pci->time_last = 0; - pci->time_least = 0; - pci->time_most = 0; - break; - } - } -} - -void -perf_print_counter(perf_counter_t handle) -{ - if (handle == NULL) - return; - - switch (handle->type) { - case PC_COUNT: - printf("%s: %llu events\n", - handle->name, - ((struct perf_ctr_count *)handle)->event_count); - break; - - case PC_ELAPSED: { - struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; - - printf("%s: %llu events, %lluus elapsed, min %lluus max %lluus\n", - handle->name, - pce->event_count, - pce->time_total, - pce->time_least, - pce->time_most); - break; - } - - case PC_INTERVAL: { - struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; - - printf("%s: %llu events, %llu avg, min %lluus max %lluus\n", - handle->name, - pci->event_count, - (pci->time_last - pci->time_first) / pci->event_count, - pci->time_least, - pci->time_most); - break; - } - - default: - break; - } -} - -void -perf_print_all(void) -{ - perf_counter_t handle = (perf_counter_t)sq_peek(&perf_counters); - - while (handle != NULL) { - perf_print_counter(handle); - handle = (perf_counter_t)sq_next(&handle->link); - } -} - -void -perf_reset_all(void) -{ - perf_counter_t handle = (perf_counter_t)sq_peek(&perf_counters); - - while (handle != NULL) { - perf_reset(handle); - handle = (perf_counter_t)sq_next(&handle->link); - } -} diff --git a/src/modules/px4iofirmware/perf_counter.h b/src/modules/px4iofirmware/perf_counter.h deleted file mode 100644 index 5c2cb15b2f..0000000000 --- a/src/modules/px4iofirmware/perf_counter.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file perf_counter.h - * Performance measuring tools. - */ - -#ifndef _SYSTEMLIB_PERF_COUNTER_H -#define _SYSTEMLIB_PERF_COUNTER_H value - -/** - * Counter types. - */ -enum perf_counter_type { - PC_COUNT, /**< count the number of times an event occurs */ - PC_ELAPSED, /**< measure the time elapsed performing an event */ - PC_INTERVAL /**< measure the interval between instances of an event */ -}; - -struct perf_ctr_header; -typedef struct perf_ctr_header *perf_counter_t; - -__BEGIN_DECLS - -/** - * Create a new counter. - * - * @param type The type of the new counter. - * @param name The counter name. - * @return Handle for the new counter, or NULL if a counter - * could not be allocated. - */ -__EXPORT extern perf_counter_t perf_alloc(enum perf_counter_type type, const char *name); - -/** - * Free a counter. - * - * @param handle The performance counter's handle. - */ -__EXPORT extern void perf_free(perf_counter_t handle); - -/** - * Count a performance event. - * - * This call only affects counters that take single events; PC_COUNT etc. - * - * @param handle The handle returned from perf_alloc. - */ -__EXPORT extern void perf_count(perf_counter_t handle); - -/** - * Begin a performance event. - * - * This call applies to counters that operate over ranges of time; PC_ELAPSED etc. - * - * @param handle The handle returned from perf_alloc. - */ -__EXPORT extern void perf_begin(perf_counter_t handle); - -/** - * End a performance event. - * - * This call applies to counters that operate over ranges of time; PC_ELAPSED etc. - * - * @param handle The handle returned from perf_alloc. - */ -__EXPORT extern void perf_end(perf_counter_t handle); - -/** - * Reset a performance event. - * - * This call resets performance counter to initial state - * - * @param handle The handle returned from perf_alloc. - */ -__EXPORT extern void perf_reset(perf_counter_t handle); - -/** - * Print one performance counter. - * - * @param handle The counter to print. - */ -__EXPORT extern void perf_print_counter(perf_counter_t handle); - -/** - * Print all of the performance counters. - */ -__EXPORT extern void perf_print_all(void); - -/** - * Reset all of the performance counters. - */ -__EXPORT extern void perf_reset_all(void); - -__END_DECLS - -#endif diff --git a/src/modules/px4iofirmware/up_cxxinitialize.c b/src/modules/px4iofirmware/up_cxxinitialize.c deleted file mode 100644 index c78f295708..0000000000 --- a/src/modules/px4iofirmware/up_cxxinitialize.c +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************************ - * configs/stm32f4discovery/src/up_cxxinitialize.c - * arch/arm/src/board/up_cxxinitialize.c - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ************************************************************************************/ - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include - -#include - -//#include -//#include "chip.h" - -/************************************************************************************ - * Definitions - ************************************************************************************/ -/* Debug ****************************************************************************/ -/* Non-standard debug that may be enabled just for testing the static constructors */ - -#ifndef CONFIG_DEBUG -# undef CONFIG_DEBUG_CXX -#endif - -#ifdef CONFIG_DEBUG_CXX -# define cxxdbg dbg -# define cxxlldbg lldbg -# ifdef CONFIG_DEBUG_VERBOSE -# define cxxvdbg vdbg -# define cxxllvdbg llvdbg -# else -# define cxxvdbg(x...) -# define cxxllvdbg(x...) -# endif -#else -# define cxxdbg(x...) -# define cxxlldbg(x...) -# define cxxvdbg(x...) -# define cxxllvdbg(x...) -#endif - -/************************************************************************************ - * Private Types - ************************************************************************************/ -/* This type defines one entry in initialization array */ - -typedef void (*initializer_t)(void); - -/************************************************************************************ - * External references - ************************************************************************************/ -/* _sinit and _einit are symbols exported by the linker script that mark the - * beginning and the end of the C++ initialization section. - */ - -extern initializer_t _sinit; -extern initializer_t _einit; - -/* _stext and _etext are symbols exported by the linker script that mark the - * beginning and the end of text. - */ - -extern uint32_t _stext; -extern uint32_t _etext; - -/************************************************************************************ - * Private Functions - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/**************************************************************************** - * Name: up_cxxinitialize - * - * Description: - * If C++ and C++ static constructors are supported, then this function - * must be provided by board-specific logic in order to perform - * initialization of the static C++ class instances. - * - * This function should then be called in the application-specific - * user_start logic in order to perform the C++ initialization. NOTE - * that no component of the core NuttX RTOS logic is involved; This - * function defintion only provides the 'contract' between application - * specific C++ code and platform-specific toolchain support - * - ***************************************************************************/ - -__EXPORT void up_cxxinitialize(void) -{ - initializer_t *initp; - - cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n", - &_sinit, &_einit, &_stext, &_etext); - - /* Visit each entry in the initialzation table */ - - for (initp = &_sinit; initp != &_einit; initp++) - { - initializer_t initializer = *initp; - cxxdbg("initp: %p initializer: %p\n", initp, initializer); - - /* Make sure that the address is non-NULL and lies in the text region - * defined by the linker script. Some toolchains may put NULL values - * or counts in the initialization table - */ - - if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext) - { - cxxdbg("Calling %p\n", initializer); - initializer(); - } - } -} diff --git a/apps/systemlib/airspeed.c b/src/modules/systemlib/airspeed.c similarity index 100% rename from apps/systemlib/airspeed.c rename to src/modules/systemlib/airspeed.c diff --git a/apps/systemlib/airspeed.h b/src/modules/systemlib/airspeed.h similarity index 100% rename from apps/systemlib/airspeed.h rename to src/modules/systemlib/airspeed.h diff --git a/apps/systemlib/bson/tinybson.c b/src/modules/systemlib/bson/tinybson.c similarity index 99% rename from apps/systemlib/bson/tinybson.c rename to src/modules/systemlib/bson/tinybson.c index 321466f87a..8aca6a25dd 100644 --- a/apps/systemlib/bson/tinybson.c +++ b/src/modules/systemlib/bson/tinybson.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include "tinybson.h" diff --git a/apps/systemlib/bson/tinybson.h b/src/modules/systemlib/bson/tinybson.h similarity index 100% rename from apps/systemlib/bson/tinybson.h rename to src/modules/systemlib/bson/tinybson.h diff --git a/apps/systemlib/conversions.c b/src/modules/systemlib/conversions.c similarity index 100% rename from apps/systemlib/conversions.c rename to src/modules/systemlib/conversions.c diff --git a/apps/systemlib/conversions.h b/src/modules/systemlib/conversions.h similarity index 100% rename from apps/systemlib/conversions.h rename to src/modules/systemlib/conversions.h diff --git a/apps/systemlib/cpuload.c b/src/modules/systemlib/cpuload.c similarity index 100% rename from apps/systemlib/cpuload.c rename to src/modules/systemlib/cpuload.c diff --git a/apps/systemlib/cpuload.h b/src/modules/systemlib/cpuload.h similarity index 100% rename from apps/systemlib/cpuload.h rename to src/modules/systemlib/cpuload.h diff --git a/apps/systemlib/err.c b/src/modules/systemlib/err.c similarity index 100% rename from apps/systemlib/err.c rename to src/modules/systemlib/err.c diff --git a/apps/systemlib/err.h b/src/modules/systemlib/err.h similarity index 100% rename from apps/systemlib/err.h rename to src/modules/systemlib/err.h diff --git a/apps/systemlib/geo/geo.c b/src/modules/systemlib/geo/geo.c similarity index 100% rename from apps/systemlib/geo/geo.c rename to src/modules/systemlib/geo/geo.c diff --git a/apps/systemlib/geo/geo.h b/src/modules/systemlib/geo/geo.h similarity index 100% rename from apps/systemlib/geo/geo.h rename to src/modules/systemlib/geo/geo.h diff --git a/apps/systemlib/getopt_long.c b/src/modules/systemlib/getopt_long.c similarity index 100% rename from apps/systemlib/getopt_long.c rename to src/modules/systemlib/getopt_long.c diff --git a/apps/systemlib/getopt_long.h b/src/modules/systemlib/getopt_long.h similarity index 100% rename from apps/systemlib/getopt_long.h rename to src/modules/systemlib/getopt_long.h diff --git a/apps/systemlib/hx_stream.c b/src/modules/systemlib/hx_stream.c similarity index 100% rename from apps/systemlib/hx_stream.c rename to src/modules/systemlib/hx_stream.c diff --git a/apps/systemlib/hx_stream.h b/src/modules/systemlib/hx_stream.h similarity index 100% rename from apps/systemlib/hx_stream.h rename to src/modules/systemlib/hx_stream.h diff --git a/apps/systemlib/mixer/mixer.cpp b/src/modules/systemlib/mixer/mixer.cpp similarity index 100% rename from apps/systemlib/mixer/mixer.cpp rename to src/modules/systemlib/mixer/mixer.cpp diff --git a/apps/systemlib/mixer/mixer.h b/src/modules/systemlib/mixer/mixer.h similarity index 100% rename from apps/systemlib/mixer/mixer.h rename to src/modules/systemlib/mixer/mixer.h diff --git a/apps/systemlib/mixer/mixer_group.cpp b/src/modules/systemlib/mixer/mixer_group.cpp similarity index 100% rename from apps/systemlib/mixer/mixer_group.cpp rename to src/modules/systemlib/mixer/mixer_group.cpp diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/src/modules/systemlib/mixer/mixer_multirotor.cpp similarity index 100% rename from apps/systemlib/mixer/mixer_multirotor.cpp rename to src/modules/systemlib/mixer/mixer_multirotor.cpp diff --git a/apps/systemlib/mixer/mixer_simple.cpp b/src/modules/systemlib/mixer/mixer_simple.cpp similarity index 100% rename from apps/systemlib/mixer/mixer_simple.cpp rename to src/modules/systemlib/mixer/mixer_simple.cpp diff --git a/apps/systemlib/mixer/Makefile b/src/modules/systemlib/mixer/module.mk similarity index 91% rename from apps/systemlib/mixer/Makefile rename to src/modules/systemlib/mixer/module.mk index f8b02f1941..4d45e1c506 100644 --- a/apps/systemlib/mixer/Makefile +++ b/src/modules/systemlib/mixer/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -36,4 +36,7 @@ # LIBNAME = mixerlib -include $(APPDIR)/mk/app.mk +SRCS = mixer.cpp \ + mixer_group.cpp \ + mixer_multirotor.cpp \ + mixer_simple.cpp diff --git a/apps/systemlib/mixer/multi_tables b/src/modules/systemlib/mixer/multi_tables similarity index 100% rename from apps/systemlib/mixer/multi_tables rename to src/modules/systemlib/mixer/multi_tables diff --git a/apps/systemlib/Makefile b/src/modules/systemlib/module.mk similarity index 97% rename from apps/systemlib/Makefile rename to src/modules/systemlib/module.mk index b2e233a920..fd0289c9a4 100644 --- a/apps/systemlib/Makefile +++ b/src/modules/systemlib/module.mk @@ -35,7 +35,7 @@ # System utility library # -CSRCS = err.c \ +SRCS = err.c \ hx_stream.c \ perf_counter.c \ param/param.c \ @@ -48,5 +48,3 @@ CSRCS = err.c \ geo/geo.c \ systemlib.c \ airspeed.c - -include $(APPDIR)/mk/app.mk diff --git a/apps/systemlib/param/param.c b/src/modules/systemlib/param/param.c similarity index 99% rename from apps/systemlib/param/param.c rename to src/modules/systemlib/param/param.c index 8073570d1d..69a9bdf9b5 100644 --- a/apps/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include diff --git a/apps/systemlib/param/param.h b/src/modules/systemlib/param/param.h similarity index 100% rename from apps/systemlib/param/param.h rename to src/modules/systemlib/param/param.h diff --git a/apps/systemlib/perf_counter.c b/src/modules/systemlib/perf_counter.c similarity index 100% rename from apps/systemlib/perf_counter.c rename to src/modules/systemlib/perf_counter.c diff --git a/apps/systemlib/perf_counter.h b/src/modules/systemlib/perf_counter.h similarity index 100% rename from apps/systemlib/perf_counter.h rename to src/modules/systemlib/perf_counter.h diff --git a/apps/systemlib/pid/pid.c b/src/modules/systemlib/pid/pid.c similarity index 100% rename from apps/systemlib/pid/pid.c rename to src/modules/systemlib/pid/pid.c diff --git a/apps/systemlib/pid/pid.h b/src/modules/systemlib/pid/pid.h similarity index 100% rename from apps/systemlib/pid/pid.h rename to src/modules/systemlib/pid/pid.h diff --git a/apps/systemlib/ppm_decode.c b/src/modules/systemlib/ppm_decode.c similarity index 100% rename from apps/systemlib/ppm_decode.c rename to src/modules/systemlib/ppm_decode.c diff --git a/apps/systemlib/ppm_decode.h b/src/modules/systemlib/ppm_decode.h similarity index 100% rename from apps/systemlib/ppm_decode.h rename to src/modules/systemlib/ppm_decode.h diff --git a/apps/systemlib/scheduling_priorities.h b/src/modules/systemlib/scheduling_priorities.h similarity index 100% rename from apps/systemlib/scheduling_priorities.h rename to src/modules/systemlib/scheduling_priorities.h diff --git a/apps/systemlib/systemlib.c b/src/modules/systemlib/systemlib.c similarity index 100% rename from apps/systemlib/systemlib.c rename to src/modules/systemlib/systemlib.c diff --git a/apps/systemlib/systemlib.h b/src/modules/systemlib/systemlib.h similarity index 100% rename from apps/systemlib/systemlib.h rename to src/modules/systemlib/systemlib.h diff --git a/apps/systemlib/up_cxxinitialize.c b/src/modules/systemlib/up_cxxinitialize.c similarity index 100% rename from apps/systemlib/up_cxxinitialize.c rename to src/modules/systemlib/up_cxxinitialize.c diff --git a/apps/systemlib/uthash/doc/userguide.txt b/src/modules/systemlib/uthash/doc/userguide.txt similarity index 100% rename from apps/systemlib/uthash/doc/userguide.txt rename to src/modules/systemlib/uthash/doc/userguide.txt diff --git a/apps/systemlib/uthash/doc/utarray.txt b/src/modules/systemlib/uthash/doc/utarray.txt similarity index 100% rename from apps/systemlib/uthash/doc/utarray.txt rename to src/modules/systemlib/uthash/doc/utarray.txt diff --git a/apps/systemlib/uthash/doc/utlist.txt b/src/modules/systemlib/uthash/doc/utlist.txt similarity index 100% rename from apps/systemlib/uthash/doc/utlist.txt rename to src/modules/systemlib/uthash/doc/utlist.txt diff --git a/apps/systemlib/uthash/doc/utstring.txt b/src/modules/systemlib/uthash/doc/utstring.txt similarity index 100% rename from apps/systemlib/uthash/doc/utstring.txt rename to src/modules/systemlib/uthash/doc/utstring.txt diff --git a/apps/systemlib/uthash/utarray.h b/src/modules/systemlib/uthash/utarray.h similarity index 100% rename from apps/systemlib/uthash/utarray.h rename to src/modules/systemlib/uthash/utarray.h diff --git a/apps/systemlib/uthash/uthash.h b/src/modules/systemlib/uthash/uthash.h similarity index 100% rename from apps/systemlib/uthash/uthash.h rename to src/modules/systemlib/uthash/uthash.h diff --git a/apps/systemlib/uthash/utlist.h b/src/modules/systemlib/uthash/utlist.h similarity index 100% rename from apps/systemlib/uthash/utlist.h rename to src/modules/systemlib/uthash/utlist.h diff --git a/apps/systemlib/uthash/utstring.h b/src/modules/systemlib/uthash/utstring.h similarity index 100% rename from apps/systemlib/uthash/utstring.h rename to src/modules/systemlib/uthash/utstring.h diff --git a/apps/systemlib/visibility.h b/src/modules/systemlib/visibility.h similarity index 100% rename from apps/systemlib/visibility.h rename to src/modules/systemlib/visibility.h diff --git a/apps/uORB/.context b/src/modules/uORB/.context similarity index 100% rename from apps/uORB/.context rename to src/modules/uORB/.context diff --git a/apps/examples/math_demo/Makefile b/src/modules/uORB/module.mk similarity index 87% rename from apps/examples/math_demo/Makefile rename to src/modules/uORB/module.mk index a1105899a7..5ec31ab010 100644 --- a/apps/examples/math_demo/Makefile +++ b/src/modules/uORB/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,13 @@ ############################################################################ # -# Basic example application +# Makefile to build uORB # -APPNAME = math_demo -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 8192 +MODULE_COMMAND = uorb -include $(APPDIR)/mk/app.mk +# XXX probably excessive, 2048 should be sufficient +MODULE_STACKSIZE = 4096 + +SRCS = uORB.cpp \ + objects_common.cpp diff --git a/apps/uORB/objects_common.cpp b/src/modules/uORB/objects_common.cpp similarity index 100% rename from apps/uORB/objects_common.cpp rename to src/modules/uORB/objects_common.cpp diff --git a/apps/uORB/topics/actuator_controls.h b/src/modules/uORB/topics/actuator_controls.h similarity index 100% rename from apps/uORB/topics/actuator_controls.h rename to src/modules/uORB/topics/actuator_controls.h diff --git a/apps/uORB/topics/actuator_controls_effective.h b/src/modules/uORB/topics/actuator_controls_effective.h similarity index 100% rename from apps/uORB/topics/actuator_controls_effective.h rename to src/modules/uORB/topics/actuator_controls_effective.h diff --git a/apps/uORB/topics/actuator_outputs.h b/src/modules/uORB/topics/actuator_outputs.h similarity index 100% rename from apps/uORB/topics/actuator_outputs.h rename to src/modules/uORB/topics/actuator_outputs.h diff --git a/apps/uORB/topics/battery_status.h b/src/modules/uORB/topics/battery_status.h similarity index 100% rename from apps/uORB/topics/battery_status.h rename to src/modules/uORB/topics/battery_status.h diff --git a/apps/uORB/topics/debug_key_value.h b/src/modules/uORB/topics/debug_key_value.h similarity index 100% rename from apps/uORB/topics/debug_key_value.h rename to src/modules/uORB/topics/debug_key_value.h diff --git a/apps/uORB/topics/differential_pressure.h b/src/modules/uORB/topics/differential_pressure.h similarity index 100% rename from apps/uORB/topics/differential_pressure.h rename to src/modules/uORB/topics/differential_pressure.h diff --git a/apps/uORB/topics/home_position.h b/src/modules/uORB/topics/home_position.h similarity index 100% rename from apps/uORB/topics/home_position.h rename to src/modules/uORB/topics/home_position.h diff --git a/apps/uORB/topics/manual_control_setpoint.h b/src/modules/uORB/topics/manual_control_setpoint.h similarity index 100% rename from apps/uORB/topics/manual_control_setpoint.h rename to src/modules/uORB/topics/manual_control_setpoint.h diff --git a/apps/uORB/topics/offboard_control_setpoint.h b/src/modules/uORB/topics/offboard_control_setpoint.h similarity index 100% rename from apps/uORB/topics/offboard_control_setpoint.h rename to src/modules/uORB/topics/offboard_control_setpoint.h diff --git a/apps/uORB/topics/omnidirectional_flow.h b/src/modules/uORB/topics/omnidirectional_flow.h similarity index 100% rename from apps/uORB/topics/omnidirectional_flow.h rename to src/modules/uORB/topics/omnidirectional_flow.h diff --git a/apps/uORB/topics/optical_flow.h b/src/modules/uORB/topics/optical_flow.h similarity index 100% rename from apps/uORB/topics/optical_flow.h rename to src/modules/uORB/topics/optical_flow.h diff --git a/apps/uORB/topics/parameter_update.h b/src/modules/uORB/topics/parameter_update.h similarity index 100% rename from apps/uORB/topics/parameter_update.h rename to src/modules/uORB/topics/parameter_update.h diff --git a/apps/uORB/topics/rc_channels.h b/src/modules/uORB/topics/rc_channels.h similarity index 100% rename from apps/uORB/topics/rc_channels.h rename to src/modules/uORB/topics/rc_channels.h diff --git a/apps/uORB/topics/sensor_combined.h b/src/modules/uORB/topics/sensor_combined.h similarity index 100% rename from apps/uORB/topics/sensor_combined.h rename to src/modules/uORB/topics/sensor_combined.h diff --git a/apps/uORB/topics/subsystem_info.h b/src/modules/uORB/topics/subsystem_info.h similarity index 100% rename from apps/uORB/topics/subsystem_info.h rename to src/modules/uORB/topics/subsystem_info.h diff --git a/apps/uORB/topics/vehicle_attitude.h b/src/modules/uORB/topics/vehicle_attitude.h similarity index 100% rename from apps/uORB/topics/vehicle_attitude.h rename to src/modules/uORB/topics/vehicle_attitude.h diff --git a/apps/uORB/topics/vehicle_attitude_setpoint.h b/src/modules/uORB/topics/vehicle_attitude_setpoint.h similarity index 100% rename from apps/uORB/topics/vehicle_attitude_setpoint.h rename to src/modules/uORB/topics/vehicle_attitude_setpoint.h diff --git a/apps/uORB/topics/vehicle_command.h b/src/modules/uORB/topics/vehicle_command.h similarity index 100% rename from apps/uORB/topics/vehicle_command.h rename to src/modules/uORB/topics/vehicle_command.h diff --git a/apps/uORB/topics/vehicle_global_position.h b/src/modules/uORB/topics/vehicle_global_position.h similarity index 100% rename from apps/uORB/topics/vehicle_global_position.h rename to src/modules/uORB/topics/vehicle_global_position.h diff --git a/apps/uORB/topics/vehicle_global_position_set_triplet.h b/src/modules/uORB/topics/vehicle_global_position_set_triplet.h similarity index 100% rename from apps/uORB/topics/vehicle_global_position_set_triplet.h rename to src/modules/uORB/topics/vehicle_global_position_set_triplet.h diff --git a/apps/uORB/topics/vehicle_global_position_setpoint.h b/src/modules/uORB/topics/vehicle_global_position_setpoint.h similarity index 100% rename from apps/uORB/topics/vehicle_global_position_setpoint.h rename to src/modules/uORB/topics/vehicle_global_position_setpoint.h diff --git a/apps/uORB/topics/vehicle_gps_position.h b/src/modules/uORB/topics/vehicle_gps_position.h similarity index 100% rename from apps/uORB/topics/vehicle_gps_position.h rename to src/modules/uORB/topics/vehicle_gps_position.h diff --git a/apps/uORB/topics/vehicle_local_position.h b/src/modules/uORB/topics/vehicle_local_position.h similarity index 100% rename from apps/uORB/topics/vehicle_local_position.h rename to src/modules/uORB/topics/vehicle_local_position.h diff --git a/apps/uORB/topics/vehicle_local_position_setpoint.h b/src/modules/uORB/topics/vehicle_local_position_setpoint.h similarity index 100% rename from apps/uORB/topics/vehicle_local_position_setpoint.h rename to src/modules/uORB/topics/vehicle_local_position_setpoint.h diff --git a/apps/uORB/topics/vehicle_rates_setpoint.h b/src/modules/uORB/topics/vehicle_rates_setpoint.h similarity index 100% rename from apps/uORB/topics/vehicle_rates_setpoint.h rename to src/modules/uORB/topics/vehicle_rates_setpoint.h diff --git a/apps/uORB/topics/vehicle_status.h b/src/modules/uORB/topics/vehicle_status.h similarity index 100% rename from apps/uORB/topics/vehicle_status.h rename to src/modules/uORB/topics/vehicle_status.h diff --git a/apps/uORB/topics/vehicle_vicon_position.h b/src/modules/uORB/topics/vehicle_vicon_position.h similarity index 100% rename from apps/uORB/topics/vehicle_vicon_position.h rename to src/modules/uORB/topics/vehicle_vicon_position.h diff --git a/apps/uORB/uORB.cpp b/src/modules/uORB/uORB.cpp similarity index 100% rename from apps/uORB/uORB.cpp rename to src/modules/uORB/uORB.cpp diff --git a/apps/uORB/uORB.h b/src/modules/uORB/uORB.h similarity index 100% rename from apps/uORB/uORB.h rename to src/modules/uORB/uORB.h From 25612cebc2c4ecfc131e545c926f6ff581e11030 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 10:37:07 +0200 Subject: [PATCH 065/129] Cleaned up NuttX appconfig, added examples to config --- apps/mk/app.mk | 237 ------------------ makefiles/config_px4fmu_default.mk | 11 + nuttx/configs/px4fmu/nsh/appconfig | 87 ------- .../examples/px4_daemon_app/module.mk | 10 +- .../examples/px4_daemon_app/px4_daemon_app.c | 0 .../examples/px4_mavlink_debug/module.mk | 8 +- .../px4_mavlink_debug/px4_mavlink_debug.c | 0 .../examples/px4_simple_app/module.mk | 8 +- .../examples/px4_simple_app/px4_simple_app.c | 0 9 files changed, 21 insertions(+), 340 deletions(-) delete mode 100644 apps/mk/app.mk rename apps/examples/px4_mavlink_debug/Makefile => src/examples/px4_daemon_app/module.mk (88%) rename apps/examples/px4_deamon_app/px4_deamon_app.c => src/examples/px4_daemon_app/px4_daemon_app.c (100%) rename apps/examples/px4_deamon_app/Makefile => src/examples/px4_mavlink_debug/module.mk (90%) rename {apps => src}/examples/px4_mavlink_debug/px4_mavlink_debug.c (100%) rename apps/examples/px4_simple_app/Makefile => src/examples/px4_simple_app/module.mk (90%) rename {apps => src}/examples/px4_simple_app/px4_simple_app.c (100%) diff --git a/apps/mk/app.mk b/apps/mk/app.mk deleted file mode 100644 index fa4a12cab6..0000000000 --- a/apps/mk/app.mk +++ /dev/null @@ -1,237 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Common Makefile for nsh command modules and utility libraries; should be -# included by the module-specific Makefile. -# -# To build an app that appears as an nsh external command, the caller -# must define: -# -# APPNAME - the name of the application, defaults to the name -# of the parent directory. -# -# If APPNAME is not defined, a utility library is built instead. The library -# name is normally automatically determined, but it can be overridden by -# setting: -# -# LIBNAME - the name of the library, defaults to the name of the -# directory -# -# The calling makefile may also set: -# -# ASRCS - list of assembly source files, defaults to all .S -# files in the directory -# -# CSRCS - list of C source files, defaults to all .c files -# in the directory -# -# CXXSRCS - list of C++ source files, defaults to all .cpp -# files in the directory -# -# INCLUDES - list of directories to be added to the include -# search path -# -# PRIORITY - thread priority for the command (defaults to -# SCHED_PRIORITY_DEFAULT) -# -# STACKSIZE - stack size for the command (defaults to -# CONFIG_PTHREAD_STACK_DEFAULT) -# -# Symbols in the module are private to the module unless deliberately exported -# using the __EXPORT tag, or DEFAULT_VISIBILITY is set -# - -############################################################################ -# No user-serviceable parts below -############################################################################ - - -############################################################################ -# Work out who included us so we can report decent errors -# -THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) -ifeq ($(APP_MAKEFILE),) -APP_MAKEFILE := $(lastword $(filter-out $(THIS_MAKEFILE),$(MAKEFILE_LIST))) -endif - -############################################################################ -# Get configuration -# --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -############################################################################ -# Sanity-check the information we've been given and set any defaults -# -SRCDIR ?= $(dir $(APP_MAKEFILE)) -PRIORITY ?= SCHED_PRIORITY_DEFAULT -STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT - -INCLUDES += $(APPDIR) - -ASRCS ?= $(wildcard $(SRCDIR)/*.S) -CSRCS ?= $(wildcard $(SRCDIR)/*.c) -CHDRS ?= $(wildcard $(SRCDIR)/*.h) -CXXSRCS ?= $(wildcard $(SRCDIR)/*.cpp) -CXXHDRS ?= $(wildcard $(SRCDIR)/*.hpp) - -# if APPNAME is not set, this is a library -ifeq ($(APPNAME),) -LIBNAME ?= $(lastword $(subst /, ,$(realpath $(SRCDIR)))) -endif - -# there has to be a source file -ifeq ($(ASRCS)$(CSRCS)$(CXXSRCS),) -$(error $(realpath $(APP_MAKEFILE)): at least one of ASRCS, CSRCS or CXXSRCS must be set) -endif - -# check that C++ is configured if we have C++ source files and we are building -ifneq ($(CXXSRCS),) -ifneq ($(CONFIG_HAVE_CXX),y) -ifeq ($(MAKECMDGOALS),build) -$(error $(realpath $(APP_MAKEFILE)): cannot set CXXSRCS if CONFIG_HAVE_CXX not set in configuration) -endif -endif -endif - -############################################################################ -# Adjust compilation flags to implement EXPORT -# - -ifeq ($(DEFAULT_VISIBILITY),) -DEFAULT_VISIBILITY = hidden -else -DEFAULT_VISIBILITY = default -endif - -CFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(APPDIR)/systemlib/visibility.h -CXXFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(APPDIR)/systemlib/visibility.h - -############################################################################ -# Add extra include directories -# -CFLAGS += $(addprefix -I,$(INCLUDES)) -CXXFLAGS += $(addprefix -I,$(INCLUDES)) - -############################################################################ -# Things we are going to build -# - -SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) -AOBJS = $(patsubst %.S,%.o,$(ASRCS)) -COBJS = $(patsubst %.c,%.o,$(CSRCS)) -CXXOBJS = $(patsubst %.cpp,%.o,$(CXXSRCS)) -OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) - -# Automatic depdendency generation -DEPS = $(OBJS:$(OBJEXT)=.d) -CFLAGS += -MD -CXXFLAGS += -MD - -# The prelinked object that we are ultimately going to build -ifneq ($(APPNAME),) -PRELINKOBJ = $(APPNAME).pre.o -else -PRELINKOBJ = $(LIBNAME).pre.o -endif - -# The archive the prelinked object will be linked into -# XXX does WINTOOL ever get set? -ifeq ($(WINTOOL),y) - INCDIROPT = -w - BIN = "$(shell cygpath -w $(APPDIR)/libapps$(LIBEXT))" -else - BIN = "$(APPDIR)/libapps$(LIBEXT)" -endif - -############################################################################ -# Rules for building things -# - -all: .built -.PHONY: clean depend distclean - -# -# Top-level build; add prelinked object to the apps archive -# -.built: $(PRELINKOBJ) - @$(call ARCHIVE, $(BIN), $(PRELINKOBJ)) - @touch $@ - -# -# Source dependencies -# -depend: - @exit 0 - -ifneq ($(APPNAME),) -# -# App registration -# -context: .context -.context: $(MAKEFILE_LIST) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -else -context: - @exit 0 -endif - -# -# Object files -# -$(PRELINKOBJ): $(OBJS) - $(call PRELINK, $@, $(OBJS)) - -$(AOBJS): %.o : %.S $(MAKEFILE_LIST) - $(call ASSEMBLE, $<, $@) - -$(COBJS): %.o : %.c $(MAKEFILE_LIST) - $(call COMPILE, $<, $@) - -$(CXXOBJS): %.o : %.cpp $(MAKEFILE_LIST) - $(call COMPILEXX, $<, $@) - -# -# Tidying up -# -clean: - @rm -f $(OBJS) $(DEPS) $(PRELINKOBJ) .built - $(call CLEAN) - -distclean: clean - @rm -f Make.dep .depend - --include $(DEPS) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index bc3031cd67..52b7e7e48c 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -89,6 +89,17 @@ MODULES += modules/uORB # Demo apps # MODULES += examples/math_demo +# Tutorial code from +# https://pixhawk.ethz.ch/px4/dev/hello_sky +MODULES += examples/px4_simple_app + +# Tutorial code from +# https://pixhawk.ethz.ch/px4/dev/daemon +MODULES += examples/px4_daemon_app + +# Tutorial code from +# https://pixhawk.ethz.ch/px4/dev/debug_values +MODULES += examples/px4_mavlink_debug # # Transitional support - add commands from the NuttX export archive. diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 6e91f3d1a3..0e18aa8ef1 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -41,93 +41,6 @@ CONFIGURED_APPS += examples/nsh CONFIGURED_APPS += nshlib CONFIGURED_APPS += system/readline -# System library - utility functions -CONFIGURED_APPS += systemlib -CONFIGURED_APPS += systemlib/mixer - -# Math library -ifneq ($(CONFIG_APM),y) -CONFIGURED_APPS += mathlib -CONFIGURED_APPS += mathlib/CMSIS -CONFIGURED_APPS += examples/math_demo -endif - -# Control library -ifneq ($(CONFIG_APM),y) -CONFIGURED_APPS += controllib -CONFIGURED_APPS += examples/control_demo -CONFIGURED_APPS += examples/kalman_demo -endif - -# System utility commands -CONFIGURED_APPS += systemcmds/reboot -CONFIGURED_APPS += systemcmds/perf -CONFIGURED_APPS += systemcmds/top -CONFIGURED_APPS += systemcmds/boardinfo -CONFIGURED_APPS += systemcmds/mixer -CONFIGURED_APPS += systemcmds/param -CONFIGURED_APPS += systemcmds/pwm -CONFIGURED_APPS += systemcmds/bl_update -CONFIGURED_APPS += systemcmds/preflight_check -CONFIGURED_APPS += systemcmds/delay_test - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/hello_sky -# CONFIGURED_APPS += examples/px4_simple_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/deamon -# CONFIGURED_APPS += examples/px4_deamon_app - -# Tutorial code from -# https://pixhawk.ethz.ch/px4/dev/debug_values -# CONFIGURED_APPS += examples/px4_mavlink_debug - -# Shared object broker; required by many parts of the system. -CONFIGURED_APPS += uORB - -CONFIGURED_APPS += mavlink -CONFIGURED_APPS += mavlink_onboard -CONFIGURED_APPS += commander -CONFIGURED_APPS += sdlog -CONFIGURED_APPS += sensors - -ifneq ($(CONFIG_APM),y) -CONFIGURED_APPS += ardrone_interface -CONFIGURED_APPS += multirotor_att_control -CONFIGURED_APPS += multirotor_pos_control -CONFIGURED_APPS += position_estimator_mc -CONFIGURED_APPS += fixedwing_att_control -CONFIGURED_APPS += fixedwing_pos_control -CONFIGURED_APPS += position_estimator -CONFIGURED_APPS += attitude_estimator_ekf -CONFIGURED_APPS += hott_telemetry -endif - -# Hacking tools -#CONFIGURED_APPS += system/i2c -CONFIGURED_APPS += systemcmds/i2c - -# Communication and Drivers -#CONFIGURED_APPS += drivers/boards/px4fmu -CONFIGURED_APPS += drivers/device -CONFIGURED_APPS += drivers/ms5611 -CONFIGURED_APPS += drivers/hmc5883 -CONFIGURED_APPS += drivers/mpu6000 -CONFIGURED_APPS += drivers/bma180 -CONFIGURED_APPS += drivers/px4io -CONFIGURED_APPS += drivers/stm32 -#CONFIGURED_APPS += drivers/led -CONFIGURED_APPS += drivers/blinkm -CONFIGURED_APPS += drivers/stm32/tone_alarm -CONFIGURED_APPS += drivers/stm32/adc -CONFIGURED_APPS += drivers/hil -CONFIGURED_APPS += drivers/gps -CONFIGURED_APPS += drivers/mb12xx - -# Testing stuff -CONFIGURED_APPS += px4/sensors_bringup - ifeq ($(CONFIG_CAN),y) #CONFIGURED_APPS += examples/can endif diff --git a/apps/examples/px4_mavlink_debug/Makefile b/src/examples/px4_daemon_app/module.mk similarity index 88% rename from apps/examples/px4_mavlink_debug/Makefile rename to src/examples/px4_daemon_app/module.mk index f59aef16fb..d23c19b75d 100644 --- a/apps/examples/px4_mavlink_debug/Makefile +++ b/src/examples/px4_daemon_app/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,9 @@ ############################################################################ # -# Basic example application +# Daemon application # -APPNAME = px4_mavlink_debug -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = px4_daemon_app -include $(APPDIR)/mk/app.mk +SRCS = px4_daemon_app.c diff --git a/apps/examples/px4_deamon_app/px4_deamon_app.c b/src/examples/px4_daemon_app/px4_daemon_app.c similarity index 100% rename from apps/examples/px4_deamon_app/px4_deamon_app.c rename to src/examples/px4_daemon_app/px4_daemon_app.c diff --git a/apps/examples/px4_deamon_app/Makefile b/src/examples/px4_mavlink_debug/module.mk similarity index 90% rename from apps/examples/px4_deamon_app/Makefile rename to src/examples/px4_mavlink_debug/module.mk index e4c169872b..3d400fdbfc 100644 --- a/apps/examples/px4_deamon_app/Makefile +++ b/src/examples/px4_mavlink_debug/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Basic example application # -APPNAME = px4_deamon_app -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = px4_mavlink_debug -include $(APPDIR)/mk/app.mk +SRCS = px4_mavlink_debug.c \ No newline at end of file diff --git a/apps/examples/px4_mavlink_debug/px4_mavlink_debug.c b/src/examples/px4_mavlink_debug/px4_mavlink_debug.c similarity index 100% rename from apps/examples/px4_mavlink_debug/px4_mavlink_debug.c rename to src/examples/px4_mavlink_debug/px4_mavlink_debug.c diff --git a/apps/examples/px4_simple_app/Makefile b/src/examples/px4_simple_app/module.mk similarity index 90% rename from apps/examples/px4_simple_app/Makefile rename to src/examples/px4_simple_app/module.mk index 102f51fd48..2c102fa500 100644 --- a/apps/examples/px4_simple_app/Makefile +++ b/src/examples/px4_simple_app/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Basic example application # -APPNAME = px4_simple_app -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = px4_simple_app -include $(APPDIR)/mk/app.mk +SRCS = px4_simple_app.c diff --git a/apps/examples/px4_simple_app/px4_simple_app.c b/src/examples/px4_simple_app/px4_simple_app.c similarity index 100% rename from apps/examples/px4_simple_app/px4_simple_app.c rename to src/examples/px4_simple_app/px4_simple_app.c From b1de6c0eaf26b9bb05075ffa18e1eb32d3cae75b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 10:38:45 +0200 Subject: [PATCH 066/129] Excluded examples from default build --- makefiles/config_px4fmu_default.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 52b7e7e48c..d196ccaf86 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -88,18 +88,18 @@ MODULES += modules/uORB # # Demo apps # -MODULES += examples/math_demo +#MODULES += examples/math_demo # Tutorial code from # https://pixhawk.ethz.ch/px4/dev/hello_sky -MODULES += examples/px4_simple_app +#MODULES += examples/px4_simple_app # Tutorial code from # https://pixhawk.ethz.ch/px4/dev/daemon -MODULES += examples/px4_daemon_app +#MODULES += examples/px4_daemon_app # Tutorial code from # https://pixhawk.ethz.ch/px4/dev/debug_values -MODULES += examples/px4_mavlink_debug +#MODULES += examples/px4_mavlink_debug # # Transitional support - add commands from the NuttX export archive. From 6479ebcc735a96b316bc0624a8b3795bc5677d4e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 14:54:06 +0200 Subject: [PATCH 067/129] General app cleanup for FMU --- apps/examples/Makefile | 1 - makefiles/config_px4fmu_default.mk | 4 +--- makefiles/setup.mk | 3 --- src/drivers/led/{Makefile => module.mk} | 6 +++--- 4 files changed, 4 insertions(+), 10 deletions(-) rename src/drivers/led/{Makefile => module.mk} (92%) diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 201be955b3..6b614b1aa3 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -38,7 +38,6 @@ # Sub-directories SUBDIRS = adc can cdcacm nsh -SUBDIRS += math_demo control_demo kalman_demo px4_deamon_app #SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc #SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index d196ccaf86..043c8af40a 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -115,7 +115,5 @@ endef # command priority stack entrypoint BUILTIN_COMMANDS := \ - $(call _B, math_demo, , 8192, math_demo_main ) \ $(call _B, sercon, , 2048, sercon_main ) \ - $(call _B, serdis, , 2048, serdis_main ) \ - $(call _B, uorb, , 4096, uorb_main ) + $(call _B, serdis, , 2048, serdis_main ) diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 3c910bcfaa..8072ec7915 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -59,9 +59,6 @@ export INCLUDE_DIRS := $(PX4_MODULE_SRC) \ $(PX4_MODULE_SRC)/modules/ \ $(PX4_INCLUDE_DIR) -# Include from legacy app/library path -export INCLUDE_DIRS += $(NUTTX_APP_SRC) - # # Tools # diff --git a/src/drivers/led/Makefile b/src/drivers/led/module.mk similarity index 92% rename from src/drivers/led/Makefile rename to src/drivers/led/module.mk index 7de1882597..777f3e4425 100644 --- a/src/drivers/led/Makefile +++ b/src/drivers/led/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,7 +32,7 @@ ############################################################################ # -# Makefile to build the LED driver. +# Build the LED driver. # -include $(APPDIR)/mk/app.mk +SRCS = led.cpp From 0eafc2ade1dce974d5f7bdf05ca7678fa0b59ab0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 14:54:44 +0200 Subject: [PATCH 068/129] IO compiling --- nuttx/configs/px4io/include/board.h | 11 ++++++++++ nuttx/configs/px4io/io/appconfig | 8 -------- src/drivers/boards/px4io/px4io_init.c | 8 ++++++++ src/drivers/boards/px4io/px4io_internal.h | 4 +++- src/modules/px4iofirmware/controls.c | 4 ++-- src/modules/px4iofirmware/module.mk | 11 +++++----- src/modules/px4iofirmware/px4io.c | 8 +++++++- src/modules/px4iofirmware/px4io.h | 25 ++++++++++++++++------- src/modules/px4iofirmware/registers.c | 2 +- 9 files changed, 56 insertions(+), 25 deletions(-) diff --git a/nuttx/configs/px4io/include/board.h b/nuttx/configs/px4io/include/board.h index d941985b47..fcbc936209 100755 --- a/nuttx/configs/px4io/include/board.h +++ b/nuttx/configs/px4io/include/board.h @@ -100,12 +100,19 @@ * Some of the USART pins are not available; override the GPIO * definitions with an invalid pin configuration. */ +#undef GPIO_USART2_CTS #define GPIO_USART2_CTS 0xffffffff +#undef GPIO_USART2_RTS #define GPIO_USART2_RTS 0xffffffff +#undef GPIO_USART2_CK #define GPIO_USART2_CK 0xffffffff +#undef GPIO_USART3_TX #define GPIO_USART3_TX 0xffffffff +#undef GPIO_USART3_CK #define GPIO_USART3_CK 0xffffffff +#undef GPIO_USART3_CTS #define GPIO_USART3_CTS 0xffffffff +#undef GPIO_USART3_RTS #define GPIO_USART3_RTS 0xffffffff /* @@ -156,6 +163,10 @@ extern "C" { ************************************************************************************/ EXTERN void stm32_boardinitialize(void); + +#if defined(__cplusplus) +} +#endif #endif /* __ASSEMBLY__ */ #endif /* __ARCH_BOARD_BOARD_H */ diff --git a/nuttx/configs/px4io/io/appconfig b/nuttx/configs/px4io/io/appconfig index 628607a515..48a41bcdb8 100644 --- a/nuttx/configs/px4io/io/appconfig +++ b/nuttx/configs/px4io/io/appconfig @@ -30,11 +30,3 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ - -CONFIGURED_APPS += drivers/boards/px4io -CONFIGURED_APPS += drivers/stm32 - -CONFIGURED_APPS += px4io - -# Mixer library from systemlib -CONFIGURED_APPS += systemlib/mixer diff --git a/src/drivers/boards/px4io/px4io_init.c b/src/drivers/boards/px4io/px4io_init.c index 14e8dc13a9..d36353c6f5 100644 --- a/src/drivers/boards/px4io/px4io_init.c +++ b/src/drivers/boards/px4io/px4io_init.c @@ -86,9 +86,17 @@ __EXPORT void stm32_boardinitialize(void) stm32_configgpio(GPIO_SERVO_PWR_EN); stm32_configgpio(GPIO_RELAY1_EN); stm32_configgpio(GPIO_RELAY2_EN); + + /* turn off - all leds are active low */ + stm32_gpiowrite(GPIO_LED1, true); + stm32_gpiowrite(GPIO_LED2, true); + stm32_gpiowrite(GPIO_LED3, true); + + /* LED config */ stm32_configgpio(GPIO_LED1); stm32_configgpio(GPIO_LED2); stm32_configgpio(GPIO_LED3); + stm32_configgpio(GPIO_ACC_OC_DETECT); stm32_configgpio(GPIO_SERVO_OC_DETECT); stm32_configgpio(GPIO_BTN_SAFETY); diff --git a/src/drivers/boards/px4io/px4io_internal.h b/src/drivers/boards/px4io/px4io_internal.h index 44bb98513b..eb2820bb7b 100644 --- a/src/drivers/boards/px4io/px4io_internal.h +++ b/src/drivers/boards/px4io/px4io_internal.h @@ -32,7 +32,9 @@ ****************************************************************************/ /** - * @file PX4IO hardware definitions. + * @file px4io_internal.h + * + * PX4IO hardware definitions. */ #pragma once diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index dc36f6c934..25eeca3be5 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -288,8 +288,8 @@ controls_tick() { r_status_flags |= PX4IO_P_STATUS_FLAGS_OVERRIDE; /* mix new RC input control values to servos */ - if (dsm_updated || sbus_updated || ppm_updated) - mixer_tick(); + //if (dsm_updated || sbus_updated || ppm_updated) + // mixer_tick(); } else { r_status_flags &= ~PX4IO_P_STATUS_FLAGS_OVERRIDE; diff --git a/src/modules/px4iofirmware/module.mk b/src/modules/px4iofirmware/module.mk index 82b8f16d3c..53d1ec2b9f 100644 --- a/src/modules/px4iofirmware/module.mk +++ b/src/modules/px4iofirmware/module.mk @@ -8,11 +8,12 @@ SRCS = adc.c \ registers.c \ safety.c \ sbus.c \ - mixer.cpp \ - ../systemlib/mixer/mixer.cpp \ - ../systemlib/mixer/mixer_group.cpp \ - ../systemlib/mixer/mixer_multirotor.cpp \ - ../systemlib/mixer/mixer_simple.cpp \ ../systemlib/up_cxxinitialize.c \ ../systemlib/hx_stream.c \ ../systemlib/perf_counter.c + +# mixer.cpp \ +# ../systemlib/mixer/mixer.cpp \ +# ../systemlib/mixer/mixer_group.cpp \ +# ../systemlib/mixer/mixer_multirotor.cpp \ +# ../systemlib/mixer/mixer_simple.cpp \ \ No newline at end of file diff --git a/src/modules/px4iofirmware/px4io.c b/src/modules/px4iofirmware/px4io.c index 9de37e1188..6244b1551c 100644 --- a/src/modules/px4iofirmware/px4io.c +++ b/src/modules/px4iofirmware/px4io.c @@ -64,8 +64,10 @@ struct sys_state_s system_state; static struct hrt_call serial_dma_call; +#ifdef CONFIG_STM32_I2C1 /* store i2c reset count XXX this should be a register, together with other error counters */ volatile uint32_t i2c_loop_resets = 0; +#endif /* * a set of debug buffers to allow us to send debug information from ISRs @@ -133,7 +135,9 @@ user_start(int argc, char *argv[]) * Poll at 1ms intervals for received bytes that have not triggered * a DMA event. */ +#ifdef CONFIG_ARCH_DMA hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* print some startup info */ lowsyslog("\nPX4IO: starting\n"); @@ -155,8 +159,10 @@ user_start(int argc, char *argv[]) /* initialise the control inputs */ controls_init(); +#ifdef CONFIG_STM32_I2C1 /* start the i2c handler */ i2c_init(); +#endif /* add a performance counter for mixing */ perf_counter_t mixer_perf = perf_alloc(PC_ELAPSED, "mix"); @@ -201,7 +207,7 @@ user_start(int argc, char *argv[]) /* kick the mixer */ perf_begin(mixer_perf); - mixer_tick(); + // mixer_tick(); perf_end(mixer_perf); /* kick the control inputs */ diff --git a/src/modules/px4iofirmware/px4io.h b/src/modules/px4iofirmware/px4io.h index 202e9d9d90..3647842c0f 100644 --- a/src/modules/px4iofirmware/px4io.h +++ b/src/modules/px4iofirmware/px4io.h @@ -124,10 +124,18 @@ extern struct sys_state_s system_state; #define LED_SAFETY(_s) stm32_gpiowrite(GPIO_LED3, !(_s)) #define POWER_SERVO(_s) stm32_gpiowrite(GPIO_SERVO_PWR_EN, (_s)) -#define POWER_ACC1(_s) stm32_gpiowrite(GPIO_ACC1_PWR_EN, (_s)) -#define POWER_ACC2(_s) stm32_gpiowrite(GPIO_ACC2_PWR_EN, (_s)) -#define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s)) -#define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s)) +#ifdef GPIO_ACC1_PWR_EN + #define POWER_ACC1(_s) stm32_gpiowrite(GPIO_ACC1_PWR_EN, (_s)) +#endif +#ifdef GPIO_ACC2_PWR_EN + #define POWER_ACC2(_s) stm32_gpiowrite(GPIO_ACC2_PWR_EN, (_s)) +#endif +#ifdef GPIO_RELAY1_EN + #define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s)) +#endif +#ifdef GPIO_RELAY2_EN + #define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s)) +#endif #define OVERCURRENT_ACC (!stm32_gpioread(GPIO_ACC_OC_DETECT)) #define OVERCURRENT_SERVO (!stm32_gpioread(GPIO_SERVO_OC_DETECT)) @@ -140,18 +148,20 @@ extern struct sys_state_s system_state; /* * Mixer */ -extern void mixer_tick(void); -extern void mixer_handle_text(const void *buffer, size_t length); +//extern void mixer_tick(void); +//extern void mixer_handle_text(const void *buffer, size_t length); /** * Safety switch/LED. */ extern void safety_init(void); +#ifdef CONFIG_STM32_I2C1 /** * FMU communications */ extern void i2c_init(void); +#endif /** * Register space @@ -183,6 +193,7 @@ extern volatile uint8_t debug_level; /* send a debug message to the console */ extern void isr_debug(uint8_t level, const char *fmt, ...); +#ifdef CONFIG_STM32_I2C1 void i2c_dump(void); void i2c_reset(void); - +#endif diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 6c09def9ee..64a87a58bc 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -245,7 +245,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num /* handle text going to the mixer parser */ case PX4IO_PAGE_MIXERLOAD: - mixer_handle_text(values, num_values * sizeof(*values)); + //mixer_handle_text(values, num_values * sizeof(*values)); break; default: From dc2c3cad3e8897d7ae299d41d16845000efe3c69 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 14:59:42 +0200 Subject: [PATCH 069/129] Re-enabled mixer --- src/modules/px4iofirmware/controls.c | 4 ++-- src/modules/px4iofirmware/module.mk | 14 +++++++------- src/modules/px4iofirmware/px4io.c | 2 +- src/modules/px4iofirmware/px4io.h | 4 ++-- src/modules/px4iofirmware/registers.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index 25eeca3be5..dc36f6c934 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -288,8 +288,8 @@ controls_tick() { r_status_flags |= PX4IO_P_STATUS_FLAGS_OVERRIDE; /* mix new RC input control values to servos */ - //if (dsm_updated || sbus_updated || ppm_updated) - // mixer_tick(); + if (dsm_updated || sbus_updated || ppm_updated) + mixer_tick(); } else { r_status_flags &= ~PX4IO_P_STATUS_FLAGS_OVERRIDE; diff --git a/src/modules/px4iofirmware/module.mk b/src/modules/px4iofirmware/module.mk index 53d1ec2b9f..6379366f43 100644 --- a/src/modules/px4iofirmware/module.mk +++ b/src/modules/px4iofirmware/module.mk @@ -10,10 +10,10 @@ SRCS = adc.c \ sbus.c \ ../systemlib/up_cxxinitialize.c \ ../systemlib/hx_stream.c \ - ../systemlib/perf_counter.c - -# mixer.cpp \ -# ../systemlib/mixer/mixer.cpp \ -# ../systemlib/mixer/mixer_group.cpp \ -# ../systemlib/mixer/mixer_multirotor.cpp \ -# ../systemlib/mixer/mixer_simple.cpp \ \ No newline at end of file + ../systemlib/perf_counter.c \ + mixer.cpp \ + ../systemlib/mixer/mixer.cpp \ + ../systemlib/mixer/mixer_group.cpp \ + ../systemlib/mixer/mixer_multirotor.cpp \ + ../systemlib/mixer/mixer_simple.cpp \ + \ No newline at end of file diff --git a/src/modules/px4iofirmware/px4io.c b/src/modules/px4iofirmware/px4io.c index 6244b1551c..bc8dfc1167 100644 --- a/src/modules/px4iofirmware/px4io.c +++ b/src/modules/px4iofirmware/px4io.c @@ -207,7 +207,7 @@ user_start(int argc, char *argv[]) /* kick the mixer */ perf_begin(mixer_perf); - // mixer_tick(); + mixer_tick(); perf_end(mixer_perf); /* kick the control inputs */ diff --git a/src/modules/px4iofirmware/px4io.h b/src/modules/px4iofirmware/px4io.h index 3647842c0f..272cdb7bf4 100644 --- a/src/modules/px4iofirmware/px4io.h +++ b/src/modules/px4iofirmware/px4io.h @@ -148,8 +148,8 @@ extern struct sys_state_s system_state; /* * Mixer */ -//extern void mixer_tick(void); -//extern void mixer_handle_text(const void *buffer, size_t length); +extern void mixer_tick(void); +extern void mixer_handle_text(const void *buffer, size_t length); /** * Safety switch/LED. diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 64a87a58bc..6c09def9ee 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -245,7 +245,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num /* handle text going to the mixer parser */ case PX4IO_PAGE_MIXERLOAD: - //mixer_handle_text(values, num_values * sizeof(*values)); + mixer_handle_text(values, num_values * sizeof(*values)); break; default: From 4109874fc84339e3ee8a794b17d8bdd131313c51 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Sun, 28 Apr 2013 18:04:54 +0400 Subject: [PATCH 070/129] Reset offsets/scales before calibration and use prescaled values in m/s^2 instead of raw values. --- apps/commander/accelerometer_calibration.c | 128 ++++++++++++--------- apps/commander/accelerometer_calibration.h | 3 - 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c index f607b6da69..1807369080 100644 --- a/apps/commander/accelerometer_calibration.c +++ b/apps/commander/accelerometer_calibration.c @@ -78,6 +78,13 @@ #include #include +void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd); +int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs[3], float accel_scale[3]); +int detect_orientation(int mavlink_fd, int sub_sensor_combined); +int read_accelerometer_avg(int sensor_combined_sub, float accel_avg[3], int samples_num); +int mat_invert3(float src[3][3], float dst[3][3]); +int calculate_calibration_values(float accel_ref[6][3], float accel_T[3][3], float accel_offs[3], float g); + void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd) { /* announce change */ mavlink_log_info(mavlink_fd, "accel calibration started"); @@ -85,14 +92,16 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m status->flag_preflight_accel_calibration = true; state_machine_publish(status_pub, status, mavlink_fd); - float accel_offs_scaled[3]; + /* measure and calculate offsets & scales */ + float accel_offs[3]; float accel_scale[3]; - int res = do_accel_calibration_mesurements(mavlink_fd, accel_offs_scaled, accel_scale); + int res = do_accel_calibration_mesurements(mavlink_fd, accel_offs, accel_scale); + if (res == OK) { /* measurements complete successfully, set parameters */ - if (param_set(param_find("SENS_ACC_XOFF"), &(accel_offs_scaled[0])) - || param_set(param_find("SENS_ACC_YOFF"), &(accel_offs_scaled[1])) - || param_set(param_find("SENS_ACC_ZOFF"), &(accel_offs_scaled[2])) + if (param_set(param_find("SENS_ACC_XOFF"), &(accel_offs[0])) + || param_set(param_find("SENS_ACC_YOFF"), &(accel_offs[1])) + || param_set(param_find("SENS_ACC_ZOFF"), &(accel_offs[2])) || param_set(param_find("SENS_ACC_XSCALE"), &(accel_scale[0])) || param_set(param_find("SENS_ACC_YSCALE"), &(accel_scale[1])) || param_set(param_find("SENS_ACC_ZSCALE"), &(accel_scale[2]))) { @@ -101,11 +110,11 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m int fd = open(ACCEL_DEVICE_PATH, 0); struct accel_scale ascale = { - accel_offs_scaled[0], + accel_offs[0], accel_scale[0], - accel_offs_scaled[1], + accel_offs[1], accel_scale[1], - accel_offs_scaled[2], + accel_offs[2], accel_scale[2], }; @@ -139,12 +148,30 @@ void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int m state_machine_publish(status_pub, status, mavlink_fd); } -int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], float accel_scale[3]) { +int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs[3], float accel_scale[3]) { const int samples_num = 2500; - int16_t accel_raw_ref[6][3]; + float accel_ref[6][3]; bool data_collected[6] = { false, false, false, false, false, false }; const char *orientation_strs[6] = { "x+", "x-", "y+", "y-", "z+", "z-" }; + /* reset existing calibration */ + int fd = open(ACCEL_DEVICE_PATH, 0); + struct accel_scale ascale_null = { + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + }; + int ioctl_res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&ascale_null); + close(fd); + + if (OK != ioctl_res) { + warn("ERROR: failed to set scale / offsets for accel"); + return ERROR; + } + int sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined)); while (true) { bool done = true; @@ -167,8 +194,8 @@ int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], sprintf(str, "meas started: %s", orientation_strs[orient]); mavlink_log_info(mavlink_fd, str); - read_accelerometer_raw_avg(sensor_combined_sub, &(accel_raw_ref[orient][0]), samples_num); - str_ptr = sprintf(str, "meas result for %s: [ %i %i %i ]", orientation_strs[orient], accel_raw_ref[orient][0], accel_raw_ref[orient][1], accel_raw_ref[orient][2]); + read_accelerometer_avg(sensor_combined_sub, &(accel_ref[orient][0]), samples_num); + str_ptr = sprintf(str, "meas result for %s: [ %.2f %.2f %.2f ]", orientation_strs[orient], accel_ref[orient][0], accel_ref[orient][1], accel_ref[orient][2]); mavlink_log_info(mavlink_fd, str); data_collected[orient] = true; tune_confirm(); @@ -176,20 +203,20 @@ int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs_scaled[3], close(sensor_combined_sub); /* calculate offsets and rotation+scale matrix */ - int16_t accel_offs[3]; float accel_T[3][3]; - int res = calculate_calibration_values(accel_raw_ref, accel_T, accel_offs, CONSTANTS_ONE_G); + int res = calculate_calibration_values(accel_ref, accel_T, accel_offs, CONSTANTS_ONE_G); if (res != 0) { mavlink_log_info(mavlink_fd, "ERROR: calibration values calc error"); return ERROR; } - /* convert raw accel offset to scaled and transform matrix to scales - * rotation part of transform matrix is not used by now */ + /* convert accel transform matrix to scales, + * rotation part of transform matrix is not used by now + */ for (int i = 0; i < 3; i++) { - accel_offs_scaled[i] = accel_offs[i] * accel_T[i][i]; accel_scale[i] = accel_T[i][i]; } + return OK; } @@ -233,8 +260,8 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { t_prev = t; float w = dt / ema_len; for (int i = 0; i < 3; i++) { - accel_ema[i] = accel_ema[i] * (1.0f - w) + sensor.accelerometer_raw[i] * w; - float d = (float) sensor.accelerometer_raw[i] - accel_ema[i]; + accel_ema[i] = accel_ema[i] * (1.0f - w) + sensor.accelerometer_m_s2[i] * w; + float d = (float) sensor.accelerometer_m_s2[i] - accel_ema[i]; d = d * d; accel_disp[i] = accel_disp[i] * (1.0f - w); if (d > accel_disp[i]) @@ -273,9 +300,11 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { return -3; } if (t > t_timeout) { + mavlink_log_info(mavlink_fd, "ERROR: timeout"); return -1; } } + float accel_len = sqrt(accel_len2); float accel_err_thr_raw = accel_len * accel_err_thr; if ( fabs(accel_ema[0] - accel_len) < accel_err_thr_raw && @@ -302,56 +331,47 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { fabs(accel_ema[1]) < accel_err_thr_raw && fabs(accel_ema[2] + accel_len) < accel_err_thr_raw ) return 5; // [ 0, 0, -g ] + mavlink_log_info(mavlink_fd, "ERROR: invalid orientation"); + return -2; // Can't detect orientation } /* * Read specified number of accelerometer samples, calculate average and dispersion. */ -int read_accelerometer_raw_avg(int sensor_combined_sub, int16_t accel_avg[3], int samples_num) { +int read_accelerometer_avg(int sensor_combined_sub, float accel_avg[3], int samples_num) { struct pollfd fds[1] = { { .fd = sensor_combined_sub, .events = POLLIN } }; int count = 0; - int32_t accel_sum[3] = { 0, 0, 0 }; + float accel_sum[3] = { 0.0f, 0.0f, 0.0f }; + while (count < samples_num) { int poll_ret = poll(fds, 1, 1000); if (poll_ret == 1) { struct sensor_combined_s sensor; orb_copy(ORB_ID(sensor_combined), sensor_combined_sub, &sensor); - for (int i = 0; i < 3; i++) { - accel_sum[i] += sensor.accelerometer_raw[i]; - } + for (int i = 0; i < 3; i++) + accel_sum[i] += sensor.accelerometer_m_s2[i]; count++; } else { return ERROR; } } - for (int i = 0; i < 3; i++) { - accel_avg[i] = (accel_sum[i] + count / 2) / count; - } - /* calculate dispersion */ - return OK; -} -/* - * Convert raw values from accelerometers to m/s^2. - */ -void acceleration_raw_to_m_s2(float accel_corr[3], int16_t accel_raw[3], - float accel_T[3][3], int16_t accel_offs[3]) { for (int i = 0; i < 3; i++) { - accel_corr[i] = 0.0f; - for (int j = 0; j < 3; j++) { - accel_corr[i] += accel_T[i][j] * (accel_raw[j] - accel_offs[j]); - } + accel_avg[i] = accel_sum[i] / count; } + + return OK; } int mat_invert3(float src[3][3], float dst[3][3]) { float det = src[0][0] * (src[1][1] * src[2][2] - src[1][2] * src[2][1]) - - src[0][1] * (src[1][0] * src[2][2] - src[1][2] * src[2][0]) + - src[0][2] * (src[1][0] * src[2][1] - src[1][1] * src[2][0]); + src[0][1] * (src[1][0] * src[2][2] - src[1][2] * src[2][0]) + + src[0][2] * (src[1][0] * src[2][1] - src[1][1] * src[2][0]); if (det == 0.0) - return -1; // Singular matrix + return ERROR; // Singular matrix + dst[0][0] = (src[1][1] * src[2][2] - src[1][2] * src[2][1]) / det; dst[1][0] = (src[1][2] * src[2][0] - src[1][0] * src[2][2]) / det; dst[2][0] = (src[1][0] * src[2][1] - src[1][1] * src[2][0]) / det; @@ -361,34 +381,38 @@ int mat_invert3(float src[3][3], float dst[3][3]) { dst[0][2] = (src[0][1] * src[1][2] - src[0][2] * src[1][1]) / det; dst[1][2] = (src[0][2] * src[1][0] - src[0][0] * src[1][2]) / det; dst[2][2] = (src[0][0] * src[1][1] - src[0][1] * src[1][0]) / det; - return 0; + + return OK; } -int calculate_calibration_values(int16_t accel_raw_ref[6][3], - float accel_T[3][3], int16_t accel_offs[3], float g) { - /* calculate raw offsets */ +int calculate_calibration_values(float accel_ref[6][3], float accel_T[3][3], float accel_offs[3], float g) { + /* calculate offsets */ for (int i = 0; i < 3; i++) { - accel_offs[i] = (int16_t) (((int32_t) (accel_raw_ref[i * 2][i]) - + (int32_t) (accel_raw_ref[i * 2 + 1][i])) / 2); + accel_offs[i] = (accel_ref[i * 2][i] + accel_ref[i * 2 + 1][i]) / 2; } + /* fill matrix A for linear equations system*/ float mat_A[3][3]; memset(mat_A, 0, sizeof(mat_A)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - float a = (accel_raw_ref[i * 2][j] - accel_offs[j]); + float a = accel_ref[i * 2][j] - accel_offs[j]; mat_A[i][j] = a; } } + /* calculate inverse matrix for A */ float mat_A_inv[3][3]; - mat_invert3(mat_A, mat_A_inv); + if (mat_invert3(mat_A, mat_A_inv) != OK) + return ERROR; + + /* copy results to accel_T */ for (int i = 0; i < 3; i++) { - /* copy results to accel_T */ for (int j = 0; j < 3; j++) { /* simplify matrices mult because b has only one non-zero element == g at index i */ accel_T[j][i] = mat_A_inv[j][i] * g; } } - return 0; + + return OK; } diff --git a/apps/commander/accelerometer_calibration.h b/apps/commander/accelerometer_calibration.h index acf45b6b6e..c0169c2a13 100644 --- a/apps/commander/accelerometer_calibration.h +++ b/apps/commander/accelerometer_calibration.h @@ -12,8 +12,5 @@ #include void do_accel_calibration(int status_pub, struct vehicle_status_s *status, int mavlink_fd); -int detect_orientation(int mavlink_fd, int sub_sensor_combined); -int mat_invert3(float src[3][3], float dst[3][3]); -int calculate_calibration_values(int16_t accel_raw_ref[6][3], float accel_T[3][3], int16_t accel_offs[3], float g); #endif /* ACCELEROMETER_CALIBRATION_H_ */ From 525cc1a37c0c03edbda1ecbf9fdbc00f1b1bf0f8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Apr 2013 18:21:06 +0200 Subject: [PATCH 071/129] Added docs --- Documentation/control_flow.graffle | 16650 +++++++++++++++++++++++++++ 1 file changed, 16650 insertions(+) create mode 100644 Documentation/control_flow.graffle diff --git a/Documentation/control_flow.graffle b/Documentation/control_flow.graffle new file mode 100644 index 0000000000..2535231108 --- /dev/null +++ b/Documentation/control_flow.graffle @@ -0,0 +1,16650 @@ + + + + + ApplicationVersion + + com.omnigroup.OmniGraffle + 139.16.0.171715 + + CreationDate + 2013-02-22 17:51:02 +0000 + Creator + Lorenz Meier + GraphDocumentVersion + 8 + GuidesLocked + NO + GuidesVisible + YES + ImageCounter + 1 + LinksVisible + NO + MagnetsVisible + NO + MasterSheets + + ModificationDate + 2013-04-20 15:38:47 +0000 + Modifier + Lorenz Meier + NotesVisible + NO + OriginVisible + NO + PageBreaks + YES + PrintInfo + + NSBottomMargin + + float + 41 + + NSHorizonalPagination + + coded + BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG + + NSLeftMargin + + float + 18 + + NSPaperName + + string + iso-a3 + + NSPaperSize + + size + {842, 1191} + + NSPrintReverseOrientation + + int + 0 + + NSRightMargin + + float + 18 + + NSTopMargin + + float + 18 + + + ReadOnly + NO + Sheets + + + ActiveLayerIndex + 0 + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {806, 1132}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + DisplayScale + 1 0/72 in = 1.0000 in + GraphicsList + + + Bounds + {{320.41170773935767, 646.55758982070449}, {100, 24}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 46 + Line + + ID + 45 + Position + 0.49247664213180542 + RotationType + 0 + + Shape + Rectangle + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 limited / checked} + + Wrap + NO + + + Class + LineGraphic + Head + + ID + 44 + + ID + 45 + Points + + {283.47949897905681, 658.66217570036315} + {459.99996984645378, 658.44980851233595} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 29 + + + + Bounds + {{460.49996948242188, 640.30001831054688}, {248.00003051757812, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 44 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 ACTUATOR_CONTROLS_EFFECTIVE_0} + + + + Bounds + {{324, 353.1875}, {120, 28}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 43 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Align + 0 + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red68\green147\blue53;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\f0\fs24 \cf2 MAVLink:\ +'MANUAL_CONTROL'} + VerticalPad + 0 + + Wrap + NO + + + Bounds + {{324, 174.5}, {129, 28}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 42 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Align + 0 + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red68\green147\blue53;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural + +\f0\fs24 \cf2 MAVLink:\ +'RC_CHANNELS_RAW'} + VerticalPad + 0 + + Wrap + NO + + + Bounds + {{114.97958374023438, 786}, {191, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 40 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red68\green147\blue53;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf2 MAVLink: 'SERVO_OUTPUT_RAW'} + VerticalPad + 0 + + Wrap + NO + + + Bounds + {{528.5, 689}, {112, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 39 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red68\green147\blue53;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf2 MAVLink: 'ctrl eff 0-3'} + VerticalPad + 0 + + Wrap + NO + + + Class + LineGraphic + Head + + ID + 11 + + ID + 38 + Points + + {584.52245687751122, 125.49999965650382} + {584.56069426576869, 157.00000090441219} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 37 + + + + Bounds + {{448.5, 89}, {272, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 37 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 VEHICLE_GLOBAL_POSITION_SETPOINT /\ +VEHICLE_LOCAL_POSITION_SETPOINT} + + + + Class + LineGraphic + Head + + ID + 27 + + ID + 34 + Points + + {210.47275259888471, 495.87499981747118} + {210.43193555768113, 543.06250166479344} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 10 + + + + Bounds + {{108, 737.9375}, {205, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 33 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 ACTUATOR_OUTPUTS} + + + + Class + LineGraphic + Head + + ID + 29 + + ID + 32 + Points + + {210.46968123779743, 580.06249992316259} + {210.44442316539605, 627.25000030102035} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 27 + + + + Class + LineGraphic + Head + + ID + 33 + + ID + 30 + Points + + {210.48620562018775, 690.25} + {210.49612530146715, 737.4375} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 29 + + + + Bounds + {{137.97958374023438, 627.75}, {145, 62}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 29 + Shape + RoundRect + Style + + fill + + Color + + b + 1 + g + 0.814996 + r + 0.627106 + + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Actuator Mixer} + VerticalPad + 0 + + + + Bounds + {{107.97958374023438, 543.5625}, {205, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 27 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 ACTUATOR_CONTROLS_0} + + + + Bounds + {{394.22506405270201, 452.15000309396282}, {89, 24}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 25 + Line + + ID + 22 + Position + 0.5900501012802124 + RotationType + 0 + + Shape + Rectangle + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 if in auto mode} + + Wrap + NO + + + Bounds + {{152.49994329565658, 397.00120984204113}, {116, 24}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 24 + Line + + ID + 17 + Position + 0.49406537413597107 + RotationType + 0 + + Shape + Rectangle + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 if in stabilized mode} + + Wrap + NO + + + Class + LineGraphic + Head + + ID + 21 + + ID + 23 + OrthogonalBarAutomatic + + OrthogonalBarPoint + {0, 0} + OrthogonalBarPosition + -1 + Points + + {584.49994992834695, 220} + {584.4997453697481, 348.6875000000008} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 2 + TailArrow + 0 + + + Tail + + ID + 11 + + + + Class + LineGraphic + Head + + ID + 10 + + ID + 22 + OrthogonalBarAutomatic + + OrthogonalBarPoint + {0, 0} + OrthogonalBarPosition + 33.206413269042969 + Points + + {583.83119320765968, 385.68717359526977} + {581, 464} + {283.49994000956832, 464.30111342104294} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 2 + Pattern + 2 + TailArrow + 0 + + + Tail + + ID + 21 + + + + Bounds + {{482, 349.1875}, {205, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 21 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 VEHICLE_ATTITUDE_SETPOINT} + + + + Class + LineGraphic + Head + + ID + 10 + + ID + 17 + Points + + {210.49997491180866, 385.6875} + {210.49991091996927, 432.875} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + Pattern + 2 + TailArrow + 0 + + + Tail + + ID + 6 + + + + Class + LineGraphic + Head + + ID + 5 + + ID + 16 + Points + + {283.49999999999511, 270.00001907176534} + {339.50000000000028, 270.00001907176534} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 9 + + + + Class + LineGraphic + Head + + ID + 6 + + ID + 15 + Points + + {210.49998770563047, 301.5} + {210.49998770563047, 348.6875} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 9 + + + + Class + LineGraphic + Head + + ID + 9 + + ID + 13 + Points + + {210.49171354592596, 207} + {210.49498558851923, 238.4999999999998} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 4 + + + + Class + LineGraphic + Head + + ID + 4 + + ID + 12 + Points + + {210.49498558851246, 138.5000000000002} + {210.48997117702493, 170.00000000001342} + + Style + + stroke + + HeadArrow + FilledArrow + Legacy + + LineType + 1 + TailArrow + 0 + + + Tail + + ID + 8 + + + + Bounds + {{512, 157.5}, {145, 62}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 11 + Shape + RoundRect + Style + + fill + + Color + + b + 0.999136 + g + 0.808554 + r + 0.587078 + + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Position Controller} + VerticalPad + 0 + + + + Bounds + {{138, 433.375}, {145, 62}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 10 + Shape + RoundRect + Style + + fill + + Color + + b + 1 + g + 0.814996 + r + 0.627106 + + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Attitude Controller} + VerticalPad + 0 + + + + Bounds + {{138, 239}, {145, 62}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 9 + Shape + RoundRect + Style + + fill + + Color + + b + 0.366082 + g + 0.639788 + r + 1 + + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 RC scaling and function mapping} + VerticalPad + 0 + + + + Bounds + {{138, 76}, {145, 62}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 8 + Shape + RoundRect + Style + + fill + + Color + + b + 0.324773 + g + 0.632962 + r + 0.99252 + + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 RC Input\ +PX4IO or PX4FMU} + VerticalPad + 0 + + + + Bounds + {{108, 349.1875}, {205, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 6 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 MANUAL_CONTROL_SETPOINT} + + + + Bounds + {{340, 252}, {115, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 5 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 RC_CHANNELS} + + + + Bounds + {{108, 170.5}, {204.97958374023438, 36}} + Class + ShapedGraphic + FontInfo + + Font + Helvetica + Size + 12 + + ID + 4 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\i\fs24 \cf0 INPUT_RC} + + + + GridInfo + + HPages + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + Orientation + 2 + PrintOnePage + + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Canvas 1 + UniqueID + 1 + VPages + 1 + + + ActiveLayerIndex + 0 + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {806, 1132}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + DisplayScale + 1 0/72 in = 1.0000 in + GraphicsList + + + Bounds + {{129, 170}, {83, 44}} + Class + ShapedGraphic + ID + 4 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + GridInfo + + HPages + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + Orientation + 2 + PrintOnePage + + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Remote Control + UniqueID + 5 + VPages + 1 + + + ActiveLayerIndex + 0 + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {806, 1132}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + DisplayScale + 1 0/72 in = 1.0000 in + GraphicsList + + + Class + Group + Graphics + + + Bounds + {{575.98995971679688, 379}, {47, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1124 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 QUAD +\b0 X} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Bounds + {{576.13064904528869, 216.6250047923653}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 1126 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{565.46398168220912, 200.5990128790099}, {72, 72}} + Class + ShapedGraphic + ID + 1127 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 1125 + Rotation + 315 + + + Class + Group + Graphics + + + Bounds + {{684.97877057518497, 320.1208883952101}, {24, 24}} + Class + ShapedGraphic + ID + 1129 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1131 + Points + + {744.59415627118847, 308.1935744741462} + {742.38444757998036, 309.34262299357425} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{656.69108999710829, 361.8760779997491}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1132 + Rotation + 45 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{646.29122523639319, 281.66198172978545}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1133 + Rotation + 135 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{643.54122523639319, 278.91198172978545}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1134 + Rotation + 135 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1130 + Rotation + 315 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1136 + Points + + {649.54722336322868, 356.21791362626482} + {651.75693205443667, 355.0688651068366} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{721.45028963730863, 284.03541010066203}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1137 + Rotation + 225 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{646.35015439802385, 281.24950637062551}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1138 + Rotation + 315 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{643.60015439802385, 278.49950637062551}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1139 + Rotation + 315 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1135 + Rotation + 315 + + + Bounds + {{646.0670873832953, 281.20919655324775}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1140 + Rotation + 315 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1128 + Rotation + 315 + + + Class + Group + Graphics + + + Bounds + {{494.01518801866729, 320.05486147948341}, {24, 24}} + Class + ShapedGraphic + ID + 1142 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1144 + Points + + {458.75335031844725, 307.77399956263616} + {460.96305900965541, 308.92304808206421} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{530.65641659252742, 361.45650308823895}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1145 + Rotation + 135 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{455.55628135324292, 281.24240681827519}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1146 + Rotation + 45 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{452.80628135324292, 278.49240681827519}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1147 + Rotation + 45 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1143 + Rotation + 225 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1149 + Points + + {553.44673702887792, 356.15188491228344} + {551.23702833767004, 355.00283639285527} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{465.54367075479814, 283.96938138668088}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1150 + Rotation + 315 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{455.14380599408253, 281.1834776566443}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1151 + Rotation + 225 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{452.39380599408253, 278.4334776566443}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1152 + Rotation + 225 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1148 + Rotation + 225 + VFlip + YES + + + Bounds + {{455.10349617670488, 281.1431681805102}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1153 + Rotation + 225 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1141 + Rotation + 315 + + + Class + Group + Graphics + + + Bounds + {{684.74305392865585, 129.32699556949493}, {24, 24}} + Class + ShapedGraphic + ID + 1155 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1157 + Points + + {649.48121622843564, 117.04613365264774} + {651.69092491964352, 118.19518217207589} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{721.38428250251582, 170.72863717825052}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1158 + Rotation + 135 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{646.28414726323126, 90.514540908286847}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1159 + Rotation + 45 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{643.53414726323126, 87.764540908286847}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1160 + Rotation + 45 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1156 + Rotation + 225 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1162 + Points + + {744.17460293886643, 165.42401900229501} + {741.96489424765866, 164.27497048286693} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{656.27153666478659, 93.241515476692427}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1163 + Rotation + 315 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{645.87167190407115, 90.455611746655876}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1164 + Rotation + 225 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{643.12167190407115, 87.705611746655876}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1165 + Rotation + 225 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1161 + Rotation + 225 + VFlip + YES + + + Bounds + {{645.83136208669339, 90.415302270521892}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1166 + Rotation + 225 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1154 + Rotation + 315 + + + Class + Group + Graphics + + + Bounds + {{494.00811680064464, 129.15022794494948}, {24, 24}} + Class + ShapedGraphic + ID + 1168 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1170 + Points + + {553.62350249664826, 117.22291402388569} + {551.41379380544015, 118.37196254331369} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{465.72043622256808, 170.9054175494887}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1171 + Rotation + 45 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{455.32057146185286, 90.691321279524772}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1172 + Rotation + 135 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{452.57057146185286, 87.941321279524772}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1173 + Rotation + 135 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1169 + Rotation + 315 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1175 + Points + + {458.57656958868847, 165.24725317600405} + {460.78627827989641, 164.09820465657594} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{530.47963586276819, 93.064749650401353}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1176 + Rotation + 225 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{455.37950062348352, 90.278845920365001}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1177 + Rotation + 315 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{452.62950062348352, 87.528845920365001}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1178 + Rotation + 315 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1174 + Rotation + 315 + + + Bounds + {{455.09643360875504, 90.238536102987126}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1179 + Rotation + 315 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1167 + Rotation + 315 + + + Bounds + {{547.25939156789127, 219.8035943432547}, {8, 134}} + Class + ShapedGraphic + ID + 1180 + Rotation + 225 + Shape + Rectangle + + + Bounds + {{647.66855809291212, 119.39442062517122}, {8, 134}} + Class + ShapedGraphic + ID + 1181 + Rotation + 225 + Shape + Rectangle + + + Bounds + {{647.66855089985006, 219.80357636059938}, {8, 134}} + Class + ShapedGraphic + ID + 1182 + Rotation + 315 + Shape + Rectangle + + + Bounds + {{547.20046240626141, 119.33550225313491}, {8, 134}} + Class + ShapedGraphic + ID + 1183 + Rotation + 315 + Shape + Rectangle + + + ID + 1123 + + + Bounds + {{287.14883422851562, 373}, {46, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1121 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 QUAD +\b0 +} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{252.93672553699014, 864.96332065264312}, {24, 24}} + Class + ShapedGraphic + ID + 1186 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 6} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1188 + Points + + {248.68672172228349, 826.3749926090228} + {249.43672172228361, 828.7499926090228} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{252.68672172228372, 918.12499260902291}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1189 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{214.43672172228372, 826.3749926090228}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1190 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{211.68672172228372, 823.6249926090228}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1191 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1187 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1193 + Points + + {281.43672680854809, 927.54165927568897} + {280.6867268085482, 925.1666592756892} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{261.43672680854797, 817.2916592756892}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1194 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{214.18672680854797, 826.0416592756892}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1195 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{211.43672680854797, 823.2916592756892}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1196 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1192 + Rotation + 270 + VFlip + YES + + + Bounds + {{214.02503832182103, 826.05162629068673}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1197 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1185 + + + Class + Group + Graphics + + + Bounds + {{255.93671290080545, 636.38001505533919}, {24, 24}} + Class + ShapedGraphic + ID + 1199 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 5} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1201 + Points + + {251.6867090860988, 597.79168701171886} + {252.43670908609892, 600.16668701171886} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{255.68670908609903, 689.54168701171898}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1202 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{217.43670908609903, 597.79168701171886}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1203 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{214.68670908609903, 595.04168701171886}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1204 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1200 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1206 + Points + + {284.43671417236339, 698.95835367838504} + {283.68671417236351, 696.58335367838527} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{264.43671417236328, 588.70835367838527}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1207 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{217.18671417236328, 597.45835367838527}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1208 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{214.43671417236328, 594.70835367838527}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1209 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1205 + Rotation + 270 + VFlip + YES + + + Bounds + {{217.02502568563636, 597.46832069338279}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1210 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1198 + + + Class + Group + Graphics + + + Bounds + {{480.49999872844216, 864.96333555380545}, {24, 24}} + Class + ShapedGraphic + ID + 1212 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1214 + Points + + {476.24999491373552, 826.37500751018513} + {476.99999491373563, 828.75000751018513} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{480.24999491373575, 918.12500751018524}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1215 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{441.99999491373575, 826.37500751018513}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1216 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{439.24999491373575, 823.62500751018513}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1217 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1213 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1219 + Points + + {509.00000000000011, 927.5416741768513} + {508.25000000000023, 925.16667417685153} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{489, 817.29167417685153}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1220 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{441.75, 826.04167417685153}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1221 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{439, 823.29167417685153}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1222 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1218 + Rotation + 270 + VFlip + YES + + + Bounds + {{441.58831151327308, 826.05164119184906}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1223 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1211 + + + Class + Group + Graphics + + + Bounds + {{480.49999872844216, 636.38001505533896}, {24, 24}} + Class + ShapedGraphic + ID + 1225 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1227 + Points + + {476.24999491373552, 597.79168701171864} + {476.99999491373563, 600.16668701171864} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{480.24999491373575, 689.54168701171875}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1228 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{441.99999491373575, 597.79168701171864}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1229 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{439.24999491373575, 595.04168701171864}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1230 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1226 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1232 + Points + + {509.00000000000011, 698.95835367838481} + {508.25000000000023, 696.58335367838504} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{489, 588.70835367838504}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1233 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{441.75, 597.45835367838504}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1234 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{439, 594.70835367838504}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1235 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1231 + Rotation + 270 + VFlip + YES + + + Bounds + {{441.58831151327308, 597.46832069338257}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1236 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1224 + + + Bounds + {{452.7625732421875, 947.72591400146473}, {45, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1237 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 OCTO +\b0 +} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Bounds + {{353.51001119036124, 739.42163658141953}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 1239 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{342.8433593880041, 726.66665752440122}, {72, 72}} + Class + ShapedGraphic + ID + 1240 + Rotation + 45 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 1238 + + + Class + Group + Graphics + + + Bounds + {{366.83836873372331, 916.58333714803678}, {24, 24}} + Class + ShapedGraphic + ID + 1242 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1244 + Points + + {429.42669677734398, 945.3333333333303} + {427.05169677734398, 944.58333333333019} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{320.42669677734375, 924.08333333333019}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1245 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{327.92669677734398, 878.08333333333019}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1246 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{325.17669677734398, 875.33333333333019}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1247 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1243 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1249 + Points + + {328.26003011067723, 912.08333841959472} + {330.63503011067723, 912.83333841959472} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{421.26003011067723, 914.83333841959472}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1250 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{328.26003011067723, 877.83333841959472}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1251 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{325.51003011067723, 875.08333841959472}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1252 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1248 + + + Bounds + {{327.92668660481695, 877.67164993286758}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1253 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1241 + + + Class + Group + Graphics + + + Bounds + {{205.66167195637968, 750.54168065389615}, {24, 24}} + Class + ShapedGraphic + ID + 1255 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 7} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1257 + Points + + {268.25000000000023, 779.29167683918968} + {265.87500000000023, 778.54167683918956} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{159.24999999999994, 758.04167683918956}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1258 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{166.75, 712.04167683918956}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1259 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{164, 709.29167683918956}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1260 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1256 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1262 + Points + + {167.08333333333348, 746.0416819254541} + {169.45833333333348, 746.7916819254541} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{260.08333333333348, 748.7916819254541}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1263 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{167.08333333333348, 711.7916819254541}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1264 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{164.33333333333348, 709.0416819254541}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1265 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1261 + + + Bounds + {{166.74998982747337, 711.62999343872696}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1266 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1254 + + + Class + Group + Graphics + + + Bounds + {{528.01506551106706, 750.54168065389615}, {24, 24}} + Class + ShapedGraphic + ID + 1268 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 8} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1270 + Points + + {590.60339355468773, 779.29167683918968} + {588.22839355468773, 778.54167683918956} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{481.6033935546875, 758.04167683918956}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1271 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{489.10339355468773, 712.04167683918956}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1272 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{486.35339355468773, 709.29167683918956}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1273 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1269 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1275 + Points + + {489.43672688802098, 746.0416819254541} + {491.81172688802098, 746.7916819254541} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{582.43672688802098, 748.7916819254541}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1276 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{489.43672688802098, 711.7916819254541}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1277 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{486.68672688802098, 709.0416819254541}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1278 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1274 + + + Bounds + {{489.10338338216064, 711.62999343872696}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1279 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1267 + + + Bounds + {{306.14882584901056, 766.45459545146662}, {8, 134}} + Class + ShapedGraphic + ID + 1280 + Rotation + 225 + Shape + Rectangle + + + Bounds + {{468.3533935546875, 695.66666666666504}, {8, 134}} + Class + ShapedGraphic + ID + 1281 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{440.55795213074884, 760.88380015384382}, {8, 134}} + Class + ShapedGraphic + ID + 1282 + Rotation + 135 + Shape + Rectangle + + + Class + Group + Graphics + + + Bounds + {{366.83834838867119, 584.49999872844194}, {24, 24}} + Class + ShapedGraphic + ID + 1284 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1286 + Points + + {429.42667643229174, 613.24999491373558} + {427.05167643229174, 612.49999491373546} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{320.42667643229152, 591.99999491373546}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1287 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{327.92667643229174, 545.99999491373546}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1288 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{325.17667643229174, 543.24999491373546}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1289 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1285 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1291 + Points + + {328.26000976562511, 579.99999999999977} + {330.63500976562511, 580.74999999999977} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{421.260009765625, 582.74999999999977}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1292 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{328.26000976562523, 545.74999999999977}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1293 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{325.51000976562523, 542.99999999999977}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1294 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1290 + + + Bounds + {{327.92666625976494, 545.58831151327263}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1295 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1283 + + + Bounds + {{281.3533935546875, 695.66666666666504}, {8, 134}} + Class + ShapedGraphic + ID + 1296 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{442.5579845556756, 629.04542696963983}, {8, 134}} + Class + ShapedGraphic + ID + 1297 + Rotation + 225 + Shape + Rectangle + + + Bounds + {{374.84336344400776, 790.58333841959472}, {8, 134}} + Class + ShapedGraphic + ID + 1298 + Shape + Rectangle + + + Bounds + {{374.84335708617891, 600.24999491373535}, {8, 134}} + Class + ShapedGraphic + ID + 1299 + Shape + Rectangle + + + Bounds + {{309.12873002381525, 629.45457637798029}, {8, 134}} + Class + ShapedGraphic + ID + 1300 + Rotation + 135 + Shape + Rectangle + + + ID + 1184 + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{181.15661763567644, 222.11968549092626}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 1024 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{170.4899658333193, 209.364706433908}, {72, 72}} + Class + ShapedGraphic + ID + 1025 + Rotation + 45 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 1023 + + + Class + Group + Graphics + + + Bounds + {{194.48495483398159, 368.44802729289523}, {24, 24}} + Class + ShapedGraphic + ID + 1027 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1029 + Points + + {257.0732828776022, 397.19802347818882} + {254.69828287760208, 396.4480234781887} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{148.07328287760188, 375.9480234781887}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1030 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{155.57328287760205, 329.9480234781887}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1031 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{152.82328287760205, 327.1980234781887}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1032 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1028 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1034 + Points + + {155.90661621093548, 363.94802856445312} + {158.28161621093548, 364.69802856445312} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{248.90661621093545, 366.69802856445312}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1035 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{155.90661621093548, 329.69802856445312}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1036 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{153.15661621093548, 326.94802856445312}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1037 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1033 + + + Bounds + {{155.57327270507534, 329.53634007772598}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1038 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1026 + + + Class + Group + Graphics + + + Bounds + {{59.499998728441994, 233.36969502765339}, {24, 24}} + Class + ShapedGraphic + ID + 1040 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1042 + Points + + {55.249994913735321, 194.78136698403296} + {55.999994913735435, 197.1563669840329} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{59.249994913735435, 286.53136698403307}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1043 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{20.999994913735549, 194.78136698403301}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1044 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{18.249994913735549, 192.03136698403301}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1045 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1041 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1047 + Points + + {87.999999999999915, 295.9480336506993} + {87.250000000000028, 293.57303365069941} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{67.999999999999915, 185.69803365069959}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1048 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{20.749999999999915, 194.44803365069947}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1049 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{17.999999999999915, 191.69803365069947}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1050 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1046 + Rotation + 270 + VFlip + YES + + + Bounds + {{20.588311513272686, 194.45800066569694}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1051 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1039 + + + Class + Group + Graphics + + + Bounds + {{329.22993342082486, 233.36969502765339}, {24, 24}} + Class + ShapedGraphic + ID + 1053 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1055 + Points + + {324.97992960611816, 194.7813669840329} + {325.72992960611828, 197.15636698403287} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{328.97992960611828, 286.53136698403307}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1056 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{290.72992960611839, 194.78136698403301}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1057 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{287.97992960611839, 192.03136698403301}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1058 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1054 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1060 + Points + + {357.72993469238281, 295.9480336506993} + {356.97993469238293, 293.57303365069941} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{337.72993469238281, 185.69803365069953}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1061 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{290.47993469238281, 194.44803365069947}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1062 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{287.72993469238281, 191.69803365069947}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1063 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1059 + Rotation + 270 + VFlip + YES + + + Bounds + {{290.31824620565556, 194.45800066569686}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1064 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1052 + + + Class + Group + Graphics + + + Bounds + {{194.48495483398159, 92.448027292895233}, {24, 24}} + Class + ShapedGraphic + ID + 1066 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1068 + Points + + {257.0732828776022, 121.19802347818882} + {254.69828287760208, 120.4480234781887} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{148.07328287760188, 99.948023478188702}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1069 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{155.57328287760205, 53.948023478188688}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1070 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{152.82328287760205, 51.198023478188688}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1071 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1067 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1073 + Points + + {155.90661621093548, 87.948028564453111} + {158.28161621093548, 88.698028564453111} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{248.90661621093545, 90.698028564453111}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1074 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{155.90661621093548, 53.698028564453111}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1075 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{153.15661621093548, 50.948028564453111}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1076 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1072 + + + Bounds + {{155.57327270507534, 53.536340077725967}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1077 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1065 + + + Bounds + {{131.48995971679412, 178.36470031738281}, {8, 134}} + Class + ShapedGraphic + ID + 1078 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{273.48996988932043, 178.36469523111947}, {8, 134}} + Class + ShapedGraphic + ID + 1079 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{202.48996988932029, 249.36468505859375}, {8, 134}} + Class + ShapedGraphic + ID + 1080 + Shape + Rectangle + + + Bounds + {{202.48995971679412, 107.28136189778644}, {8, 134}} + Class + ShapedGraphic + ID + 1081 + Shape + Rectangle + + + ID + 1022 + + + GridInfo + + HPages + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + Orientation + 2 + PrintOnePage + + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Rotor Assignments + UniqueID + 2 + VPages + 1 + + + ActiveLayerIndex + 0 + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {806, 1132}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + DisplayScale + 1 0/72 in = 1.0000 in + GraphicsList + + + Bounds + {{479, 926}, {45, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1210 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 HEXA +\b0 X} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{323.13577025880016, 749.76557170439401}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 1124 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{312.46911845644303, 737.01059264737569}, {72, 72}} + Class + ShapedGraphic + ID + 1125 + Rotation + 45 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 1123 + + + Class + Group + Graphics + + + Bounds + {{407.17230315305846, 883.72204834096681}, {24, 24}} + Class + ShapedGraphic + ID + 1127 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1129 + Points + + {379.80522301611819, 860.03627302756399} + {381.64224206895665, 861.71808336155198} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{432.69752786153174, 932.25483880979243}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1130 + Rotation + 150 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{368.7196421785618, 844.9870622696244}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1131 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{365.9696421785618, 842.2370622696244}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1132 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1128 + Rotation + 240 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1134 + Points + + {458.75089272822612, 931.27417383395721} + {456.91387367538789, 929.59236349996911} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{389.85858788281303, 840.55560805172911}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1135 + Rotation + 330 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{368.33647356578285, 844.82338459189691}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1136 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{365.58647356578285, 842.07338459189691}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1137 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1133 + Rotation + 240 + VFlip + YES + + + Bounds + {{368.26061274159781, 844.81035428333826}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1138 + Rotation + 240 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1126 + Rotation + 330 + + + Class + Group + Graphics + + + Bounds + {{267.75726457856609, 881.27816449485533}, {24, 24}} + Class + ShapedGraphic + ID + 1140 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 6} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1142 + Points + + {331.94303989196902, 882.48992268280176} + {329.51122955798087, 883.02790362996325} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{230.47447410974044, 913.3476178373885}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1143 + Rotation + 60 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{228.99225064990861, 842.82550352035832}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1144 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{226.24225064990861, 840.07550352035832}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1145 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1141 + Rotation + 330 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1147 + Points + + {227.70513908557558, 904.27791574513662} + {230.13694941956365, 903.73993479797491} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{313.17370486780385, 854.92022059054989}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1148 + Rotation + 240 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{229.15592832763582, 842.44233490757972}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1149 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{226.40592832763582, 839.69233490757972}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1150 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1146 + Rotation + 330 + + + Bounds + {{228.84558214533197, 842.36647408339456}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1151 + Rotation + 330 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1139 + Rotation + 330 + + + Class + Group + Graphics + + + Bounds + {{474.97119637474935, 761.64314519248808}, {24, 24}} + Class + ShapedGraphic + ID + 1153 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1155 + Points + + {539.15697168815223, 762.85490338043462} + {536.72516135416413, 763.39288432759611} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{437.68840590592367, 793.71259853502136}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1156 + Rotation + 60 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{436.20618244609187, 723.19048421799118}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1157 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{433.45618244609187, 720.44048421799118}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1158 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1154 + Rotation + 330 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1160 + Points + + {434.91907088175884, 784.64289644276937} + {437.35088121574688, 784.10491549560766} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{520.38763666398711, 735.28520128818252}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1161 + Rotation + 240 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{436.36986012381902, 722.80731560521247}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1162 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{433.61986012381902, 720.05731560521247}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1163 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1159 + Rotation + 330 + + + Bounds + {{436.05951394151521, 722.73145478102731}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1164 + Rotation + 330 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1152 + Rotation + 330 + + + Class + Group + Graphics + + + Bounds + {{197.82245308809811, 760.38763453076365}, {24, 24}} + Class + ShapedGraphic + ID + 1166 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1168 + Points + + {170.45537295115798, 736.70185921736106} + {172.29239200399638, 738.38366955134893} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{223.34767779657142, 808.92042499958939}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1169 + Rotation + 150 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{159.36979211360145, 721.65264845942124}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1170 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{156.61979211360145, 718.90264845942124}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1171 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1167 + Rotation + 240 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1173 + Points + + {249.4010426632658, 807.93976002375393} + {247.56402361042768, 806.25794968976606} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{180.50873781785265, 717.22119424152584}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1174 + Rotation + 330 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{158.98662350082267, 721.48897078169387}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1175 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{156.23662350082267, 718.73897078169387}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1176 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1172 + Rotation + 240 + VFlip + YES + + + Bounds + {{158.91076267663743, 721.47594047313521}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1177 + Rotation + 240 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1165 + Rotation + 330 + + + Class + Group + Graphics + + + Bounds + {{405.7864385681853, 642.051622339657}, {24, 24}} + Class + ShapedGraphic + ID + 1179 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 5} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1181 + Points + + {378.41935843124503, 618.36584702625407} + {380.25637748408349, 620.04765736024217} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{431.31166327665852, 690.58441280848263}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1182 + Rotation + 150 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{367.33377759368858, 603.3166362683146}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1183 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{364.58377759368858, 600.5666362683146}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1184 + Rotation + 60 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1180 + Rotation + 240 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1186 + Points + + {457.36502814335307, 689.6037478326474} + {455.52800909051496, 687.92193749865953} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{388.47272329793987, 598.8851820504193}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1187 + Rotation + 330 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{366.95060898090981, 603.15295859058722}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1188 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{364.20060898090981, 600.40295859058722}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1189 + Rotation + 240 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1185 + Rotation + 240 + VFlip + YES + + + Bounds + {{366.87474815672459, 603.13992828202845}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1190 + Rotation + 240 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1178 + Rotation + 330 + + + Bounds + {{416.05401025695778, 706.97194681357246}, {8, 134}} + Class + ShapedGraphic + ID + 1191 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{273.20840928884093, 706.24568349439642}, {8, 134}} + Class + ShapedGraphic + ID + 1192 + Rotation + 270 + Shape + Rectangle + + + Bounds + {{309.23428435411637, 768.64435011115415}, {8, 134}} + Class + ShapedGraphic + ID + 1193 + Rotation + 30 + Shape + Rectangle + + + Bounds + {{380.02813770004576, 644.57328454142464}, {8, 134}} + Class + ShapedGraphic + ID + 1194 + Rotation + 30 + Shape + Rectangle + + + Class + Group + Graphics + + + Bounds + {{268.61421230672084, 643.49244485638758}, {24, 24}} + Class + ShapedGraphic + ID + 1196 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1198 + Points + + {332.79998762012377, 644.70420304433412} + {330.36817728613562, 645.24218399149561} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{231.33142183789516, 675.56189819892086}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1199 + Rotation + 60 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{229.84919837806336, 605.03978388189068}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1200 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{227.09919837806336, 602.28978388189068}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1201 + Rotation + 150 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1197 + Rotation + 330 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1203 + Points + + {228.56208681373033, 666.49219610666887} + {230.99389714771837, 665.95421515950716} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{314.03065259595854, 617.13450095208213}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1204 + Rotation + 240 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{230.01287605579051, 604.65661526911197}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1205 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{227.26287605579051, 601.90661526911197}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1206 + Rotation + 330 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1202 + Rotation + 330 + + + Bounds + {{229.7025298734867, 604.58075444492681}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1207 + Rotation + 330 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1195 + Rotation + 330 + + + Bounds + {{380.57688435489479, 768.55104482376805}, {8, 134}} + Class + ShapedGraphic + ID + 1208 + Rotation + 330 + Shape + Rectangle + + + Bounds + {{309.53521396482506, 645.50328259865807}, {8, 134}} + Class + ShapedGraphic + ID + 1209 + Rotation + 330 + Shape + Rectangle + + + ID + 1122 + Rotation + 330 + + + Bounds + {{431, 450}, {44, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1121 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 HEXA +\b0 +} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{326.15660523791308, 258.95613225301122}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 320 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{315.48995343555595, 246.20115319599296}, {72, 72}} + Class + ShapedGraphic + ID + 321 + Rotation + 45 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 319 + + + Class + Group + Graphics + + + Bounds + {{339.36497966449247, 411.82398351031941}, {24, 24}} + Class + ShapedGraphic + ID + 323 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 325 + Points + + {335.11497584978588, 373.23565546669897} + {335.86497584978599, 375.61065546669897} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{339.11497584978599, 464.98565546669914}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 326 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{300.86497584978611, 373.23565546669909}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 327 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{298.11497584978611, 370.48565546669909}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 328 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 324 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 330 + Points + + {367.86498093605042, 474.40232213336532} + {367.11498093605053, 472.02732213336543} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{347.86498093605042, 364.15232213336554}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 331 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{300.61498093605042, 372.90232213336543}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 332 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{297.86498093605042, 370.15232213336543}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 333 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 329 + Rotation + 270 + VFlip + YES + + + Bounds + {{300.45329244932327, 372.91228914836296}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 334 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 322 + + + Class + Group + Graphics + + + Bounds + {{219.84995651245046, 339.99999872844211}, {24, 24}} + Class + ShapedGraphic + ID + 336 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 338 + Points + + {282.43828455607104, 368.74999491373569} + {280.06328455607098, 367.99999491373558} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{173.43828455607076, 347.49999491373558}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 339 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{180.93828455607093, 301.49999491373558}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 340 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{178.18828455607093, 298.74999491373558}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 341 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 337 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 343 + Points + + {181.27161788940435, 335.5} + {183.64661788940435, 336.25} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{274.2716178894043, 338.25}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 344 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{181.27161788940435, 301.25}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 345 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{178.52161788940435, 298.5}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 346 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 342 + + + Bounds + {{180.93827438354421, 301.08831151327286}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 347 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 335 + + + Class + Group + Graphics + + + Bounds + {{459.11999511718477, 339.99999872844211}, {24, 24}} + Class + ShapedGraphic + ID + 349 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 6} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 351 + Points + + {521.70832316080532, 368.74999491373569} + {519.33332316080532, 367.99999491373558} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{412.70832316080504, 347.49999491373558}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 352 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{420.20832316080521, 301.49999491373558}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 353 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{417.45832316080521, 298.74999491373558}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 354 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 350 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 356 + Points + + {420.54165649413864, 335.5} + {422.91665649413864, 336.25} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{513.54165649413858, 338.25}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 357 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{420.54165649413864, 301.25}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 358 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{417.79165649413864, 298.5}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 359 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 355 + + + Bounds + {{420.20831298827852, 301.08831151327286}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 360 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 348 + + + Class + Group + Graphics + + + Bounds + {{219.72989813487507, 200.33832295734095}, {24, 24}} + Class + ShapedGraphic + ID + 362 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 5} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 364 + Points + + {215.47989432016846, 161.74999491372051} + {216.22989432016857, 164.12499491372046} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{219.47989432016857, 253.49999491372063}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 365 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{181.22989432016868, 161.74999491372057}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 366 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{178.47989432016868, 158.99999491372057}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 367 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 363 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 369 + Points + + {248.22989940643305, 262.91666158038686} + {247.47989940643316, 260.54166158038697} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{228.22989940643305, 152.66666158038709}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 370 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{180.97989940643305, 161.41666158038697}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 371 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{178.22989940643305, 158.66666158038697}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 372 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 368 + Rotation + 270 + VFlip + YES + + + Bounds + {{180.81821091970582, 161.42662859538444}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 373 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 361 + + + Class + Group + Graphics + + + Bounds + {{458.99999872844205, 201.83832295734095}, {24, 24}} + Class + ShapedGraphic + ID + 375 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 377 + Points + + {454.74999491373541, 163.24999491372051} + {455.49999491373552, 165.62499491372046} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{458.74999491373552, 254.99999491372063}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 378 + Rotation + 180 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{420.49999491373563, 163.24999491372057}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 379 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{417.74999491373563, 160.49999491372057}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 380 + Rotation + 90 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 376 + Rotation + 270 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 382 + Points + + {487.5, 264.41666158038686} + {486.75000000000011, 262.04166158038697} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{467.5, 154.16666158038709}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 383 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{420.25, 162.91666158038697}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 384 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{417.5, 160.16666158038697}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 385 + Rotation + 270 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 381 + Rotation + 270 + VFlip + YES + + + Bounds + {{420.0883115132728, 162.92662859538444}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 386 + Rotation + 270 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 374 + + + Bounds + {{409.00361117886365, 251.82615622621091}, {8, 134}} + Class + ShapedGraphic + ID + 387 + Rotation + 300 + Shape + Rectangle + + + Bounds + {{285.65882358120746, 179.77439325790914}, {8, 134}} + Class + ShapedGraphic + ID + 388 + Rotation + 300 + Shape + Rectangle + + + Bounds + {{285.65881327292152, 251.82616124293514}, {8, 134}} + Class + ShapedGraphic + ID + 389 + Rotation + 60 + Shape + Rectangle + + + Bounds + {{409.00362148715112, 179.77439325790914}, {8, 134}} + Class + ShapedGraphic + ID + 390 + Rotation + 60 + Shape + Rectangle + + + Class + Group + Graphics + + + Bounds + {{339.48495483398165, 134.49999872844211}, {24, 24}} + Class + ShapedGraphic + ID + 392 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 394 + Points + + {402.0732828776022, 163.24999491373569} + {399.69828287760214, 162.49999491373558} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{293.07328287760191, 141.99999491373558}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 395 + Rotation + 90 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{300.57328287760208, 95.999994913735577}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 396 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{297.82328287760208, 93.249994913735577}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 397 + Rotation + 180 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 393 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 399 + Points + + {300.90661621093551, 130} + {303.28161621093551, 130.75} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{393.90661621093545, 132.75}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 400 + Rotation + 270 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{300.90661621093551, 95.75}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 401 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{298.15661621093551, 93}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 402 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 398 + + + Bounds + {{300.5732727050754, 95.588311513272842}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 403 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 391 + + + Bounds + {{347.48996988932038, 287.41665649414062}, {8, 134}} + Class + ShapedGraphic + ID + 404 + Shape + Rectangle + + + Bounds + {{347.4899597167942, 145.33333333333331}, {8, 134}} + Class + ShapedGraphic + ID + 405 + Shape + Rectangle + + + ID + 318 + + + GridInfo + + HPages + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + Orientation + 2 + PrintOnePage + + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Rotor Assignment 2 + UniqueID + 3 + VPages + 1 + + + ActiveLayerIndex + 0 + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {806, 1132}} + Class + SolidGraphic + ID + 2 + Style + + shadow + + Draws + NO + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + DisplayScale + 1 0/72 in = 1.0000 in + GraphicsList + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{317.51000800051321, 240.42163882949882}, {50.666667938232422, 36}} + Class + ShapedGraphic + ID + 1417 + Rotation + 270 + Shape + HorizontalTriangle + Style + + fill + + Color + + b + 0.13195 + g + 0.165669 + r + 1 + + + + Text + + VerticalPad + 0 + + + + Bounds + {{306.84335619815613, 227.6666597724805}, {72, 72}} + Class + ShapedGraphic + ID + 1418 + Rotation + 45 + Shape + Rectangle + Style + + stroke + + CornerRadius + 9 + + + + + ID + 1416 + + + Class + Group + Graphics + + + Class + Group + Graphics + + + Bounds + {{181.87174317649047, 313.76849034719959}, {24, 24}} + Class + ShapedGraphic + ID + 1421 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 6} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1423 + Points + + {159.49938242361688, 285.249576623557} + {161.10116522486757, 287.15677793899749} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{201.23696348262672, 364.71920821881605}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1424 + Rotation + 157.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{143.41457890258161, 275.07218626448082}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1425 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{140.66457890258161, 272.32218626448082}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1426 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1422 + Rotation + 247.5 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1428 + Points + + {228.47124867019181, 366.1825051496383} + {226.8694658689414, 364.27530383419804} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{170.73366761118237, 268.21287355437971}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1429 + Rotation + 337.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{143.05605219122737, 274.85989550871483}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1430 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{140.30605219122737, 272.10989550871483}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1431 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1427 + Rotation + 247.5 + VFlip + YES + + + Bounds + {{142.96005354220407, 274.85679605657162}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1432 + Rotation + 247.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1420 + Rotation + 337.5 + + + Class + Group + Graphics + + + Bounds + {{272.11841406704639, 103.73309829351469}, {24, 24}} + Class + ShapedGraphic + ID + 1434 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 5} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1436 + Points + + {249.74605331417285, 75.214184569872145} + {251.34783611542343, 77.121385885312606} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{291.48363437318255, 154.68381616513099}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1437 + Rotation + 157.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{233.66124979313764, 65.036794210795819}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1438 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{230.91124979313764, 62.286794210795819}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1439 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1435 + Rotation + 247.5 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1441 + Points + + {318.71791956074799, 156.14711309595339} + {317.11613675949758, 154.23991178051318} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{260.98033850173846, 58.177481500694711}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1442 + Rotation + 337.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{233.30272308178348, 64.824503455029671}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1443 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{230.55272308178348, 62.074503455029671}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1444 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1440 + Rotation + 247.5 + VFlip + YES + + + Bounds + {{233.20672443276007, 64.821404002886837}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1445 + Rotation + 247.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1433 + Rotation + 337.5 + + + Class + Group + Graphics + + + Bounds + {{392.11278792691934, 400.85319857921803}, {24, 24}} + Class + ShapedGraphic + ID + 1447 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 4} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1449 + Points + + {369.74042717404592, 372.33428485557562} + {371.34220997529656, 374.24148617101616} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{411.47800823305562, 451.80391645083449}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1450 + Rotation + 157.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{353.65562365301071, 362.15689449649926}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1451 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{350.90562365301071, 359.40689449649926}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1452 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1448 + Rotation + 247.5 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1454 + Points + + {438.71229342062088, 453.26721338165692} + {437.11051061937059, 451.36001206621654} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{380.97471236161118, 355.29758178639815}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1455 + Rotation + 337.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{353.29709694165621, 361.94460374073327}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1456 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{350.54709694165621, 359.19460374073327}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1457 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1453 + Rotation + 247.5 + VFlip + YES + + + Bounds + {{353.20109829263305, 361.94150428859024}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1458 + Rotation + 247.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1446 + Rotation + 337.5 + + + Class + Group + Graphics + + + Bounds + {{479.58783759318999, 189.66974728965576}, {24, 24}} + Class + ShapedGraphic + ID + 1460 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 3} + VerticalPad + 0 + + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1462 + Points + + {457.21547665220845, 161.15083366194582} + {458.81725945345897, 163.05803497738634} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{498.95305771121809, 240.62046525720473}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1463 + Rotation + 157.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{441.13067313117307, 150.9734433028697}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1464 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{438.38067313117307, 148.2234433028697}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1465 + Rotation + 67.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1461 + Rotation + 247.5 + VFlip + YES + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1467 + Points + + {526.18734328198354, 242.08376201128482} + {524.58556048073308, 240.17656069584442} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{468.44976222297396, 144.11413041602617}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1468 + Rotation + 337.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + Bounds + {{440.77214680301904, 150.76115237036112}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1469 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + Bounds + {{438.02214680301904, 148.01115237036112}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1470 + Rotation + 247.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + VFlip + YES + + + ID + 1466 + Rotation + 247.5 + VFlip + YES + + + Bounds + {{440.67614795890404, 150.75805299902771}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1471 + Rotation + 247.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.673128 + g + 0.534129 + r + 0.217952 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + VFlip + YES + + + ID + 1459 + Rotation + 337.5 + + + Bounds + {{324.9947377700048, 478.76189426912856}, {46, 14}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + ID + 1472 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Pad + 0 + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\b\fs24 \cf0 OCTO +\b0 X} + VerticalPad + 0 + + Wrap + NO + + + Class + Group + Graphics + + + Bounds + {{267.24952227247923, 404.95559172255122}, {24, 24}} + Class + ShapedGraphic + ID + 1474 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 2} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1476 + Points + + {332.396988909622, 413.07125181593568} + {329.91576246001244, 413.28721548361688} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{226.49295677281663, 431.38573061302958}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1477 + Rotation + 67.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{228.4458262787623, 366.49842726410935}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1478 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{225.6958262787623, 363.74842726410935}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1479 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1475 + Rotation + 337.5 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1481 + Points + + {226.20695455654064, 421.06707636999505} + {228.68818100615007, 420.8511127023138} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{316.11098669334581, 384.25259757290121}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1482 + Rotation + 247.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{228.65811718740025, 366.13990092182132}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1483 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{225.90811718740025, 363.38990092182132}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1484 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1480 + Rotation + 337.5 + + + Bounds + {{228.33784007224426, 366.04390208826476}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1485 + Rotation + 337.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1473 + Rotation + 337.5 + + + Class + Group + Graphics + + + Bounds + {{181.88306202487647, 189.87345220332375}, {24, 24}} + Class + ShapedGraphic + ID + 1487 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 7} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1489 + Points + + {247.03052866201915, 197.98911229670802} + {244.5493022124096, 198.20507596438921} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{141.12649652521372, 216.30359109380208}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1490 + Rotation + 67.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{143.07936603115925, 151.41628774488177}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1491 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{140.32936603115925, 148.66628774488177}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1492 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1488 + Rotation + 337.5 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1494 + Points + + {140.84049430893771, 205.98493685076758} + {143.32172075854714, 205.76897318308625} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{230.74452644574279, 169.17045805367366}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1495 + Rotation + 247.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{143.29165693979732, 151.05776140259383}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1496 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{140.54165693979732, 148.30776140259383}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1497 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1493 + Rotation + 337.5 + + + Bounds + {{142.97137982464162, 150.96176256903718}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1498 + Rotation + 337.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1486 + Rotation + 337.5 + + + Class + Group + Graphics + + + Bounds + {{479.69876456560792, 313.23275528336626}, {24, 24}} + Class + ShapedGraphic + ID + 1500 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 8} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1502 + Points + + {544.84623120275069, 321.34841537675055} + {542.36500475314142, 321.56437904443163} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{438.94219906594537, 339.66289417384445}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1503 + Rotation + 67.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{440.89506857189104, 274.77559082492428}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1504 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{438.14506857189104, 272.02559082492428}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1505 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1501 + Rotation + 337.5 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1507 + Points + + {438.65619684966936, 329.34423993081015} + {441.13742329927879, 329.12827626312878} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{528.56022898647439, 292.52976113371614}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1508 + Rotation + 247.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{441.107359480529, 274.41706448263619}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1509 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{438.357359480529, 271.66706448263619}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1510 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1506 + Rotation + 337.5 + + + Bounds + {{440.78708236537307, 274.3210656490798}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1511 + Rotation + 337.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1499 + Rotation + 337.5 + + + Bounds + {{248.28852278518417, 235.77792148758147}, {8, 134}} + Class + ShapedGraphic + ID + 1512 + Rotation + 247.5 + Shape + Rectangle + + + Bounds + {{425.23537052568395, 232.45140364934065}, {8, 134}} + Class + ShapedGraphic + ID + 1513 + Rotation + 292.50006103515625 + Shape + Rectangle + + + Bounds + {{374.59821460510483, 282.06732351898592}, {8, 134}} + Class + ShapedGraphic + ID + 1514 + Rotation + 157.5 + Shape + Rectangle + + + Class + Group + Graphics + + + Bounds + {{394.33229525377027, 98.150584482954116}, {24, 24}} + Class + ShapedGraphic + ID + 1516 + Shape + Circle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370 +\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 1} + VerticalPad + 0 + + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1518 + Points + + {459.47976189091298, 106.26624457633855} + {456.99853544130355, 106.48220824401977} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{353.57572975410767, 124.58072337343253}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1519 + Rotation + 67.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{355.52859926005328, 59.693420024512235}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1520 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{352.77859926005328, 56.943420024512235}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1521 + Rotation + 157.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1517 + Rotation + 337.5 + + + Class + Group + Graphics + + + Class + LineGraphic + ID + 1523 + Points + + {353.28972753783154, 114.26206913039776} + {355.77095398744109, 114.04610546271654} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + + + Bounds + {{443.19375967463657, 77.447590333303964}, {16, 18.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1524 + Rotation + 247.5 + Shape + HorizontalTriangle + Style + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + + + Bounds + {{355.74089016869129, 59.33489368222402}, {101.5, 101.5}} + Class + ShapedGraphic + HFlip + YES + ID + 1525 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + Bounds + {{352.99089016869129, 56.58489368222402}, {107, 107}} + Class + ShapedGraphic + HFlip + YES + ID + 1526 + Rotation + 337.5 + Shape + AdjustableArc + ShapeData + + endAngle + 72 + startAngle + 281 + + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + + Text + + VerticalPad + 0 + + TextRelativeArea + {{0.10000000000000001, 0.14999999999999999}, {0.80000000000000004, 0.69999999999999996}} + + + ID + 1522 + Rotation + 337.5 + + + Bounds + {{355.42061305353548, 59.238894848667528}, {101.82337649086284, 101.82337649086284}} + Class + ShapedGraphic + ID + 1527 + Rotation + 337.5 + Shape + Circle + Style + + fill + + Color + + a + 0.78 + b + 0.234512 + g + 0.673128 + r + 0.148947 + + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + VerticalPad + 0 + + + + ID + 1515 + Rotation + 337.5 + + + Bounds + {{252.46989794607327, 160.88960179706885}, {8, 134}} + Class + ShapedGraphic + ID + 1528 + Rotation + 292.50006103515625 + Shape + Rectangle + + + Bounds + {{426.89836479441431, 161.02992820772749}, {8, 134}} + Class + ShapedGraphic + ID + 1529 + Rotation + 247.5 + Shape + Rectangle + + + Bounds + {{302.52032988683095, 284.35823469264687}, {8, 134}} + Class + ShapedGraphic + ID + 1530 + Rotation + 22.500026702880859 + Shape + Rectangle + + + Bounds + {{375.35774119930903, 108.51315184010758}, {8, 134}} + Class + ShapedGraphic + ID + 1531 + Rotation + 22.500026702880859 + Shape + Rectangle + + + Bounds + {{303.4692327942559, 110.3467678696648}, {8, 134}} + Class + ShapedGraphic + ID + 1532 + Rotation + 157.5 + Shape + Rectangle + + + ID + 1419 + Rotation + 45 + + + ID + 1415 + + + GridInfo + + HPages + 1 + KeepToScale + + Layers + + + Lock + NO + Name + Layer 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + Orientation + 2 + PrintOnePage + + RowAlign + 1 + RowSpacing + 36 + SheetTitle + Rotor Assignment 3 + UniqueID + 4 + VPages + 1 + + + SmartAlignmentGuidesActive + YES + SmartDistanceGuidesActive + YES + UseEntirePage + + WindowInfo + + CurrentSheet + 4 + ExpandedCanvases + + + name + Canvas 1 + + + Frame + {{96, 56}, {1043, 822}} + ListView + + OutlineWidth + 142 + RightSidebar + + ShowRuler + + Sidebar + + SidebarWidth + 120 + VisibleRegion + {{-51, -33}, {908, 683}} + Zoom + 1 + ZoomValues + + + Canvas 1 + 1 + 0.5 + + + Rotor Assignments + 1 + 4 + + + Rotor Assignment 2 + 1 + 4 + + + Rotor Assignment 3 + 1 + 1 + + + Remote Control + 1 + 1 + + + + + From edf96fc8085510765c503350d29c96a2789bdbc0 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 28 Apr 2013 12:47:34 -0700 Subject: [PATCH 072/129] Remove some naked command invocations. --- makefiles/module.mk | 2 +- makefiles/setup.mk | 2 ++ makefiles/upload.mk | 13 ++++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/makefiles/module.mk b/makefiles/module.mk index 86810627b2..59c67f574d 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -153,7 +153,7 @@ $(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).* $(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) @$(REMOVE) -f $(exclude) @$(MKDIR) -p $(dir $@) - @echo "CMD: $(command)" + @$(ECHO) "CMD: $(command)" $(Q) $(TOUCH) $@ endif diff --git a/makefiles/setup.mk b/makefiles/setup.mk index 8072ec7915..1111930937 100644 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -72,6 +72,8 @@ export TOUCH = touch export MKDIR = mkdir export ECHO = echo export UNZIP_CMD = unzip +export PYTHON = python +export OPENOCD = openocd # # Host-specific paths, hacks and fixups diff --git a/makefiles/upload.mk b/makefiles/upload.mk index f23d6ae41a..5ef92728fe 100644 --- a/makefiles/upload.mk +++ b/makefiles/upload.mk @@ -25,7 +25,10 @@ endif all: upload-$(METHOD)-$(BOARD) upload-serial-px4fmu: $(BUNDLE) $(UPLOADER) - @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) + $(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) + +upload-serial-px4fmuv2: $(BUNDLE) $(UPLOADER) + $(Q) $(PYTHON) -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) # # JTAG firmware uploading with OpenOCD @@ -33,9 +36,9 @@ upload-serial-px4fmu: $(BUNDLE) $(UPLOADER) JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg upload-jtag-px4fmu: all - @echo Attempting to flash PX4FMU board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown + @$(ECHO) Attempting to flash PX4FMU board via JTAG + $(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown upload-jtag-px4io: all - @echo Attempting to flash PX4IO board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown + @$(ECHO) Attempting to flash PX4IO board via JTAG + $(Q) $(OPENOCD) -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown From 8d3a738b7011ab77bab7ac89c5314fdc7c663890 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 28 Apr 2013 13:00:32 -0700 Subject: [PATCH 073/129] Remove some trash files. --- src/modules/position_estimator/.context | 0 src/modules/uORB/.context | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/modules/position_estimator/.context delete mode 100644 src/modules/uORB/.context diff --git a/src/modules/position_estimator/.context b/src/modules/position_estimator/.context deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/modules/uORB/.context b/src/modules/uORB/.context deleted file mode 100644 index e69de29bb2..0000000000 From ddf1b27697dd5edd8e8282c24ad35cb938dbf3c8 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Thu, 2 May 2013 07:10:23 +0200 Subject: [PATCH 074/129] Added a config for quads with a wide arm config. --- ROMFS/Makefile | 3 ++- apps/systemlib/mixer/mixer.h | 1 + apps/systemlib/mixer/mixer_multirotor.cpp | 11 +++++++++++ apps/systemlib/mixer/multi_tables | 9 ++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ROMFS/Makefile b/ROMFS/Makefile index 11a4650fa6..ecd15d5e27 100644 --- a/ROMFS/Makefile +++ b/ROMFS/Makefile @@ -32,7 +32,8 @@ ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ $(SRCROOT)/mixers/FMU_RET.mix~mixers/FMU_ERT.mix \ $(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \ $(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \ - $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ + $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ + $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_w.mix \ $(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \ $(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \ $(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \ diff --git a/apps/systemlib/mixer/mixer.h b/apps/systemlib/mixer/mixer.h index 40d37fce2b..bbfa130a9d 100644 --- a/apps/systemlib/mixer/mixer.h +++ b/apps/systemlib/mixer/mixer.h @@ -419,6 +419,7 @@ public: QUAD_X = 0, /**< quad in X configuration */ QUAD_PLUS, /**< quad in + configuration */ QUAD_V, /**< quad in V configuration */ + QUAD_WIDE, /**< quad in wide configuration */ HEX_X, /**< hex in X configuration */ HEX_PLUS, /**< hex in + configuration */ OCTA_X, diff --git a/apps/systemlib/mixer/mixer_multirotor.cpp b/apps/systemlib/mixer/mixer_multirotor.cpp index d79811c0ff..8ded0b05c1 100644 --- a/apps/systemlib/mixer/mixer_multirotor.cpp +++ b/apps/systemlib/mixer/mixer_multirotor.cpp @@ -88,6 +88,12 @@ const MultirotorMixer::Rotor _config_quad_v[] = { { 0.927184, 0.374607, -1.00 }, { -0.694658, -0.719340, -1.00 }, }; +const MultirotorMixer::Rotor _config_quad_wide[] = { + { -0.927184, 0.374607, 1.00 }, + { 0.777146, -0.629320, 1.00 }, + { 0.927184, 0.374607, -1.00 }, + { -0.777146, -0.629320, -1.00 }, +}; const MultirotorMixer::Rotor _config_hex_x[] = { { -1.000000, 0.000000, -1.00 }, { 1.000000, 0.000000, 1.00 }, @@ -128,6 +134,7 @@ const MultirotorMixer::Rotor *_config_index[MultirotorMixer::Geometry::MAX_GEOME &_config_quad_x[0], &_config_quad_plus[0], &_config_quad_v[0], + &_config_quad_wide[0], &_config_hex_x[0], &_config_hex_plus[0], &_config_octa_x[0], @@ -137,6 +144,7 @@ const unsigned _config_rotor_count[MultirotorMixer::Geometry::MAX_GEOMETRY] = { 4, /* quad_x */ 4, /* quad_plus */ 4, /* quad_v */ + 4, /* quad_wide */ 6, /* hex_x */ 6, /* hex_plus */ 8, /* octa_x */ @@ -195,6 +203,9 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl } else if (!strcmp(geomname, "4v")) { geometry = MultirotorMixer::QUAD_V; + } else if (!strcmp(geomname, "4w")) { + geometry = MultirotorMixer::QUAD_WIDE; + } else if (!strcmp(geomname, "6+")) { geometry = MultirotorMixer::HEX_PLUS; diff --git a/apps/systemlib/mixer/multi_tables b/apps/systemlib/mixer/multi_tables index 19a8239a6d..683c630409 100755 --- a/apps/systemlib/mixer/multi_tables +++ b/apps/systemlib/mixer/multi_tables @@ -27,6 +27,13 @@ set quad_v { 136 CW } +set quad_wide { + 68 CCW + -129 CCW + -68 CW + 129 CW +} + set hex_x { 90 CW -90 CCW @@ -67,7 +74,7 @@ set octa_plus { 90 CW } -set tables {quad_x quad_plus quad_v hex_x hex_plus octa_x octa_plus} +set tables {quad_x quad_plus quad_v quad_wide hex_x hex_plus octa_x octa_plus} proc factors {a d} { puts [format "\t{ %9.6f, %9.6f, %5.2f }," [rcos [expr $a + 90]] [rcos $a] [expr -$d]]} From d9da4352d590401ec5caeef926cf25109da393e9 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Thu, 2 May 2013 07:13:07 +0200 Subject: [PATCH 075/129] Makefile correction. --- ROMFS/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ROMFS/Makefile b/ROMFS/Makefile index ecd15d5e27..e776684212 100644 --- a/ROMFS/Makefile +++ b/ROMFS/Makefile @@ -33,7 +33,7 @@ ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ $(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \ $(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \ $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ - $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_w.mix \ + $(SRCROOT)/mixers/FMU_quad_w.mix~mixers/FMU_quad_w.mix \ $(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \ $(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \ $(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \ From 1dbbdcfa48f8acbf4bed5c160ab3acd0cf293127 Mon Sep 17 00:00:00 2001 From: Simon Wilks Date: Thu, 2 May 2013 08:41:02 +0200 Subject: [PATCH 076/129] Add the missing mixer file. --- ROMFS/mixers/FMU_quad_w.mix | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 ROMFS/mixers/FMU_quad_w.mix diff --git a/ROMFS/mixers/FMU_quad_w.mix b/ROMFS/mixers/FMU_quad_w.mix new file mode 100644 index 0000000000..81b4af30b2 --- /dev/null +++ b/ROMFS/mixers/FMU_quad_w.mix @@ -0,0 +1,6 @@ +Multirotor mixer for PX4FMU +=========================== + +This file defines a single mixer for a quadrotor with a wide configuration. All controls are mixed 100%. + +R: 4w 10000 10000 10000 0 From b9b75a24045da332644ce397d2777d9d554ff39f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 2 May 2013 22:35:16 +0200 Subject: [PATCH 077/129] Hotfix: Provide a FMU + IO on quad start script --- ROMFS/Makefile | 3 +- ROMFS/scripts/rc.IO_QUAD | 107 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 ROMFS/scripts/rc.IO_QUAD diff --git a/ROMFS/Makefile b/ROMFS/Makefile index 11a4650fa6..5ff079a930 100644 --- a/ROMFS/Makefile +++ b/ROMFS/Makefile @@ -24,6 +24,7 @@ ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ $(SRCROOT)/scripts/rc.FMU_quad_x~init.d/rc.FMU_quad_x \ $(SRCROOT)/scripts/rc.usb~init.d/rc.usb \ $(SRCROOT)/scripts/rc.hil~init.d/rc.hil \ + $(SRCROOT)/scripts/rc.IO_QUAD~scripts/rc.IO_QUAD \ $(SRCROOT)/mixers/FMU_pass.mix~mixers/FMU_pass.mix \ $(SRCROOT)/mixers/FMU_Q.mix~mixers/FMU_Q.mix \ $(SRCROOT)/mixers/FMU_X5.mix~mixers/FMU_X5.mix \ @@ -32,7 +33,7 @@ ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ $(SRCROOT)/mixers/FMU_RET.mix~mixers/FMU_ERT.mix \ $(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \ $(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \ - $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ + $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ $(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \ $(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \ $(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \ diff --git a/ROMFS/scripts/rc.IO_QUAD b/ROMFS/scripts/rc.IO_QUAD new file mode 100644 index 0000000000..287cb0483b --- /dev/null +++ b/ROMFS/scripts/rc.IO_QUAD @@ -0,0 +1,107 @@ +#!nsh + +# Disable USB and autostart +set USB no +set MODE quad + +# +# Start the ORB (first app to start) +# +uorb start + +# +# Load microSD params +# +echo "[init] loading microSD params" +param select /fs/microsd/parameters +if [ -f /fs/microsd/parameters ] +then + param load /fs/microsd/parameters +fi + +# +# Force some key parameters to sane values +# MAV_TYPE 1 = fixed wing, 2 = quadrotor, 13 = hexarotor +# see https://pixhawk.ethz.ch/mavlink/ +# +param set MAV_TYPE 2 + +# +# Check if PX4IO Firmware should be upgraded (from Andrew Tridgell) +# +if [ -f /fs/microsd/px4io.bin ] +then + echo "PX4IO Firmware found. Checking Upgrade.." + if cmp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current + then + echo "No newer version, skipping upgrade." + else + echo "Loading /fs/microsd/px4io.bin" + if px4io update /fs/microsd/px4io.bin > /fs/microsd/px4io_update.log + then + cp /fs/microsd/px4io.bin /fs/microsd/px4io.bin.current + echo "Flashed /fs/microsd/px4io.bin OK" >> /fs/microsd/px4io_update.log + else + echo "Failed flashing /fs/microsd/px4io.bin" >> /fs/microsd/px4io_update.log + echo "Failed to upgrade PX4IO firmware - check if PX4IO is in bootloader mode" + fi + fi +fi + +# +# Start MAVLink (depends on orb) +# +mavlink start -d /dev/ttyS1 -b 57600 +usleep 5000 + +# +# Start the commander (depends on orb, mavlink) +# +commander start + +# +# Start PX4IO interface (depends on orb, commander) +# +px4io start + +# +# Allow PX4IO to recover from midair restarts. +# this is very unlikely, but quite safe and robust. +px4io recovery + +# +# Start the sensors (depends on orb, px4io) +# +sh /etc/init.d/rc.sensors + +# +# Start GPS interface (depends on orb) +# +gps start + +# +# Start the attitude estimator (depends on orb) +# +attitude_estimator_ekf start + +# +# Load mixer and start controllers (depends on px4io) +# +mixer load /dev/pwm_output /etc/mixers/FMU_quad_+.mix +multirotor_att_control start + +# +# Start logging +# +#sdlog start -s 4 + +# +# Start system state +# +if blinkm start +then + echo "using BlinkM for state indication" + blinkm systemstate +else + echo "no BlinkM found, OK." +fi \ No newline at end of file From 6e8c1148d5fb6567974f3e5464e45637dc6ce68b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 4 May 2013 11:42:31 +1000 Subject: [PATCH 078/129] build: allow absolute paths for module sources --- makefiles/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefiles/module.mk b/makefiles/module.mk index 59c67f574d..0fe6f0ffec 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -183,7 +183,7 @@ module: $(MODULE_OBJ) $(MODULE_COMMAND_FILES) # Locate sources (allows relative source paths in module.mk) # define SRC_SEARCH - $(abspath $(firstword $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) + $(abspath $(firstword $(wildcard $1) $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) endef ABS_SRCS ?= $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) From aa9275c29ce90644448f0260d782ea68f21eacc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 4 May 2013 11:42:56 +1000 Subject: [PATCH 079/129] build: allow additional flags to be passed via EXTRAFLAGS this allows for flags needed for the APM build --- makefiles/toolchain_gnu-arm-eabi.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 5e6a5bf04b..32a2773732 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -189,7 +189,7 @@ DEP_INCLUDES = $(subst .o,.d,$(OBJS)) define COMPILE @$(ECHO) "CC: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 + $(Q) $(CC) -MD -c $(CFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 endef # Compile C++ source $1 to $2 @@ -198,7 +198,7 @@ endef define COMPILEXX @$(ECHO) "CXX: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 + $(Q) $(CXX) -MD -c $(CXXFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 endef # Assemble $1 into $2 @@ -206,7 +206,7 @@ endef define ASSEMBLE @$(ECHO) "AS: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 + $(Q) $(CC) -c $(AFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 endef # Produce partially-linked $1 from files in $2 From d0122dccfc28869414f0e9cd2cb1d9f131c3fd20 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 4 May 2013 18:44:37 +1000 Subject: [PATCH 080/129] hmc5883: fixed use of onboard I2C compass --- src/drivers/hmc5883/hmc5883.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index c406a7588a..78eda327c3 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -1225,19 +1225,25 @@ start() /* create the driver, attempt expansion bus first */ g_dev = new HMC5883(PX4_I2C_BUS_EXPANSION); + if (g_dev != nullptr && OK != g_dev->init()) { + delete g_dev; + g_dev = nullptr; + } + #ifdef PX4_I2C_BUS_ONBOARD /* if this failed, attempt onboard sensor */ - if (g_dev == nullptr) + if (g_dev == nullptr) { g_dev = new HMC5883(PX4_I2C_BUS_ONBOARD); + if (g_dev != nullptr && OK != g_dev->init()) { + goto fail; + } + } #endif if (g_dev == nullptr) goto fail; - if (OK != g_dev->init()) - goto fail; - /* set the poll rate to default, starts automatic data collection */ fd = open(MAG_DEVICE_PATH, O_RDONLY); From a627f6c0eba3cfb0471b0ff88652d85c6d7cb0ca Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Mar 2013 11:06:33 +1100 Subject: [PATCH 081/129] otgfsdev: removed a DEBUGASSERT() that causes a crash on windows reconnect when windows reconnects to a ACM device, this assert sometimes triggered. The case it is looking for is handled further down. --- nuttx/arch/arm/src/stm32/stm32_otgfsdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c index 2c9ae4cacb..0fcd463e05 100644 --- a/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/nuttx/arch/arm/src/stm32/stm32_otgfsdev.c @@ -1512,7 +1512,6 @@ static inline void stm32_ep0out_receive(FAR struct stm32_ep_s *privep, int bcnt) DEBUGASSERT(privep && privep->ep.priv); priv = (FAR struct stm32_usbdev_s *)privep->ep.priv; - DEBUGASSERT(priv->ep0state == EP0STATE_SETUP_OUT); ullvdbg("EP0: bcnt=%d\n", bcnt); usbtrace(TRACE_READ(EP0), bcnt); From b06098a5406cf3269a313362b43d7f47b160933b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Apr 2013 21:19:19 +1000 Subject: [PATCH 082/129] libdtoa: fixed handling of NaN and Infinity otherwise we print thousands of 00000 characters --- nuttx/libc/stdio/lib_libdtoa.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/nuttx/libc/stdio/lib_libdtoa.c b/nuttx/libc/stdio/lib_libdtoa.c index 29f61fd76e..84e3ee50b7 100644 --- a/nuttx/libc/stdio/lib_libdtoa.c +++ b/nuttx/libc/stdio/lib_libdtoa.c @@ -43,6 +43,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ +#include /**************************************************************************** * Pre-processor Definitions @@ -104,6 +105,13 @@ static void zeroes(FAR struct lib_outstream_s *obj, int nzeroes) * Private Functions ****************************************************************************/ +static void lib_dtoa_string(FAR struct lib_outstream_s *obj, const char *str) +{ + while (*str) { + obj->put(obj, *str++); + } +} + /**************************************************************************** * Name: lib_dtoa * @@ -138,8 +146,21 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, int dsgn; /* Unused sign indicator */ int i; - /* Non-zero... positive or negative */ + /* special handling for NaN and Infinity */ + if (isnan(value)) { + lib_dtoa_string(obj, "NaN"); + return; + } + if (isinf(value)) { + if (value < 0.0d) { + obj->put(obj, '-'); + } + lib_dtoa_string(obj, "Infinity"); + return; + } + /* Non-zero... positive or negative */ + if (value < 0) { value = -value; From 421253e6db6c5e716c84ac505a8caef679ea97ee Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 21 Apr 2013 14:28:56 +1000 Subject: [PATCH 083/129] px4io: allow set of output rates above 400 and below 50 let the IO board decide if the rate is reasonable, and limit it there this fixes the rates on ArduCopter, which try for 490 --- src/drivers/px4io/px4io.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 4c2f1736f9..d8b5c51c43 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1336,11 +1336,7 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg) case PWM_SERVO_SET_UPDATE_RATE: /* set the requested alternate rate */ - if ((arg >= 50) && (arg <= 400)) { /* TODO: we could go higher for e.g. TurboPWM */ - ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_ALTRATE, arg); - } else { - ret = -EINVAL; - } + ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_ALTRATE, arg); break; case PWM_SERVO_SELECT_UPDATE_RATE: { From fc572906b7693d910ded443632e8608b200a7933 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Apr 2013 20:11:25 +1000 Subject: [PATCH 084/129] px4io: ensure upload device is closed after use this should release it for PWM use --- src/drivers/px4io/uploader.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/drivers/px4io/uploader.cpp b/src/drivers/px4io/uploader.cpp index 9a67875e86..15524c3aeb 100644 --- a/src/drivers/px4io/uploader.cpp +++ b/src/drivers/px4io/uploader.cpp @@ -127,6 +127,8 @@ PX4IO_Uploader::upload(const char *filenames[]) if (ret != OK) { /* this is immediately fatal */ log("bootloader not responding"); + close(_io_fd); + _io_fd = -1; return -EIO; } @@ -145,18 +147,25 @@ PX4IO_Uploader::upload(const char *filenames[]) if (filename == NULL) { log("no firmware found"); + close(_io_fd); + _io_fd = -1; return -ENOENT; } struct stat st; if (stat(filename, &st) != 0) { log("Failed to stat %s - %d\n", filename, (int)errno); + close(_io_fd); + _io_fd = -1; return -errno; } fw_size = st.st_size; - if (_fw_fd == -1) + if (_fw_fd == -1) { + close(_io_fd); + _io_fd = -1; return -ENOENT; + } /* do the usual program thing - allow for failure */ for (unsigned retries = 0; retries < 1; retries++) { @@ -167,6 +176,8 @@ PX4IO_Uploader::upload(const char *filenames[]) if (ret != OK) { /* this is immediately fatal */ log("bootloader not responding"); + close(_io_fd); + _io_fd = -1; return -EIO; } } @@ -178,6 +189,8 @@ PX4IO_Uploader::upload(const char *filenames[]) log("found bootloader revision: %d", bl_rev); } else { log("found unsupported bootloader revision %d, exiting", bl_rev); + close(_io_fd); + _io_fd = -1; return OK; } } @@ -221,6 +234,8 @@ PX4IO_Uploader::upload(const char *filenames[]) } close(_fw_fd); + close(_io_fd); + _io_fd = -1; return ret; } From ff7712ca3e752141e54f3cbf15198a62429617f7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Apr 2013 20:13:03 +1000 Subject: [PATCH 085/129] pwm: added -m option this allows setting of the channel mask directly, which is useful for testing --- src/systemcmds/pwm/pwm.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/systemcmds/pwm/pwm.c b/src/systemcmds/pwm/pwm.c index de7a531993..08e6c88dfa 100644 --- a/src/systemcmds/pwm/pwm.c +++ b/src/systemcmds/pwm/pwm.c @@ -71,13 +71,14 @@ usage(const char *reason) warnx("%s", reason); errx(1, "usage:\n" - "pwm [-v] [-d ] [-u ] [-c ] [arm|disarm] [ ...]\n" + "pwm [-v] [-d ] [-u ] [-c ] [-m chanmask ] [arm|disarm] [ ...]\n" " -v Print information about the PWM device\n" " PWM output device (defaults to " PWM_OUTPUT_DEVICE_PATH ")\n" " PWM update rate for channels in \n" " Channel group that should update at the alternate rate (may be specified more than once)\n" " arm | disarm Arm or disarm the ouptut\n" " ... PWM output values in microseconds to assign to the PWM outputs\n" + " Directly supply alt rate channel mask\n" "\n" "When -c is specified, any channel groups not listed with -c will update at the default rate.\n" ); @@ -96,11 +97,12 @@ pwm_main(int argc, char *argv[]) int ret; char *ep; unsigned group; + int32_t set_mask = -1; if (argc < 2) usage(NULL); - while ((ch = getopt(argc, argv, "c:d:u:v")) != EOF) { + while ((ch = getopt(argc, argv, "c:d:u:vm:")) != EOF) { switch (ch) { case 'c': group = strtoul(optarg, &ep, 0); @@ -120,6 +122,12 @@ pwm_main(int argc, char *argv[]) usage("bad alt_rate value"); break; + case 'm': + set_mask = strtol(optarg, &ep, 0); + if (*ep != '\0') + usage("bad set_mask value"); + break; + case 'v': print_info = true; break; @@ -143,6 +151,13 @@ pwm_main(int argc, char *argv[]) err(1, "PWM_SERVO_SET_UPDATE_RATE (check rate for sanity)"); } + /* directly supplied channel mask */ + if (set_mask != -1) { + ret = ioctl(fd, PWM_SERVO_SELECT_UPDATE_RATE, set_mask); + if (ret != OK) + err(1, "PWM_SERVO_SELECT_UPDATE_RATE"); + } + /* assign alternate rate to channel groups */ if (alt_channels_set) { uint32_t mask = 0; From a153ee529f68e9b52805b8c77da1ec2bf0e54210 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Apr 2013 22:22:16 +1000 Subject: [PATCH 086/129] libdtoa: don't print trailing zeros if no decimal is printed --- nuttx/libc/stdio/lib_libdtoa.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nuttx/libc/stdio/lib_libdtoa.c b/nuttx/libc/stdio/lib_libdtoa.c index 84e3ee50b7..395a55b61b 100644 --- a/nuttx/libc/stdio/lib_libdtoa.c +++ b/nuttx/libc/stdio/lib_libdtoa.c @@ -145,6 +145,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, int nchars; /* Number of characters to print */ int dsgn; /* Unused sign indicator */ int i; + bool done_decimal_point = false; /* special handling for NaN and Infinity */ if (isnan(value)) { @@ -199,6 +200,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, if (prec > 0 || IS_ALTFORM(flags)) { obj->put(obj, '.'); + done_decimal_point = true; /* Always print at least one digit to the right of the decimal point. */ @@ -224,6 +226,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, /* Print the decimal point */ obj->put(obj, '.'); + done_decimal_point = true; /* Print any leading zeros to the right of the decimal point */ @@ -270,6 +273,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, /* Print the decimal point */ obj->put(obj, '.'); + done_decimal_point = true; /* Always print at least one digit to the right of the decimal * point. @@ -306,8 +310,9 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, } /* Finally, print any trailing zeroes */ - - zeroes(obj, prec); + if (done_decimal_point) { + zeroes(obj, prec); + } /* Is this memory supposed to be freed or not? */ From 953acbe65014e2b2305c4338ca3711622fda3fdd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Apr 2013 22:22:45 +1000 Subject: [PATCH 087/129] libvsprintf: fixed handling of "%f" to print precision 6 --- nuttx/libc/stdio/lib_libvsprintf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nuttx/libc/stdio/lib_libvsprintf.c b/nuttx/libc/stdio/lib_libvsprintf.c index 9a391610dc..3d26ff810e 100644 --- a/nuttx/libc/stdio/lib_libvsprintf.c +++ b/nuttx/libc/stdio/lib_libvsprintf.c @@ -1215,7 +1215,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a fmt = FMT_RJUST; width = 0; #ifdef CONFIG_LIBC_FLOATINGPOINT - trunc = 0; + trunc = 6; #endif #endif @@ -1245,6 +1245,9 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a { #ifndef CONFIG_NOPRINTF_FIELDWIDTH fmt = FMT_RJUST0; + if (IS_HASDOT(flags)) { + trunc = 0; + } #endif } #if 0 From 5b3844621ca1c0a6181e49166c5c12f3000f6802 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 28 Apr 2013 14:07:50 +1000 Subject: [PATCH 088/129] stdio: fixed build error for stdio on px4io --- nuttx/libc/stdio/lib_libvsprintf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nuttx/libc/stdio/lib_libvsprintf.c b/nuttx/libc/stdio/lib_libvsprintf.c index 3d26ff810e..2cc7950f7b 100644 --- a/nuttx/libc/stdio/lib_libvsprintf.c +++ b/nuttx/libc/stdio/lib_libvsprintf.c @@ -1245,9 +1245,11 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a { #ifndef CONFIG_NOPRINTF_FIELDWIDTH fmt = FMT_RJUST0; +#ifdef CONFIG_LIBC_FLOATINGPOINT if (IS_HASDOT(flags)) { trunc = 0; } +#endif #endif } #if 0 From 44015d69154062d42ecc3aa0c9b25d7019bd5a71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 1 May 2013 15:06:13 +1000 Subject: [PATCH 089/129] px4io: return raw ADC value for current we don't know how to scale it as we have no info on what sensor is attached. As we are returning a uint16_t it is better to let the FMU sort it out or we'll just lose precision. --- src/modules/px4iofirmware/protocol.h | 4 +--- src/modules/px4iofirmware/registers.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index 8d8b7e941b..b80551a077 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -115,7 +115,7 @@ #define PX4IO_P_STATUS_ALARMS_PWM_ERROR (1 << 6) /* PWM configuration or output was bad */ #define PX4IO_P_STATUS_VBATT 4 /* battery voltage in mV */ -#define PX4IO_P_STATUS_IBATT 5 /* battery current in cA */ +#define PX4IO_P_STATUS_IBATT 5 /* battery current (raw ADC) */ /* array of post-mix actuator outputs, -10000..10000 */ #define PX4IO_PAGE_ACTUATORS 2 /* 0..CONFIG_ACTUATOR_COUNT-1 */ @@ -155,8 +155,6 @@ #define PX4IO_P_SETUP_PWM_ALTRATE 4 /* 'high' PWM frame output rate in Hz */ #define PX4IO_P_SETUP_RELAYS 5 /* bitmask of relay/switch outputs, 0 = off, 1 = on */ #define PX4IO_P_SETUP_VBATT_SCALE 6 /* battery voltage correction factor (float) */ -#define PX4IO_P_SETUP_IBATT_SCALE 7 /* battery current scaling factor (float) */ -#define PX4IO_P_SETUP_IBATT_BIAS 8 /* battery current bias value */ #define PX4IO_P_SETUP_SET_DEBUG 9 /* debug level for IO board */ /* autopilot control values, -10000..10000 */ diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 6c09def9ee..9f9c50048d 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -138,8 +138,6 @@ volatile uint16_t r_page_setup[] = [PX4IO_P_SETUP_PWM_ALTRATE] = 200, [PX4IO_P_SETUP_RELAYS] = 0, [PX4IO_P_SETUP_VBATT_SCALE] = 10000, - [PX4IO_P_SETUP_IBATT_SCALE] = 0, - [PX4IO_P_SETUP_IBATT_BIAS] = 0, [PX4IO_P_SETUP_SET_DEBUG] = 0, }; @@ -516,12 +514,14 @@ registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_val /* PX4IO_P_STATUS_IBATT */ { - unsigned counts = adc_measure(ADC_VBATT); - unsigned scaled = (counts * r_page_setup[PX4IO_P_SETUP_IBATT_SCALE]) / 10000; - int corrected = scaled + REG_TO_SIGNED(r_page_setup[PX4IO_P_SETUP_IBATT_BIAS]); - if (corrected < 0) - corrected = 0; - r_page_status[PX4IO_P_STATUS_IBATT] = corrected; + /* + note that we have no idea what sort of + current sensor is attached, so we just + return the raw 12 bit ADC value and let the + FMU sort it out, with user selectable + configuration for their sensor + */ + r_page_status[PX4IO_P_STATUS_IBATT] = adc_measure(ADC_IN5); } SELECT_PAGE(r_page_status); From af27101ffecf2ad4642b1ced23640ff133c7246f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 May 2013 21:27:20 +1000 Subject: [PATCH 090/129] px4io: changed adc_measure() to return 0xffff on error, and lower timeout the timeout of 1ms was far too long, and could impact flight performance Returning 0xffff on error matches the FMU code, and allows bad values to be discarded --- src/modules/px4iofirmware/adc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/px4iofirmware/adc.c b/src/modules/px4iofirmware/adc.c index 670b8d635d..f744698be2 100644 --- a/src/modules/px4iofirmware/adc.c +++ b/src/modules/px4iofirmware/adc.c @@ -135,6 +135,9 @@ adc_init(void) return 0; } +/* + return one measurement, or 0xffff on error + */ uint16_t adc_measure(unsigned channel) { @@ -154,9 +157,10 @@ adc_measure(unsigned channel) while (!(rSR & ADC_SR_EOC)) { /* never spin forever - this will give a bogus result though */ - if (hrt_elapsed_time(&now) > 1000) { + if (hrt_elapsed_time(&now) > 100) { debug("adc timeout"); - break; + perf_end(adc_perf); + return 0xffff; } } @@ -165,4 +169,4 @@ adc_measure(unsigned channel) perf_end(adc_perf); return result; -} \ No newline at end of file +} From d7e04a361909fb65839fb8f2ab515ea17e5f6d77 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 May 2013 21:28:55 +1000 Subject: [PATCH 091/129] px4io: fixed voltage/current output and add discharged_mah calculation this integrates the current over time to calculate discharged_mah, and allows the scaling of the current and the bias to be set with the px4io command --- src/drivers/px4io/px4io.cpp | 70 ++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index d8b5c51c43..b4703839bf 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -108,6 +108,14 @@ public: */ int set_update_rate(int rate); + /** + * Set the battery current scaling and bias + * + * @param amp_per_volt + * @param amp_bias + */ + void set_battery_current_scaling(float amp_per_volt, float amp_bias); + /** * Print the current status of IO */ @@ -151,6 +159,10 @@ private: bool _primary_pwm_device; ///< true if we are the default PWM output + float _battery_amp_per_volt; + float _battery_amp_bias; + float _battery_mamphour_total; + uint64_t _battery_last_timestamp; /** * Trampoline to the worker task @@ -314,6 +326,10 @@ PX4IO::PX4IO() : _to_actuators_effective(0), _to_outputs(0), _to_battery(0), + _battery_amp_per_volt(90.0f/5.0f), // this matches the 3DR current sensor + _battery_amp_bias(0), + _battery_mamphour_total(0), + _battery_last_timestamp(0), _primary_pwm_device(false) { /* we need this potentially before it could be set in task_main */ @@ -884,11 +900,22 @@ PX4IO::io_get_status() /* voltage is scaled to mV */ battery_status.voltage_v = regs[2] / 1000.0f; - /* current scaling should be to cA in order to avoid limiting at 65A */ - battery_status.current_a = regs[3] / 100.f; + /* + regs[3] contains the raw ADC count, as 12 bit ADC + value, with full range being 3.3v + */ + battery_status.current_a = regs[3] * (3.3f/4096.0f) * _battery_amp_per_volt; + battery_status.current_a += _battery_amp_bias; - /* this requires integration over time - not currently implemented */ - battery_status.discharged_mah = -1.0f; + /* + integrate battery over time to get total mAh used + */ + if (_battery_last_timestamp != 0) { + _battery_mamphour_total += battery_status.current_a * + (battery_status.timestamp - _battery_last_timestamp) * 1.0e-3f / 3600; + } + battery_status.discharged_mah = _battery_mamphour_total; + _battery_last_timestamp = battery_status.timestamp; /* lazily publish the battery voltage */ if (_to_battery > 0) { @@ -1245,9 +1272,14 @@ PX4IO::print_status() ((alarms & PX4IO_P_STATUS_ALARMS_FMU_LOST) ? " FMU_LOST" : ""), ((alarms & PX4IO_P_STATUS_ALARMS_RC_LOST) ? " RC_LOST" : ""), ((alarms & PX4IO_P_STATUS_ALARMS_PWM_ERROR) ? " PWM_ERROR" : "")); - printf("vbatt %u ibatt %u\n", - io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_VBATT), - io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_IBATT)); + printf("vbatt %u ibatt %u vbatt scale %u\n", + io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_VBATT), + io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_IBATT), + io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_VBATT_SCALE)); + printf("amp_per_volt %.3f amp_offset %.3f mAhDischarged %.3f\n", + _battery_amp_per_volt, + _battery_amp_bias, + _battery_mamphour_total); printf("actuators"); for (unsigned i = 0; i < _max_actuators; i++) printf(" %u", io_reg_get(PX4IO_PAGE_ACTUATORS, i)); @@ -1288,10 +1320,6 @@ PX4IO::print_status() io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_DEFAULTRATE), io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_ALTRATE), io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_RELAYS)); - printf("vbatt scale %u ibatt scale %u ibatt bias %u\n", - io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_VBATT_SCALE), - io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_IBATT_SCALE), - io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_IBATT_BIAS)); printf("debuglevel %u\n", io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_SET_DEBUG)); printf("controls"); for (unsigned i = 0; i < _max_controls; i++) @@ -1521,6 +1549,12 @@ PX4IO::set_update_rate(int rate) return 0; } +void +PX4IO::set_battery_current_scaling(float amp_per_volt, float amp_bias) +{ + _battery_amp_per_volt = amp_per_volt; + _battery_amp_bias = amp_bias; +} extern "C" __EXPORT int px4io_main(int argc, char *argv[]); @@ -1658,6 +1692,18 @@ px4io_main(int argc, char *argv[]) exit(0); } + if (!strcmp(argv[1], "current")) { + if (g_dev != nullptr) { + if ((argc > 3)) { + g_dev->set_battery_current_scaling(atof(argv[2]), atof(argv[3])); + } else { + errx(1, "missing argument (apm_per_volt, amp_offset)"); + return 1; + } + } + exit(0); + } + if (!strcmp(argv[1], "recovery")) { if (g_dev != nullptr) { @@ -1785,5 +1831,5 @@ px4io_main(int argc, char *argv[]) monitor(); out: - errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor', 'debug', 'recovery', 'limit' or 'update'"); + errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor', 'debug', 'recovery', 'limit', 'current' or 'update'"); } From 5b75519925a46165b108f1a6d59b6325e1022adc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 May 2013 21:29:30 +1000 Subject: [PATCH 092/129] px4io: handle errors from adc_measure() don't update the voltage/current values on error --- src/modules/px4iofirmware/registers.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 9f9c50048d..4f3addfea8 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -506,10 +506,12 @@ registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_val * Intercept corrected for best results @ 12V. */ unsigned counts = adc_measure(ADC_VBATT); - unsigned mV = (4150 + (counts * 46)) / 10 - 200; - unsigned corrected = (mV * r_page_setup[PX4IO_P_SETUP_VBATT_SCALE]) / 10000; + if (counts != 0xffff) { + unsigned mV = (4150 + (counts * 46)) / 10 - 200; + unsigned corrected = (mV * r_page_setup[PX4IO_P_SETUP_VBATT_SCALE]) / 10000; - r_page_status[PX4IO_P_STATUS_VBATT] = corrected; + r_page_status[PX4IO_P_STATUS_VBATT] = corrected; + } } /* PX4IO_P_STATUS_IBATT */ @@ -521,7 +523,10 @@ registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_val FMU sort it out, with user selectable configuration for their sensor */ - r_page_status[PX4IO_P_STATUS_IBATT] = adc_measure(ADC_IN5); + unsigned counts = adc_measure(ADC_IN5); + if (counts != 0xffff) { + r_page_status[PX4IO_P_STATUS_IBATT] = counts; + } } SELECT_PAGE(r_page_status); From 1c4fc6cfb0b5d417011df11a0c8705dc344077b8 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 4 May 2013 20:37:22 +0200 Subject: [PATCH 093/129] Help Parameter added and some small fixes. This Version was flown several Hours without any Problems. --- apps/drivers/mkblctrl/mkblctrl.cpp | 59 ++++++++++++++++-------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/apps/drivers/mkblctrl/mkblctrl.cpp b/apps/drivers/mkblctrl/mkblctrl.cpp index e70bd16945..3a735e26fb 100644 --- a/apps/drivers/mkblctrl/mkblctrl.cpp +++ b/apps/drivers/mkblctrl/mkblctrl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (C) 2012,2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -219,7 +219,7 @@ struct MotorData_t // the following bytes must be exactly in that order! unsigned int Current; // in 0.1 A steps, read back from BL unsigned int MaxPWM; // read back from BL is less than 255 if BL is in current limit - unsigned int Temperature; // old BL-Ctrl will return a 255 here, the new version the temp. in °C + unsigned int Temperature; // old BL-Ctrl will return a 255 here, the new version the temp. in unsigned int RoundCount; }; @@ -1355,28 +1355,26 @@ extern "C" __EXPORT int mkblctrl_main(int argc, char *argv[]); int mkblctrl_main(int argc, char *argv[]) { - PortMode new_mode = PORT_MODE_UNSET; + PortMode port_mode = PORT_FULL_PWM; int pwm_update_rate_in_hz = UPDATE_RATE; - int motorcount = 0; + int motorcount = 8; int bus = 1; - bool motortest = false; int px4mode = MAPPING_PX4; int frametype = FRAME_PLUS; // + plus is default - - new_mode = PORT_FULL_PWM; - motorcount = 8; + bool motortest = false; + bool showHelp = false; + bool newMode = false; /* - * Mode switches. - * - * XXX use getopt? + * optional parameters */ - for (int i = 1; i < argc; i++) { /* argv[0] is "mk" */ + for (int i = 1; i < argc; i++) { /* look for the optional i2c bus parameter */ if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) { if (argc > i + 1) { bus = atoi(argv[i + 1]); + newMode = true; } else { errx(1, "missing argument for i2c bus (-b)"); return 1; @@ -1388,6 +1386,7 @@ mkblctrl_main(int argc, char *argv[]) if (argc > i + 1) { if(strcmp(argv[i + 1], "+") == 0 || strcmp(argv[i + 1], "x") == 0 || strcmp(argv[i + 1], "X") == 0) { px4mode = MAPPING_MK; + newMode = true; if(strcmp(argv[i + 1], "+") == 0) { frametype = FRAME_PLUS; } else { @@ -1405,30 +1404,36 @@ mkblctrl_main(int argc, char *argv[]) /* look for the optional test parameter */ if (strcmp(argv[i], "-t") == 0) { motortest = true; + newMode = true; + } + + /* look for the optional -h --help parameter */ + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + showHelp == true; } } - if(new_mode == PORT_MODE_UNSET) { - fprintf(stderr, "mkblctrl: unrecognised command, try:\n"); - fprintf(stderr, " [-mkmode frame{+/x}] [-b i2c_bus_number] [-t motortest]\n"); + if(showHelp) { + fprintf(stderr, "mkblctrl: help:\n"); + fprintf(stderr, " [-mkmode frame{+/x}] [-b i2c_bus_number] [-t motortest] [-h / --help]\n"); exit(1); } - if (mk_start(bus, motorcount) != OK) - errx(1, "failed to start the MK-BLCtrl driver"); + + if (g_mk == nullptr) { + if (mk_start(bus, motorcount) != OK) { + errx(1, "failed to start the MK-BLCtrl driver"); + } else { + newMode = true; + } + } - /* was a new mode set? */ - if (new_mode != PORT_MODE_UNSET) { - - /* yes but it's the same mode */ - //if (new_mode == g_port_mode) - //return OK; - - /* switch modes */ - fprintf(stderr, "[mkblctrl] %iHz Update Rate\n",pwm_update_rate_in_hz); - return mk_new_mode(new_mode, pwm_update_rate_in_hz, motorcount, motortest, px4mode, frametype); + /* parameter set ? */ + if (newMode) { + /* switch parameter */ + return mk_new_mode(port_mode, pwm_update_rate_in_hz, motorcount, motortest, px4mode, frametype); } /* test, etc. here g*/ From 8c6abe717db1f50c5d4b89f18e27f89608a9a1b8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 5 May 2013 11:24:31 +0200 Subject: [PATCH 094/129] Moved BLCTRL driver to new world --- makefiles/config_px4fmu_default.mk | 1 + {apps => src}/drivers/mkblctrl/mkblctrl.cpp | 0 .../Makefile => src/drivers/mkblctrl/module.mk | 10 ++++------ 3 files changed, 5 insertions(+), 6 deletions(-) rename {apps => src}/drivers/mkblctrl/mkblctrl.cpp (100%) rename apps/drivers/mkblctrl/Makefile => src/drivers/mkblctrl/module.mk (87%) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 043c8af40a..07f9bdbc32 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -28,6 +28,7 @@ MODULES += drivers/gps MODULES += drivers/hil MODULES += drivers/hott_telemetry MODULES += drivers/blinkm +MODULES += drivers/mkblctrl MODULES += modules/sensors # diff --git a/apps/drivers/mkblctrl/mkblctrl.cpp b/src/drivers/mkblctrl/mkblctrl.cpp similarity index 100% rename from apps/drivers/mkblctrl/mkblctrl.cpp rename to src/drivers/mkblctrl/mkblctrl.cpp diff --git a/apps/drivers/mkblctrl/Makefile b/src/drivers/mkblctrl/module.mk similarity index 87% rename from apps/drivers/mkblctrl/Makefile rename to src/drivers/mkblctrl/module.mk index b3be2c4687..3ac263b002 100644 --- a/apps/drivers/mkblctrl/Makefile +++ b/src/drivers/mkblctrl/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012,2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,8 @@ # Interface driver for the Mikrokopter BLCtrl # -APPNAME = mkblctrl -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mkblctrl -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common +SRCS = mkblctrl.cpp -include $(APPDIR)/mk/app.mk +INCLUDE_DIRS += $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common From bb94847511e76c34cf0fbebe874ed4fd6efe1c0c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 5 May 2013 11:43:29 +0200 Subject: [PATCH 095/129] Allowed parsing of floating point params from scripts --- src/systemcmds/param/param.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 56f5317e39..60e61d07b6 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: Lorenz Meier * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,7 @@ /** * @file param.c + * @author Lorenz Meier * * Parameter tool. */ @@ -262,7 +263,7 @@ do_set(const char* name, const char* val) switch (param_type(param)) { case PARAM_TYPE_INT32: if (!param_get(param, &i)) { - printf("old: %d", i); + printf("curr: %d", i); /* convert string */ char* end; @@ -276,14 +277,13 @@ do_set(const char* name, const char* val) case PARAM_TYPE_FLOAT: if (!param_get(param, &f)) { - printf("float values are not yet supported."); - // printf("old: %4.4f", (double)f); + printf("curr: %4.4f", (double)f); - // /* convert string */ - // char* end; - // f = strtof(val,&end); - // param_set(param, &f); - // printf(" -> new: %4.4f\n", f); + /* convert string */ + char* end; + f = strtod(val,&end); + param_set(param, &f); + printf(" -> new: %f\n", f); } From 3466006735123bfd27c94538d98af5b79f47d5a0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 5 May 2013 12:57:21 +0200 Subject: [PATCH 096/129] GPS velocity update rate validation for u-blox, WIP --- apps/drivers/gps/gps.cpp | 11 ++- apps/drivers/gps/gps_helper.cpp | 27 +++++- apps/drivers/gps/gps_helper.h | 19 +++- apps/drivers/gps/mtk.cpp | 4 + apps/drivers/gps/mtk.h | 6 +- apps/drivers/gps/ubx.cpp | 162 +++++++++++++++++++------------- apps/drivers/gps/ubx.h | 76 ++++++++++----- 7 files changed, 203 insertions(+), 102 deletions(-) diff --git a/apps/drivers/gps/gps.cpp b/apps/drivers/gps/gps.cpp index e35bdb944a..7db2578160 100644 --- a/apps/drivers/gps/gps.cpp +++ b/apps/drivers/gps/gps.cpp @@ -285,6 +285,11 @@ GPS::task_main() unlock(); if (_Helper->configure(_baudrate) == 0) { unlock(); + + // GPS is obviously detected successfully, reset statistics + _Helper->reset_update_rates(); + warnx("module configuration successful"); + while (_Helper->receive(TIMEOUT_5HZ) > 0 && !_task_should_exit) { // lock(); /* opportunistic publishing - else invalid data would end up on the bus */ @@ -372,7 +377,11 @@ GPS::print_info() warnx("position lock: %dD, last update %4.2f seconds ago", (int)_report.fix_type, (double)((float)(hrt_absolute_time() - _report.timestamp_position) / 1000000.0f)); warnx("lat: %d, lon: %d, alt: %d", _report.lat, _report.lon, _report.alt); - warnx("update rate: %6.2f Hz", (double)_rate); + warnx("rate position: \t%6.2f Hz", (double)_Helper->get_position_update_rate()); + warnx("rate velocity: \t%6.2f Hz", (double)_Helper->get_velocity_update_rate()); + warnx("rate publication:\t%6.2f Hz", (double)_rate); + + _Helper->reset_update_rates(); } usleep(100000); diff --git a/apps/drivers/gps/gps_helper.cpp b/apps/drivers/gps/gps_helper.cpp index 9c1fad5691..b03cccb453 100644 --- a/apps/drivers/gps/gps_helper.cpp +++ b/apps/drivers/gps/gps_helper.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. + * Copyright (C) 2012,2013 PX4 Development Team. All rights reserved. * Author: Thomas Gubler * Julian Oes * @@ -36,9 +36,32 @@ #include #include #include +#include #include "gps_helper.h" -/* @file gps_helper.cpp */ +/** + * @file gps_helper.cpp + */ + +float +GPS_Helper::get_position_update_rate() +{ + _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); +} + +float +GPS_Helper::get_velocity_update_rate() +{ + _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); +} + +float +GPS_Helper::reset_update_rates() +{ + _rate_count_vel = 0; + _rate_count_lat_lon = 0; + _interval_rate_start = hrt_absolute_time(); +} int GPS_Helper::set_baudrate(const int &fd, unsigned baud) diff --git a/apps/drivers/gps/gps_helper.h b/apps/drivers/gps/gps_helper.h index f3d3bc40b3..7e456a6aae 100644 --- a/apps/drivers/gps/gps_helper.h +++ b/apps/drivers/gps/gps_helper.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: Thomas Gubler * Julian Oes * @@ -33,7 +33,9 @@ * ****************************************************************************/ -/* @file gps_helper.h */ +/** + * @file gps_helper.h + */ #ifndef GPS_HELPER_H #define GPS_HELPER_H @@ -44,9 +46,18 @@ class GPS_Helper { public: - virtual int configure(unsigned &baud) = 0; + virtual int configure(unsigned &baud) = 0; virtual int receive(unsigned timeout) = 0; - int set_baudrate(const int &fd, unsigned baud); + int set_baudrate(const int &fd, unsigned baud); + float get_position_update_rate(); + float get_velocity_update_rate(); + float reset_update_rates(); + +protected: + uint8_t _rate_count_lat_lon; + uint8_t _rate_count_vel; + + uint64_t _interval_rate_start; }; #endif /* GPS_HELPER_H */ diff --git a/apps/drivers/gps/mtk.cpp b/apps/drivers/gps/mtk.cpp index 4762bd503a..62941d74b3 100644 --- a/apps/drivers/gps/mtk.cpp +++ b/apps/drivers/gps/mtk.cpp @@ -263,6 +263,10 @@ MTK::handle_message(gps_mtk_packet_t &packet) _gps_position->time_gps_usec += timeinfo_conversion_temp * 1e3; _gps_position->timestamp_position = _gps_position->timestamp_time = hrt_absolute_time(); + // Position and velocity update always at the same time + _rate_count_vel++; + _rate_count_lat_lon++; + return; } diff --git a/apps/drivers/gps/mtk.h b/apps/drivers/gps/mtk.h index d4e390b01b..b5cfbf0a6d 100644 --- a/apps/drivers/gps/mtk.h +++ b/apps/drivers/gps/mtk.h @@ -87,14 +87,14 @@ class MTK : public GPS_Helper public: MTK(const int &fd, struct vehicle_gps_position_s *gps_position); ~MTK(); - int receive(unsigned timeout); - int configure(unsigned &baudrate); + int receive(unsigned timeout); + int configure(unsigned &baudrate); private: /** * Parse the binary MTK packet */ - int parse_char(uint8_t b, gps_mtk_packet_t &packet); + int parse_char(uint8_t b, gps_mtk_packet_t &packet); /** * Handle the package once it has arrived diff --git a/apps/drivers/gps/ubx.cpp b/apps/drivers/gps/ubx.cpp index c150f52715..e887e8f7c1 100644 --- a/apps/drivers/gps/ubx.cpp +++ b/apps/drivers/gps/ubx.cpp @@ -60,7 +60,8 @@ UBX::UBX(const int &fd, struct vehicle_gps_position_s *gps_position) : _fd(fd), _gps_position(gps_position), -_waiting_for_ack(false) +_waiting_for_ack(false), +_disable_cmd_counter(0) { decode_init(); } @@ -144,7 +145,7 @@ UBX::configure(unsigned &baudrate) cfg_rate_packet.timeRef = UBX_CFG_RATE_PAYLOAD_TIMEREF; send_config_packet(_fd, (uint8_t*)&cfg_rate_packet, sizeof(cfg_rate_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { + if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) { /* try next baudrate */ continue; } @@ -164,74 +165,41 @@ UBX::configure(unsigned &baudrate) cfg_nav5_packet.fixMode = UBX_CFG_NAV5_PAYLOAD_FIXMODE; send_config_packet(_fd, (uint8_t*)&cfg_nav5_packet, sizeof(cfg_nav5_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { + if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) { /* try next baudrate */ continue; } - type_gps_bin_cfg_msg_packet_t cfg_msg_packet; - memset(&cfg_msg_packet, 0, sizeof(cfg_msg_packet)); - - _clsID_needed = UBX_CLASS_CFG; - _msgID_needed = UBX_MESSAGE_CFG_MSG; - - cfg_msg_packet.clsID = UBX_CLASS_CFG; - cfg_msg_packet.msgID = UBX_MESSAGE_CFG_MSG; - cfg_msg_packet.length = UBX_CFG_MSG_LENGTH; - /* Choose fast 5Hz rate for all messages except SVINFO which is big and not important */ - cfg_msg_packet.rate[1] = UBX_CFG_MSG_PAYLOAD_RATE1_5HZ; - - cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; - cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_POSLLH; - - send_config_packet(_fd, (uint8_t*)&cfg_msg_packet, sizeof(cfg_msg_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { - /* try next baudrate */ - continue; - } - - cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; - cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_TIMEUTC; - - send_config_packet(_fd, (uint8_t*)&cfg_msg_packet, sizeof(cfg_msg_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { - /* try next baudrate */ - continue; - } - - cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; - cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_SVINFO; - /* For satelites info 1Hz is enough */ - cfg_msg_packet.rate[1] = UBX_CFG_MSG_PAYLOAD_RATE1_1HZ; - - send_config_packet(_fd, (uint8_t*)&cfg_msg_packet, sizeof(cfg_msg_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { - /* try next baudrate */ - continue; - } - - cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; - cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_SOL; - - send_config_packet(_fd, (uint8_t*)&cfg_msg_packet, sizeof(cfg_msg_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { - /* try next baudrate */ - continue; - } - - cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; - cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_VELNED; - - send_config_packet(_fd, (uint8_t*)&cfg_msg_packet, sizeof(cfg_msg_packet)); - if (receive(UBX_CONFIG_TIMEOUT) < 0) { - /* try next baudrate */ - continue; - } -// cfg_msg_packet.msgClass_payload = UBX_CLASS_NAV; -// cfg_msg_packet.msgID_payload = UBX_MESSAGE_NAV_DOP; - -// cfg_msg_packet.msgClass_payload = UBX_CLASS_RXM; -// cfg_msg_packet.msgID_payload = UBX_MESSAGE_RXM_SVSI; + configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_POSLLH, + UBX_CFG_MSG_PAYLOAD_RATE1_5HZ); + /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; + configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_TIMEUTC, + UBX_CFG_MSG_PAYLOAD_RATE1_05HZ); + // /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; + configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_SOL, + UBX_CFG_MSG_PAYLOAD_RATE1_05HZ); + // /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; + configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_VELNED, + UBX_CFG_MSG_PAYLOAD_RATE1_5HZ); + // /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; + // configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_DOP, + // 0); + // /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; + configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_SVINFO, + 0); + // /* insist of receiving the ACK for this packet */ + // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) + // continue; _waiting_for_ack = false; return 0; @@ -239,6 +207,15 @@ UBX::configure(unsigned &baudrate) return -1; } +int +UBX::wait_for_ack(unsigned timeout) +{ + _waiting_for_ack = true; + int ret = receive(timeout); + _waiting_for_ack = false; + return ret; +} + int UBX::receive(unsigned timeout) { @@ -498,6 +475,8 @@ UBX::handle_message() _gps_position->eph_m = (float)packet->hAcc * 1e-3f; // from mm to m _gps_position->epv_m = (float)packet->vAcc * 1e-3f; // from mm to m + _rate_count_lat_lon++; + /* Add timestamp to finish the report */ _gps_position->timestamp_position = hrt_absolute_time(); /* only return 1 when new position is available */ @@ -653,6 +632,8 @@ UBX::handle_message() _gps_position->c_variance_rad = (float)packet->cAcc * M_DEG_TO_RAD_F * 1e-5f; _gps_position->vel_ned_valid = true; _gps_position->timestamp_velocity = hrt_absolute_time(); + + _rate_count_vel++; } break; @@ -693,6 +674,12 @@ UBX::handle_message() default: //we don't know the message warnx("UBX: Unknown message received: %d-%d\n",_message_class,_message_id); + if (_disable_cmd_counter++ == 0) { + // Don't attempt for every message to disable, some might not be disabled */ + warnx("Disabling message 0x%02x 0x%02x", (unsigned)_message_class, (unsigned)_message_id); + configure_message_rate(_message_class, _message_id, 0); + } + return ret; ret = -1; break; } @@ -736,6 +723,25 @@ UBX::add_checksum_to_message(uint8_t* message, const unsigned length) message[length-1] = ck_b; } +void +UBX::add_checksum(uint8_t* message, const unsigned length, uint8_t &ck_a, uint8_t &ck_b) +{ + for (unsigned i = 0; i < length; i++) { + ck_a = ck_a + message[i]; + ck_b = ck_b + ck_a; + } +} + +void +UBX::configure_message_rate(uint8_t msg_class, uint8_t msg_id, uint8_t rate) +{ + struct ubx_cfg_msg_rate msg; + msg.msg_class = msg_class; + msg.msg_id = msg_id; + msg.rate = rate; + send_message(CFG, UBX_CONFIG_STATE_RATE, &msg, sizeof(msg)); +} + void UBX::send_config_packet(const int &fd, uint8_t *packet, const unsigned length) { @@ -753,3 +759,27 @@ UBX::send_config_packet(const int &fd, uint8_t *packet, const unsigned length) if (ret != (int)length + (int)sizeof(sync_bytes)) // XXX is there a neater way to get rid of the unsigned signed warning? warnx("ubx: config write fail"); } + +void +UBX::send_message(uint8_t msg_class, uint8_t msg_id, void *msg, uint8_t size) +{ + struct ubx_header header; + uint8_t ck_a=0, ck_b=0; + header.sync1 = UBX_SYNC1; + header.sync2 = UBX_SYNC2; + header.msg_class = msg_class; + header.msg_id = msg_id; + header.length = size; + + add_checksum((uint8_t *)&header.msg_class, sizeof(header)-2, ck_a, ck_b); + add_checksum((uint8_t *)msg, size, ck_a, ck_b); + + // Configure receive check + _clsID_needed = msg_class; + _msgID_needed = msg_id; + + write(_fd, (const char *)&header, sizeof(header)); + write(_fd, (const char *)msg, size); + write(_fd, (const char *)&ck_a, 1); + write(_fd, (const char *)&ck_b, 1); +} diff --git a/apps/drivers/gps/ubx.h b/apps/drivers/gps/ubx.h index e3dd1c7ea9..a6cd0685de 100644 --- a/apps/drivers/gps/ubx.h +++ b/apps/drivers/gps/ubx.h @@ -65,11 +65,11 @@ #define UBX_MESSAGE_CFG_RATE 0x08 #define UBX_CFG_PRT_LENGTH 20 -#define UBX_CFG_PRT_PAYLOAD_PORTID 0x01 /**< UART1 */ -#define UBX_CFG_PRT_PAYLOAD_MODE 0x000008D0 /**< 0b0000100011010000: 8N1 */ -#define UBX_CFG_PRT_PAYLOAD_BAUDRATE 38400 /**< always choose 38400 as GPS baudrate */ -#define UBX_CFG_PRT_PAYLOAD_INPROTOMASK 0x01 /**< UBX in */ -#define UBX_CFG_PRT_PAYLOAD_OUTPROTOMASK 0x01 /**< UBX out */ +#define UBX_CFG_PRT_PAYLOAD_PORTID 0x01 /**< UART1 */ +#define UBX_CFG_PRT_PAYLOAD_MODE 0x000008D0 /**< 0b0000100011010000: 8N1 */ +#define UBX_CFG_PRT_PAYLOAD_BAUDRATE 38400 /**< always choose 38400 as GPS baudrate */ +#define UBX_CFG_PRT_PAYLOAD_INPROTOMASK 0x01 /**< UBX in */ +#define UBX_CFG_PRT_PAYLOAD_OUTPROTOMASK 0x01 /**< UBX out */ #define UBX_CFG_RATE_LENGTH 6 #define UBX_CFG_RATE_PAYLOAD_MEASRATE 200 /**< 200ms for 5Hz */ @@ -78,13 +78,14 @@ #define UBX_CFG_NAV5_LENGTH 36 -#define UBX_CFG_NAV5_PAYLOAD_MASK 0x0001 /**< only update dynamic model and fix mode */ +#define UBX_CFG_NAV5_PAYLOAD_MASK 0x0005 /**< XXX only update dynamic model and fix mode */ #define UBX_CFG_NAV5_PAYLOAD_DYNMODEL 7 /**< 0: portable, 2: stationary, 3: pedestrian, 4: automotive, 5: sea, 6: airborne <1g, 7: airborne <2g, 8: airborne <4g */ -#define UBX_CFG_NAV5_PAYLOAD_FIXMODE 2 /**< 1: 2D only, 2: 3D only, 3: Auto 2D/3D */ +#define UBX_CFG_NAV5_PAYLOAD_FIXMODE 2 /**< 1: 2D only, 2: 3D only, 3: Auto 2D/3D */ #define UBX_CFG_MSG_LENGTH 8 #define UBX_CFG_MSG_PAYLOAD_RATE1_5HZ 0x01 /**< {0x00, 0x01, 0x00, 0x00, 0x00, 0x00} the second entry is for UART1 */ #define UBX_CFG_MSG_PAYLOAD_RATE1_1HZ 0x05 /**< {0x00, 0x05, 0x00, 0x00, 0x00, 0x00} the second entry is for UART1 */ +#define UBX_CFG_MSG_PAYLOAD_RATE1_05HZ 10 #define UBX_MAX_PAYLOAD_LENGTH 500 @@ -92,6 +93,14 @@ /** the structures of the binary packets */ #pragma pack(push, 1) +struct ubx_header { + uint8_t sync1; + uint8_t sync2; + uint8_t msg_class; + uint8_t msg_id; + uint16_t length; +}; + typedef struct { uint32_t time_milliseconds; /**< GPS Millisecond Time of Week */ int32_t lon; /**< Longitude * 1e-7, deg */ @@ -274,11 +283,17 @@ typedef struct { uint16_t length; uint8_t msgClass_payload; uint8_t msgID_payload; - uint8_t rate[6]; + uint8_t rate; uint8_t ck_a; uint8_t ck_b; } type_gps_bin_cfg_msg_packet_t; +struct ubx_cfg_msg_rate { + uint8_t msg_class; + uint8_t msg_id; + uint8_t rate; +}; + // END the structures of the binary packets // ************ @@ -341,55 +356,64 @@ class UBX : public GPS_Helper public: UBX(const int &fd, struct vehicle_gps_position_s *gps_position); ~UBX(); - int receive(unsigned timeout); - int configure(unsigned &baudrate); + int receive(unsigned timeout); + int configure(unsigned &baudrate); private: /** * Parse the binary MTK packet */ - int parse_char(uint8_t b); + int parse_char(uint8_t b); /** * Handle the package once it has arrived */ - int handle_message(void); + int handle_message(void); /** * Reset the parse state machine for a fresh start */ - void decode_init(void); + void decode_init(void); /** * While parsing add every byte (except the sync bytes) to the checksum */ - void add_byte_to_checksum(uint8_t); + void add_byte_to_checksum(uint8_t); /** * Add the two checksum bytes to an outgoing message */ - void add_checksum_to_message(uint8_t* message, const unsigned length); + void add_checksum_to_message(uint8_t* message, const unsigned length); /** * Helper to send a config packet */ - void send_config_packet(const int &fd, uint8_t *packet, const unsigned length); + void send_config_packet(const int &fd, uint8_t *packet, const unsigned length); - int _fd; + void configure_message_rate(uint8_t msg_class, uint8_t msg_id, uint8_t rate); + + void send_message(uint8_t msg_class, uint8_t msg_id, void *msg, uint8_t size); + + void add_checksum(uint8_t* message, const unsigned length, uint8_t &ck_a, uint8_t &ck_b); + + int wait_for_ack(unsigned timeout); + + int _fd; struct vehicle_gps_position_s *_gps_position; ubx_config_state_t _config_state; - bool _waiting_for_ack; - uint8_t _clsID_needed; - uint8_t _msgID_needed; + bool _waiting_for_ack; + uint8_t _clsID_needed; + uint8_t _msgID_needed; ubx_decode_state_t _decode_state; - uint8_t _rx_buffer[RECV_BUFFER_SIZE]; - unsigned _rx_count; - uint8_t _rx_ck_a; - uint8_t _rx_ck_b; - ubx_message_class_t _message_class; + uint8_t _rx_buffer[RECV_BUFFER_SIZE]; + unsigned _rx_count; + uint8_t _rx_ck_a; + uint8_t _rx_ck_b; + ubx_message_class_t _message_class; ubx_message_id_t _message_id; - unsigned _payload_size; + unsigned _payload_size; + uint8_t _disable_cmd_counter; }; #endif /* UBX_H_ */ From 1f800edc7676a6ea13127746ce38787a1e98b935 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Sun, 5 May 2013 15:51:16 +0400 Subject: [PATCH 097/129] Still threshold increased to 0.1m/s^2, and orientation error threshold to 5m/s^2. Timeout increased to 30s. --- apps/commander/accelerometer_calibration.c | 66 +++++++++++----------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c index 1807369080..991145d73c 100644 --- a/apps/commander/accelerometer_calibration.c +++ b/apps/commander/accelerometer_calibration.c @@ -224,7 +224,7 @@ int do_accel_calibration_mesurements(int mavlink_fd, float accel_offs[3], float * Wait for vehicle become still and detect it's orientation. * * @return 0..5 according to orientation when vehicle is still and ready for measurements, - * ERROR if vehicle is not still after 10s or orientation error is more than 20% + * ERROR if vehicle is not still after 30s or orientation error is more than 5m/s^2 */ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { struct sensor_combined_s sensor; @@ -235,17 +235,17 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { float accel_len2 = 0.0f; /* EMA time constant in seconds*/ float ema_len = 0.2f; - /* set "still" threshold to 0.005 m/s^2 */ - float still_thr2 = pow(0.05f / CONSTANTS_ONE_G, 2); - /* set accel error threshold to 30% of accel vector length */ - float accel_err_thr = 0.3f; + /* set "still" threshold to 0.1 m/s^2 */ + float still_thr2 = pow(0.1f, 2); + /* set accel error threshold to 5m/s^2 */ + float accel_err_thr = 5.0f; /* still time required in us */ int64_t still_time = 2000000; struct pollfd fds[1] = { { .fd = sub_sensor_combined, .events = POLLIN } }; hrt_abstime t_start = hrt_absolute_time(); - /* set deadline to 20s */ - hrt_abstime timeout = 20000000; + /* set timeout to 30s */ + hrt_abstime timeout = 30000000; hrt_abstime t_timeout = t_start + timeout; hrt_abstime t = t_start; hrt_abstime t_prev = t_start; @@ -267,11 +267,10 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { if (d > accel_disp[i]) accel_disp[i] = d; } - accel_len2 = accel_ema[0] * accel_ema[0] + accel_ema[1] * accel_ema[1] + accel_ema[2] * accel_ema[2]; - float still_thr_raw2 = still_thr2 * accel_len2; - if ( accel_disp[0] < still_thr_raw2 && - accel_disp[1] < still_thr_raw2 && - accel_disp[2] < still_thr_raw2 ) { + /* still detector with hysteresis */ + if ( accel_disp[0] < still_thr2 && + accel_disp[1] < still_thr2 && + accel_disp[2] < still_thr2 ) { /* is still now */ if (t_still == 0) { /* first time */ @@ -285,9 +284,9 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { break; } } - } else if ( accel_disp[0] > still_thr_raw2 * 2.0f || - accel_disp[1] > still_thr_raw2 * 2.0f || - accel_disp[2] > still_thr_raw2 * 2.0f) { + } else if ( accel_disp[0] > still_thr2 * 2.0f || + accel_disp[1] > still_thr2 * 2.0f || + accel_disp[2] > still_thr2 * 2.0f) { /* not still, reset still start time */ if (t_still != 0) { mavlink_log_info(mavlink_fd, "moving..."); @@ -306,30 +305,29 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { } float accel_len = sqrt(accel_len2); - float accel_err_thr_raw = accel_len * accel_err_thr; - if ( fabs(accel_ema[0] - accel_len) < accel_err_thr_raw && - fabs(accel_ema[1]) < accel_err_thr_raw && - fabs(accel_ema[2]) < accel_err_thr_raw ) + if ( fabs(accel_ema[0] - accel_len) < accel_err_thr && + fabs(accel_ema[1]) < accel_err_thr && + fabs(accel_ema[2]) < accel_err_thr ) return 0; // [ g, 0, 0 ] - if ( fabs(accel_ema[0] + accel_len) < accel_err_thr_raw && - fabs(accel_ema[1]) < accel_err_thr_raw && - fabs(accel_ema[2]) < accel_err_thr_raw ) + if ( fabs(accel_ema[0] + accel_len) < accel_err_thr && + fabs(accel_ema[1]) < accel_err_thr && + fabs(accel_ema[2]) < accel_err_thr ) return 1; // [ -g, 0, 0 ] - if ( fabs(accel_ema[0]) < accel_err_thr_raw && - fabs(accel_ema[1] - accel_len) < accel_err_thr_raw && - fabs(accel_ema[2]) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr && + fabs(accel_ema[1] - accel_len) < accel_err_thr && + fabs(accel_ema[2]) < accel_err_thr ) return 2; // [ 0, g, 0 ] - if ( fabs(accel_ema[0]) < accel_err_thr_raw && - fabs(accel_ema[1] + accel_len) < accel_err_thr_raw && - fabs(accel_ema[2]) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr && + fabs(accel_ema[1] + accel_len) < accel_err_thr && + fabs(accel_ema[2]) < accel_err_thr ) return 3; // [ 0, -g, 0 ] - if ( fabs(accel_ema[0]) < accel_err_thr_raw && - fabs(accel_ema[1]) < accel_err_thr_raw && - fabs(accel_ema[2] - accel_len) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr && + fabs(accel_ema[1]) < accel_err_thr && + fabs(accel_ema[2] - accel_len) < accel_err_thr ) return 4; // [ 0, 0, g ] - if ( fabs(accel_ema[0]) < accel_err_thr_raw && - fabs(accel_ema[1]) < accel_err_thr_raw && - fabs(accel_ema[2] + accel_len) < accel_err_thr_raw ) + if ( fabs(accel_ema[0]) < accel_err_thr && + fabs(accel_ema[1]) < accel_err_thr && + fabs(accel_ema[2] + accel_len) < accel_err_thr ) return 5; // [ 0, 0, -g ] mavlink_log_info(mavlink_fd, "ERROR: invalid orientation"); From 27a25b5e172c972e4f9f31c2a30114498346bb08 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 5 May 2013 18:50:23 +0200 Subject: [PATCH 098/129] Improved update rate for velocity estimate, not yet where we want it to be --- apps/drivers/gps/gps_helper.cpp | 4 ++-- apps/drivers/gps/ubx.cpp | 10 +++++----- apps/drivers/gps/ubx.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/drivers/gps/gps_helper.cpp b/apps/drivers/gps/gps_helper.cpp index b03cccb453..54ac90dabd 100644 --- a/apps/drivers/gps/gps_helper.cpp +++ b/apps/drivers/gps/gps_helper.cpp @@ -46,13 +46,13 @@ float GPS_Helper::get_position_update_rate() { - _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); + return _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); } float GPS_Helper::get_velocity_update_rate() { - _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); + return _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); } float diff --git a/apps/drivers/gps/ubx.cpp b/apps/drivers/gps/ubx.cpp index e887e8f7c1..b3093b0f6f 100644 --- a/apps/drivers/gps/ubx.cpp +++ b/apps/drivers/gps/ubx.cpp @@ -140,7 +140,7 @@ UBX::configure(unsigned &baudrate) cfg_rate_packet.clsID = UBX_CLASS_CFG; cfg_rate_packet.msgID = UBX_MESSAGE_CFG_RATE; cfg_rate_packet.length = UBX_CFG_RATE_LENGTH; - cfg_rate_packet.measRate = UBX_CFG_RATE_PAYLOAD_MEASRATE; + cfg_rate_packet.measRate = UBX_CFG_RATE_PAYLOAD_MEASINTERVAL; cfg_rate_packet.navRate = UBX_CFG_RATE_PAYLOAD_NAVRATE; cfg_rate_packet.timeRef = UBX_CFG_RATE_PAYLOAD_TIMEREF; @@ -176,17 +176,17 @@ UBX::configure(unsigned &baudrate) // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) // continue; configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_TIMEUTC, - UBX_CFG_MSG_PAYLOAD_RATE1_05HZ); + 1); // /* insist of receiving the ACK for this packet */ // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) // continue; configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_SOL, - UBX_CFG_MSG_PAYLOAD_RATE1_05HZ); + 1); // /* insist of receiving the ACK for this packet */ // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) // continue; configure_message_rate(UBX_CLASS_NAV, UBX_MESSAGE_NAV_VELNED, - UBX_CFG_MSG_PAYLOAD_RATE1_5HZ); + 1); // /* insist of receiving the ACK for this packet */ // if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0) // continue; @@ -739,7 +739,7 @@ UBX::configure_message_rate(uint8_t msg_class, uint8_t msg_id, uint8_t rate) msg.msg_class = msg_class; msg.msg_id = msg_id; msg.rate = rate; - send_message(CFG, UBX_CONFIG_STATE_RATE, &msg, sizeof(msg)); + send_message(CFG, UBX_MESSAGE_CFG_MSG, &msg, sizeof(msg)); } void diff --git a/apps/drivers/gps/ubx.h b/apps/drivers/gps/ubx.h index a6cd0685de..5a433642ce 100644 --- a/apps/drivers/gps/ubx.h +++ b/apps/drivers/gps/ubx.h @@ -72,7 +72,7 @@ #define UBX_CFG_PRT_PAYLOAD_OUTPROTOMASK 0x01 /**< UBX out */ #define UBX_CFG_RATE_LENGTH 6 -#define UBX_CFG_RATE_PAYLOAD_MEASRATE 200 /**< 200ms for 5Hz */ +#define UBX_CFG_RATE_PAYLOAD_MEASINTERVAL 200 /**< 200ms for 5Hz */ #define UBX_CFG_RATE_PAYLOAD_NAVRATE 1 /**< cannot be changed */ #define UBX_CFG_RATE_PAYLOAD_TIMEREF 0 /**< 0: UTC, 1: GPS time */ From 3bf26ac51f76389217cf2f604ca2420bcc050acf Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 5 May 2013 16:48:05 -0700 Subject: [PATCH 099/129] Obsolete bogus EXTRAFLAGS, add language-specific flags overrides. --- makefiles/toolchain_gnu-arm-eabi.mk | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 32a2773732..efb6b432a0 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -98,6 +98,14 @@ INSTRUMENTATIONDEFINES = -finstrument-functions \ ARCHCFLAGS = -std=gnu99 ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x +# Compatibility +# XXX remove this once downstream users are fixed +# +ifneq ($(EXTRAFLAGS),) +$(warning EXTRAFLAGS is deprecated, use EXTRADEFINES for common pre-processor definitions. See also EXTRACFLAGS, EXTRACXXFLAGS and EXTRALDFLAGS.) +EXTRADEFINES += $(EXTRAFLAGS) +endif + # Generic warnings # ARCHWARNINGS = -Wall \ @@ -144,6 +152,7 @@ CFLAGS = $(ARCHCFLAGS) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ $(EXTRADEFINES) \ + $(EXTRACFLAGS) \ -fno-common \ $(addprefix -I,$(INCLUDE_DIRS)) @@ -156,18 +165,22 @@ CXXFLAGS = $(ARCHCXXFLAGS) \ $(ARCHXXINCLUDES) \ $(INSTRUMENTATIONDEFINES) \ $(ARCHDEFINES) \ - $(EXTRADEFINES) \ -DCONFIG_WCHAR_BUILTIN \ + $(EXTRADEFINES) \ + $(EXTRACXXFLAGS) \ $(addprefix -I,$(INCLUDE_DIRS)) # Flags we pass to the assembler # -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ \ + $(EXTRADEFINES) \ + $(EXTRAAFLAGS) # Flags we pass to the linker # LDFLAGS += --warn-common \ --gc-sections \ + $(EXTRALDFLAGS) \ $(addprefix -T,$(LDSCRIPT)) \ $(addprefix -L,$(LIB_DIRS)) @@ -189,7 +202,7 @@ DEP_INCLUDES = $(subst .o,.d,$(OBJS)) define COMPILE @$(ECHO) "CC: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -MD -c $(CFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 + $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 endef # Compile C++ source $1 to $2 @@ -198,7 +211,7 @@ endef define COMPILEXX @$(ECHO) "CXX: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CXX) -MD -c $(CXXFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 + $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 endef # Assemble $1 into $2 @@ -206,7 +219,7 @@ endef define ASSEMBLE @$(ECHO) "AS: $1" @$(MKDIR) -p $(dir $2) - $(Q) $(CC) -c $(AFLAGS) $(EXTRAFLAGS) $(abspath $1) -o $2 + $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 endef # Produce partially-linked $1 from files in $2 From 1ca535b94145c94db04d0655c2f4fb25c76a717a Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 5 May 2013 16:52:26 -0700 Subject: [PATCH 100/129] Fix whitespace damage, update help text to indicate the -m option is for debug use only. --- src/systemcmds/pwm/pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systemcmds/pwm/pwm.c b/src/systemcmds/pwm/pwm.c index 08e6c88dfa..ff733df52f 100644 --- a/src/systemcmds/pwm/pwm.c +++ b/src/systemcmds/pwm/pwm.c @@ -78,7 +78,7 @@ usage(const char *reason) " Channel group that should update at the alternate rate (may be specified more than once)\n" " arm | disarm Arm or disarm the ouptut\n" " ... PWM output values in microseconds to assign to the PWM outputs\n" - " Directly supply alt rate channel mask\n" + " Directly supply alt rate channel mask (debug use only)\n" "\n" "When -c is specified, any channel groups not listed with -c will update at the default rate.\n" ); From 3b65281f00150eaa29cfec1d4a4cb86fc83c326d Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 5 May 2013 17:19:23 -0700 Subject: [PATCH 101/129] Remove EXTRAFLAGS compatibility hack. --- makefiles/toolchain_gnu-arm-eabi.mk | 8 -------- 1 file changed, 8 deletions(-) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index efb6b432a0..0e651e53c8 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -98,14 +98,6 @@ INSTRUMENTATIONDEFINES = -finstrument-functions \ ARCHCFLAGS = -std=gnu99 ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x -# Compatibility -# XXX remove this once downstream users are fixed -# -ifneq ($(EXTRAFLAGS),) -$(warning EXTRAFLAGS is deprecated, use EXTRADEFINES for common pre-processor definitions. See also EXTRACFLAGS, EXTRACXXFLAGS and EXTRALDFLAGS.) -EXTRADEFINES += $(EXTRAFLAGS) -endif - # Generic warnings # ARCHWARNINGS = -Wall \ From 41ec41cf8cc16309cf6f7e949d3ddad78e5f44a2 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Mon, 6 May 2013 18:21:56 +0400 Subject: [PATCH 102/129] Accelerometer calibration bugfix --- apps/commander/accelerometer_calibration.c | 14 ++++++-------- apps/commander/accelerometer_calibration.h | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/commander/accelerometer_calibration.c b/apps/commander/accelerometer_calibration.c index 991145d73c..d79dd93dd0 100644 --- a/apps/commander/accelerometer_calibration.c +++ b/apps/commander/accelerometer_calibration.c @@ -232,7 +232,6 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { float accel_ema[3] = { 0.0f, 0.0f, 0.0f }; /* max-hold dispersion of accel */ float accel_disp[3] = { 0.0f, 0.0f, 0.0f }; - float accel_len2 = 0.0f; /* EMA time constant in seconds*/ float ema_len = 0.2f; /* set "still" threshold to 0.1 m/s^2 */ @@ -304,30 +303,29 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) { } } - float accel_len = sqrt(accel_len2); - if ( fabs(accel_ema[0] - accel_len) < accel_err_thr && + if ( fabs(accel_ema[0] - CONSTANTS_ONE_G) < accel_err_thr && fabs(accel_ema[1]) < accel_err_thr && fabs(accel_ema[2]) < accel_err_thr ) return 0; // [ g, 0, 0 ] - if ( fabs(accel_ema[0] + accel_len) < accel_err_thr && + if ( fabs(accel_ema[0] + CONSTANTS_ONE_G) < accel_err_thr && fabs(accel_ema[1]) < accel_err_thr && fabs(accel_ema[2]) < accel_err_thr ) return 1; // [ -g, 0, 0 ] if ( fabs(accel_ema[0]) < accel_err_thr && - fabs(accel_ema[1] - accel_len) < accel_err_thr && + fabs(accel_ema[1] - CONSTANTS_ONE_G) < accel_err_thr && fabs(accel_ema[2]) < accel_err_thr ) return 2; // [ 0, g, 0 ] if ( fabs(accel_ema[0]) < accel_err_thr && - fabs(accel_ema[1] + accel_len) < accel_err_thr && + fabs(accel_ema[1] + CONSTANTS_ONE_G) < accel_err_thr && fabs(accel_ema[2]) < accel_err_thr ) return 3; // [ 0, -g, 0 ] if ( fabs(accel_ema[0]) < accel_err_thr && fabs(accel_ema[1]) < accel_err_thr && - fabs(accel_ema[2] - accel_len) < accel_err_thr ) + fabs(accel_ema[2] - CONSTANTS_ONE_G) < accel_err_thr ) return 4; // [ 0, 0, g ] if ( fabs(accel_ema[0]) < accel_err_thr && fabs(accel_ema[1]) < accel_err_thr && - fabs(accel_ema[2] + accel_len) < accel_err_thr ) + fabs(accel_ema[2] + CONSTANTS_ONE_G) < accel_err_thr ) return 5; // [ 0, 0, -g ] mavlink_log_info(mavlink_fd, "ERROR: invalid orientation"); diff --git a/apps/commander/accelerometer_calibration.h b/apps/commander/accelerometer_calibration.h index c0169c2a13..a11cf93d3c 100644 --- a/apps/commander/accelerometer_calibration.h +++ b/apps/commander/accelerometer_calibration.h @@ -1,8 +1,8 @@ /* * accelerometer_calibration.h * - * Created on: 25.04.2013 - * Author: ton + * Copyright (C) 2013 Anton Babushkin. All rights reserved. + * Author: Anton Babushkin */ #ifndef ACCELEROMETER_CALIBRATION_H_ From f3e6e4bb50d9d5e63ee423a25713d9033adcebf4 Mon Sep 17 00:00:00 2001 From: Anton Babushkin Date: Mon, 6 May 2013 22:59:45 +0400 Subject: [PATCH 103/129] Update servo arm only on real change. --- apps/drivers/px4fmu/fmu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/drivers/px4fmu/fmu.cpp b/apps/drivers/px4fmu/fmu.cpp index e547245367..761a23c426 100644 --- a/apps/drivers/px4fmu/fmu.cpp +++ b/apps/drivers/px4fmu/fmu.cpp @@ -505,7 +505,11 @@ PX4FMU::task_main() orb_copy(ORB_ID(actuator_armed), _t_armed, &aa); /* update PWM servo armed status if armed and not locked down */ - up_pwm_servo_arm(aa.armed && !aa.lockdown); + bool set_armed = aa.armed && !aa.lockdown; + if (set_armed != _armed) { + _armed = set_armed; + up_pwm_servo_arm(set_armed); + } } // see if we have new PPM input data From eac9e10a83ab2f897e4d0c2c6c8cd9f9f55b29cb Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 6 May 2013 23:50:14 +0200 Subject: [PATCH 104/129] Moved calibration --- .../modules}/commander/accelerometer_calibration.c | 0 .../modules}/commander/accelerometer_calibration.h | 0 src/modules/commander/module.mk | 10 ++++++---- 3 files changed, 6 insertions(+), 4 deletions(-) rename {apps => src/modules}/commander/accelerometer_calibration.c (100%) rename {apps => src/modules}/commander/accelerometer_calibration.h (100%) diff --git a/apps/commander/accelerometer_calibration.c b/src/modules/commander/accelerometer_calibration.c similarity index 100% rename from apps/commander/accelerometer_calibration.c rename to src/modules/commander/accelerometer_calibration.c diff --git a/apps/commander/accelerometer_calibration.h b/src/modules/commander/accelerometer_calibration.h similarity index 100% rename from apps/commander/accelerometer_calibration.h rename to src/modules/commander/accelerometer_calibration.h diff --git a/src/modules/commander/module.mk b/src/modules/commander/module.mk index 556d5c2df6..fe44e955ad 100644 --- a/src/modules/commander/module.mk +++ b/src/modules/commander/module.mk @@ -35,7 +35,9 @@ # Main system state machine # -MODULE_COMMAND = commander -SRCS = commander.c \ - state_machine_helper.c \ - calibration_routines.c +MODULE_COMMAND = commander +SRCS = commander.c \ + state_machine_helper.c \ + calibration_routines.c \ + accelerometer_calibration.c + From 100bcefc17cb77eff7085ef8c6c3055492c2ae32 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 16 Apr 2013 14:11:56 -0400 Subject: [PATCH 105/129] Added velocity adjustment to stabilization. --- apps/controllib/fixedwing.cpp | 54 +++++++++++++++++++---------- apps/controllib/fixedwing.hpp | 6 ++-- apps/examples/control_demo/params.c | 3 +- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/apps/controllib/fixedwing.cpp b/apps/controllib/fixedwing.cpp index 1cc28b9dd9..6309a12255 100644 --- a/apps/controllib/fixedwing.cpp +++ b/apps/controllib/fixedwing.cpp @@ -56,9 +56,9 @@ BlockYawDamper::BlockYawDamper(SuperBlock *parent, const char *name) : BlockYawDamper::~BlockYawDamper() {}; -void BlockYawDamper::update(float rCmd, float r) +void BlockYawDamper::update(float rCmd, float r, float outputScale) { - _rudder = _r2Rdr.update(rCmd - + _rudder = outputScale*_r2Rdr.update(rCmd - _rWashout.update(_rLowPass.update(r))); } @@ -77,13 +77,13 @@ BlockStabilization::BlockStabilization(SuperBlock *parent, const char *name) : BlockStabilization::~BlockStabilization() {}; void BlockStabilization::update(float pCmd, float qCmd, float rCmd, - float p, float q, float r) + float p, float q, float r, float outputScale) { - _aileron = _p2Ail.update( + _aileron = outputScale*_p2Ail.update( pCmd - _pLowPass.update(p)); - _elevator = _q2Elv.update( + _elevator = outputScale*_q2Elv.update( qCmd - _qLowPass.update(q)); - _yawDamper.update(rCmd, r); + _yawDamper.update(rCmd, r, outputScale); } BlockWaypointGuidance::BlockWaypointGuidance(SuperBlock *parent, const char *name) : @@ -163,11 +163,11 @@ BlockMultiModeBacksideAutopilot::BlockMultiModeBacksideAutopilot(SuperBlock *par // guidance block _guide(this, ""), - // block params - _trimAil(this, "TRIM_ROLL", false), /* general roll trim (full name: TRIM_ROLL) */ - _trimElv(this, "TRIM_PITCH", false), /* general pitch trim */ - _trimRdr(this, "TRIM_YAW", false), /* general yaw trim */ - _trimThr(this, "TRIM_THR", true), /* FWB_ specific throttle trim (full name: FWB_TRIM_THR) */ + _trimAil(this, "TRIM_ROLL", false), /* general roll trim (full name: TRIM_ROLL) */ + _trimElv(this, "TRIM_PITCH", false), /* general pitch trim */ + _trimRdr(this, "TRIM_YAW", false), /* general yaw trim */ + _trimThr(this, "TRIM_THR"), /* FWB_ specific throttle trim (full name: FWB_TRIM_THR) */ + _trimV(this, "TRIM_V"), /* FWB_ specific trim velocity (full name : FWB_TRIM_V) */ _vCmd(this, "V_CMD"), _rocMax(this, "ROC_MAX"), @@ -228,7 +228,15 @@ void BlockMultiModeBacksideAutopilot::update() _guide.update(_pos, _att, _posCmd, _lastPosCmd); // calculate velocity, XXX should be airspeed, but using ground speed for now - float v = sqrtf(_pos.vx * _pos.vx + _pos.vy * _pos.vy + _pos.vz * _pos.vz); + // for the purpose of control we will limit the velocity feedback between + // the min/max velocity + float v = _vLimit.update(sqrtf( + _pos.vx * _pos.vx + + _pos.vy * _pos.vy + + _pos.vz * _pos.vz)); + + // limit velocity command between min/max velocity + float vCmd = _vLimit.update(_vCmd.get()); // altitude hold float dThrottle = _h2Thr.update(_posCmd.altitude - _pos.alt); @@ -240,16 +248,19 @@ void BlockMultiModeBacksideAutopilot::update() // velocity hold // negative sign because nose over to increase speed - float thetaCmd = _theLimit.update(-_v2Theta.update( - _vLimit.update(_vCmd.get()) - v)); + float thetaCmd = _theLimit.update(-_v2Theta.update(vCmd - v)); float qCmd = _theta2Q.update(thetaCmd - _att.pitch); // yaw rate cmd float rCmd = 0; // stabilization + float velocityRatio = _trimV.get()/v; + float outputScale = velocityRatio*velocityRatio; + // this term scales the output based on the dynamic pressure change from trim _stabilization.update(pCmd, qCmd, rCmd, - _att.rollspeed, _att.pitchspeed, _att.yawspeed); + _att.rollspeed, _att.pitchspeed, _att.yawspeed, + outputScale); // output _actuators.control[CH_AIL] = _stabilization.getAileron() + _trimAil.get(); @@ -280,7 +291,12 @@ void BlockMultiModeBacksideAutopilot::update() } else if (_status.manual_control_mode == VEHICLE_MANUAL_CONTROL_MODE_SAS) { // calculate velocity, XXX should be airspeed, but using ground speed for now - float v = sqrtf(_pos.vx * _pos.vx + _pos.vy * _pos.vy + _pos.vz * _pos.vz); + // for the purpose of control we will limit the velocity feedback between + // the min/max velocity + float v = _vLimit.update(sqrtf( + _pos.vx * _pos.vx + + _pos.vy * _pos.vy + + _pos.vz * _pos.vz)); // pitch channel -> rate of climb // TODO, might want to put a gain on this, otherwise commanding @@ -294,8 +310,10 @@ void BlockMultiModeBacksideAutopilot::update() // throttle channel -> velocity // negative sign because nose over to increase speed - float vCmd = _manual.throttle * (_vLimit.getMax() - _vLimit.getMin()) + _vLimit.getMin(); - float thetaCmd = _theLimit.update(-_v2Theta.update(_vLimit.update(vCmd) - v)); + float vCmd = _vLimit.update(_manual.throttle * + (_vLimit.getMax() - _vLimit.getMin()) + + _vLimit.getMin()); + float thetaCmd = _theLimit.update(-_v2Theta.update(vCmd - v)); float qCmd = _theta2Q.update(thetaCmd - _att.pitch); // yaw rate cmd diff --git a/apps/controllib/fixedwing.hpp b/apps/controllib/fixedwing.hpp index 281cbb4cb6..c908ea2371 100644 --- a/apps/controllib/fixedwing.hpp +++ b/apps/controllib/fixedwing.hpp @@ -193,7 +193,7 @@ public: * good idea to declare a member to store the temporary * variable. */ - void update(float rCmd, float r); + void update(float rCmd, float r, float outputScale = 1.0); /** * Rudder output value accessor @@ -226,7 +226,8 @@ public: BlockStabilization(SuperBlock *parent, const char *name); virtual ~BlockStabilization(); void update(float pCmd, float qCmd, float rCmd, - float p, float q, float r); + float p, float q, float r, + float outputScale = 1.0); float getAileron() { return _aileron; } float getElevator() { return _elevator; } float getRudder() { return _yawDamper.getRudder(); } @@ -322,6 +323,7 @@ private: BlockParam _trimElv; BlockParam _trimRdr; BlockParam _trimThr; + BlockParam _trimV; BlockParam _vCmd; BlockParam _rocMax; diff --git a/apps/examples/control_demo/params.c b/apps/examples/control_demo/params.c index 428b779b17..cce38c3ec3 100644 --- a/apps/examples/control_demo/params.c +++ b/apps/examples/control_demo/params.c @@ -68,4 +68,5 @@ PARAM_DEFINE_FLOAT(FWB_ROC2THR_D, 0.0f); PARAM_DEFINE_FLOAT(FWB_ROC2THR_D_LP, 0.0f); PARAM_DEFINE_FLOAT(FWB_ROC2THR_I_MAX, 0.0f); -PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.8f); // trim throttle (0,1) +PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.8f); // trim throttle (0,1) +PARAM_DEFINE_FLOAT(FWB_TRIM_V, 12.0f); // trim velocity, m/s From 3ed93430060228b64893119a439187725d35d7ec Mon Sep 17 00:00:00 2001 From: James Goppert Date: Sun, 14 Apr 2013 20:09:38 -0400 Subject: [PATCH 106/129] HIL pressure fix. --- apps/controllib/fixedwing.cpp | 10 +-- apps/controllib/fixedwing.hpp | 6 +- apps/examples/control_demo/params.c | 14 ++-- apps/mavlink/mavlink_receiver.c | 122 +--------------------------- 4 files changed, 17 insertions(+), 135 deletions(-) diff --git a/apps/controllib/fixedwing.cpp b/apps/controllib/fixedwing.cpp index 1cc28b9dd9..3836a1a0fc 100644 --- a/apps/controllib/fixedwing.cpp +++ b/apps/controllib/fixedwing.cpp @@ -156,9 +156,9 @@ BlockMultiModeBacksideAutopilot::BlockMultiModeBacksideAutopilot(SuperBlock *par _theLimit(this, "THE"), _vLimit(this, "V"), - // altitude/roc hold + // altitude/climb rate hold _h2Thr(this, "H2THR"), - _roc2Thr(this, "ROC2THR"), + _cr2Thr(this, "CR2THR"), // guidance block _guide(this, ""), @@ -170,7 +170,7 @@ BlockMultiModeBacksideAutopilot::BlockMultiModeBacksideAutopilot(SuperBlock *par _trimThr(this, "TRIM_THR", true), /* FWB_ specific throttle trim (full name: FWB_TRIM_THR) */ _vCmd(this, "V_CMD"), - _rocMax(this, "ROC_MAX"), + _crMax(this, "CR_MAX"), _attPoll(), _lastPosCmd(), _timeStamp(0) @@ -285,8 +285,8 @@ void BlockMultiModeBacksideAutopilot::update() // pitch channel -> rate of climb // TODO, might want to put a gain on this, otherwise commanding // from +1 -> -1 m/s for rate of climb - //float dThrottle = _roc2Thr.update( - //_rocMax.get()*_manual.pitch - _pos.vz); + //float dThrottle = _cr2Thr.update( + //_crMax.get()*_manual.pitch - _pos.vz); // roll channel -> bank angle float phiCmd = _phiLimit.update(_manual.roll * _phiLimit.getMax()); diff --git a/apps/controllib/fixedwing.hpp b/apps/controllib/fixedwing.hpp index 281cbb4cb6..4323beeb30 100644 --- a/apps/controllib/fixedwing.hpp +++ b/apps/controllib/fixedwing.hpp @@ -310,9 +310,9 @@ private: BlockLimit _theLimit; BlockLimit _vLimit; - // altitude/ roc hold + // altitude/ climb rate hold BlockPID _h2Thr; - BlockPID _roc2Thr; + BlockPID _cr2Thr; // guidance BlockWaypointGuidance _guide; @@ -323,7 +323,7 @@ private: BlockParam _trimRdr; BlockParam _trimThr; BlockParam _vCmd; - BlockParam _rocMax; + BlockParam _crMax; struct pollfd _attPoll; vehicle_global_position_setpoint_s _lastPosCmd; diff --git a/apps/examples/control_demo/params.c b/apps/examples/control_demo/params.c index 428b779b17..71eacf25c8 100644 --- a/apps/examples/control_demo/params.c +++ b/apps/examples/control_demo/params.c @@ -59,13 +59,13 @@ PARAM_DEFINE_FLOAT(FWB_V_MAX, 16.0f); // maximum commanded velocity // rate of climb // this is what rate of climb is commanded (in m/s) // when the pitch stick is fully defelcted in simple mode -PARAM_DEFINE_FLOAT(FWB_ROC_MAX, 1.0f); +PARAM_DEFINE_FLOAT(FWB_CR_MAX, 1.0f); -// rate of climb -> thr -PARAM_DEFINE_FLOAT(FWB_ROC2THR_P, 0.01f); // rate of climb to throttle PID -PARAM_DEFINE_FLOAT(FWB_ROC2THR_I, 0.0f); -PARAM_DEFINE_FLOAT(FWB_ROC2THR_D, 0.0f); -PARAM_DEFINE_FLOAT(FWB_ROC2THR_D_LP, 0.0f); -PARAM_DEFINE_FLOAT(FWB_ROC2THR_I_MAX, 0.0f); +// climb rate -> thr +PARAM_DEFINE_FLOAT(FWB_CR2THR_P, 0.01f); // rate of climb to throttle PID +PARAM_DEFINE_FLOAT(FWB_CR2THR_I, 0.0f); +PARAM_DEFINE_FLOAT(FWB_CR2THR_D, 0.0f); +PARAM_DEFINE_FLOAT(FWB_CR2THR_D_LP, 0.0f); +PARAM_DEFINE_FLOAT(FWB_CR2THR_I_MAX, 0.0f); PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.8f); // trim throttle (0,1) diff --git a/apps/mavlink/mavlink_receiver.c b/apps/mavlink/mavlink_receiver.c index 22c2fcdade..2ebfc5a10d 100644 --- a/apps/mavlink/mavlink_receiver.c +++ b/apps/mavlink/mavlink_receiver.c @@ -308,82 +308,6 @@ handle_message(mavlink_message_t *msg) uint64_t timestamp = hrt_absolute_time(); - /* TODO, set ground_press/ temp during calib */ - static const float ground_press = 1013.25f; // mbar - static const float ground_tempC = 21.0f; - static const float ground_alt = 0.0f; - static const float T0 = 273.15; - static const float R = 287.05f; - static const float g = 9.806f; - - if (msg->msgid == MAVLINK_MSG_ID_RAW_IMU) { - - mavlink_raw_imu_t imu; - mavlink_msg_raw_imu_decode(msg, &imu); - - /* packet counter */ - static uint16_t hil_counter = 0; - static uint16_t hil_frames = 0; - static uint64_t old_timestamp = 0; - - /* sensors general */ - hil_sensors.timestamp = imu.time_usec; - - /* hil gyro */ - static const float mrad2rad = 1.0e-3f; - hil_sensors.gyro_counter = hil_counter; - hil_sensors.gyro_raw[0] = imu.xgyro; - hil_sensors.gyro_raw[1] = imu.ygyro; - hil_sensors.gyro_raw[2] = imu.zgyro; - hil_sensors.gyro_rad_s[0] = imu.xgyro * mrad2rad; - hil_sensors.gyro_rad_s[1] = imu.ygyro * mrad2rad; - hil_sensors.gyro_rad_s[2] = imu.zgyro * mrad2rad; - - /* accelerometer */ - hil_sensors.accelerometer_counter = hil_counter; - static const float mg2ms2 = 9.8f / 1000.0f; - hil_sensors.accelerometer_raw[0] = imu.xacc; - hil_sensors.accelerometer_raw[1] = imu.yacc; - hil_sensors.accelerometer_raw[2] = imu.zacc; - hil_sensors.accelerometer_m_s2[0] = mg2ms2 * imu.xacc; - hil_sensors.accelerometer_m_s2[1] = mg2ms2 * imu.yacc; - hil_sensors.accelerometer_m_s2[2] = mg2ms2 * imu.zacc; - hil_sensors.accelerometer_mode = 0; // TODO what is this? - hil_sensors.accelerometer_range_m_s2 = 32.7f; // int16 - - /* adc */ - hil_sensors.adc_voltage_v[0] = 0; - hil_sensors.adc_voltage_v[1] = 0; - hil_sensors.adc_voltage_v[2] = 0; - - /* magnetometer */ - float mga2ga = 1.0e-3f; - hil_sensors.magnetometer_counter = hil_counter; - hil_sensors.magnetometer_raw[0] = imu.xmag; - hil_sensors.magnetometer_raw[1] = imu.ymag; - hil_sensors.magnetometer_raw[2] = imu.zmag; - hil_sensors.magnetometer_ga[0] = imu.xmag * mga2ga; - hil_sensors.magnetometer_ga[1] = imu.ymag * mga2ga; - hil_sensors.magnetometer_ga[2] = imu.zmag * mga2ga; - hil_sensors.magnetometer_range_ga = 32.7f; // int16 - hil_sensors.magnetometer_mode = 0; // TODO what is this - hil_sensors.magnetometer_cuttoff_freq_hz = 50.0f; - - /* publish */ - orb_publish(ORB_ID(sensor_combined), pub_hil_sensors, &hil_sensors); - - // increment counters - hil_counter += 1 ; - hil_frames += 1 ; - - // output - if ((timestamp - old_timestamp) > 10000000) { - printf("receiving hil imu at %d hz\n", hil_frames/10); - old_timestamp = timestamp; - hil_frames = 0; - } - } - if (msg->msgid == MAVLINK_MSG_ID_HIGHRES_IMU) { mavlink_highres_imu_t imu; @@ -437,13 +361,9 @@ handle_message(mavlink_message_t *msg) hil_sensors.magnetometer_mode = 0; // TODO what is this hil_sensors.magnetometer_cuttoff_freq_hz = 50.0f; + /* baro */ hil_sensors.baro_pres_mbar = imu.abs_pressure; - - float tempC = imu.temperature; - float tempAvgK = T0 + (tempC + ground_tempC) / 2.0f; - float h = ground_alt + (R / g) * tempAvgK * logf(ground_press / imu.abs_pressure); - - hil_sensors.baro_alt_meter = h; + hil_sensors.baro_alt_meter = imu.pressure_alt; hil_sensors.baro_temp_celcius = imu.temperature; hil_sensors.gyro_counter = hil_counter; @@ -516,44 +436,6 @@ handle_message(mavlink_message_t *msg) } } - if (msg->msgid == MAVLINK_MSG_ID_RAW_PRESSURE) { - - mavlink_raw_pressure_t press; - mavlink_msg_raw_pressure_decode(msg, &press); - - /* packet counter */ - static uint16_t hil_counter = 0; - static uint16_t hil_frames = 0; - static uint64_t old_timestamp = 0; - - /* sensors general */ - hil_sensors.timestamp = press.time_usec; - - /* baro */ - - float tempC = press.temperature / 100.0f; - float tempAvgK = T0 + (tempC + ground_tempC) / 2.0f; - float h = ground_alt + (R / g) * tempAvgK * logf(ground_press / press.press_abs); - hil_sensors.baro_counter = hil_counter; - hil_sensors.baro_pres_mbar = press.press_abs; - hil_sensors.baro_alt_meter = h; - hil_sensors.baro_temp_celcius = tempC; - - /* publish */ - orb_publish(ORB_ID(sensor_combined), pub_hil_sensors, &hil_sensors); - - // increment counters - hil_counter += 1 ; - hil_frames += 1 ; - - // output - if ((timestamp - old_timestamp) > 10000000) { - printf("receiving hil pressure at %d hz\n", hil_frames/10); - old_timestamp = timestamp; - hil_frames = 0; - } - } - if (msg->msgid == MAVLINK_MSG_ID_HIL_STATE) { mavlink_hil_state_t hil_state; From 06e390b5e98b5e83646a8cd5f75b6b546000fc85 Mon Sep 17 00:00:00 2001 From: James Goppert Date: Tue, 30 Apr 2013 16:55:12 -0400 Subject: [PATCH 107/129] Added MD25 I2C motor controller driver. --- apps/drivers/device/i2c.h | 9 + apps/drivers/md25/MD25.cpp | 553 +++++++++++++++++++++++++++++ apps/drivers/md25/MD25.hpp | 293 +++++++++++++++ apps/drivers/md25/Makefile | 43 +++ apps/drivers/md25/md25_main.cpp | 264 ++++++++++++++ nuttx/configs/px4fmu/nsh/appconfig | 1 + nuttx/configs/px4fmu/nsh/defconfig | 4 + 7 files changed, 1167 insertions(+) create mode 100644 apps/drivers/md25/MD25.cpp create mode 100644 apps/drivers/md25/MD25.hpp create mode 100644 apps/drivers/md25/Makefile create mode 100644 apps/drivers/md25/md25_main.cpp diff --git a/apps/drivers/device/i2c.h b/apps/drivers/device/i2c.h index 66c34dd7c4..cc1f4e4d91 100644 --- a/apps/drivers/device/i2c.h +++ b/apps/drivers/device/i2c.h @@ -53,6 +53,15 @@ namespace device __EXPORT class __EXPORT I2C : public CDev { +public: + + /** + * Get the address + */ + uint16_t get_address() { + return _address; + } + protected: /** * The number of times a read or write operation will be retried on diff --git a/apps/drivers/md25/MD25.cpp b/apps/drivers/md25/MD25.cpp new file mode 100644 index 0000000000..92778b109d --- /dev/null +++ b/apps/drivers/md25/MD25.cpp @@ -0,0 +1,553 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file md25.cpp + * + * Driver for MD25 I2C Motor Driver + * + * references: + * http://www.robot-electronics.co.uk/htm/md25tech.htm + * http://www.robot-electronics.co.uk/files/rpi_md25.c + * + */ + +#include "MD25.hpp" +#include +#include + +#include +#include + +// registers +enum { + // RW: read/write + // R: read + REG_SPEED1_RW = 0, + REG_SPEED2_RW, + REG_ENC1A_R, + REG_ENC1B_R, + REG_ENC1C_R, + REG_ENC1D_R, + REG_ENC2A_R, + REG_ENC2B_R, + REG_ENC2C_R, + REG_ENC2D_R, + REG_BATTERY_VOLTS_R, + REG_MOTOR1_CURRENT_R, + REG_MOTOR2_CURRENT_R, + REG_SW_VERSION_R, + REG_ACCEL_RATE_RW, + REG_MODE_RW, + REG_COMMAND_RW, +}; + +MD25::MD25(const char *deviceName, int bus, + uint16_t address, uint32_t speed) : + I2C("MD25", deviceName, bus, address, speed), + _controlPoll(), + _actuators(NULL, ORB_ID(actuator_controls_0), 20), + _version(0), + _motor1Speed(0), + _motor2Speed(0), + _revolutions1(0), + _revolutions2(0), + _batteryVoltage(0), + _motor1Current(0), + _motor2Current(0), + _motorAccel(0), + _mode(MODE_UNSIGNED_SPEED), + _command(CMD_RESET_ENCODERS) +{ + // setup control polling + _controlPoll.fd = _actuators.getHandle(); + _controlPoll.events = POLLIN; + + // if initialization fails raise an error, unless + // probing + int ret = I2C::init(); + + if (ret != OK) { + warnc(ret, "I2C::init failed for bus: %d address: %d\n", bus, address); + } + + // setup default settings, reset encoders + setMotor1Speed(0); + setMotor2Speed(0); + resetEncoders(); + _setMode(MD25::MODE_UNSIGNED_SPEED); + setSpeedRegulation(true); + setTimeout(true); +} + +MD25::~MD25() +{ +} + +int MD25::readData() +{ + uint8_t sendBuf[1]; + sendBuf[0] = REG_SPEED1_RW; + uint8_t recvBuf[17]; + int ret = transfer(sendBuf, sizeof(sendBuf), + recvBuf, sizeof(recvBuf)); + + if (ret == OK) { + _version = recvBuf[REG_SW_VERSION_R]; + _motor1Speed = _uint8ToNorm(recvBuf[REG_SPEED1_RW]); + _motor2Speed = _uint8ToNorm(recvBuf[REG_SPEED2_RW]); + _revolutions1 = -int32_t((recvBuf[REG_ENC1A_R] << 24) + + (recvBuf[REG_ENC1B_R] << 16) + + (recvBuf[REG_ENC1C_R] << 8) + + recvBuf[REG_ENC1D_R]) / 360.0; + _revolutions2 = -int32_t((recvBuf[REG_ENC2A_R] << 24) + + (recvBuf[REG_ENC2B_R] << 16) + + (recvBuf[REG_ENC2C_R] << 8) + + recvBuf[REG_ENC2D_R]) / 360.0; + _batteryVoltage = recvBuf[REG_BATTERY_VOLTS_R] / 10.0; + _motor1Current = recvBuf[REG_MOTOR1_CURRENT_R] / 10.0; + _motor2Current = recvBuf[REG_MOTOR2_CURRENT_R] / 10.0; + _motorAccel = recvBuf[REG_ACCEL_RATE_RW]; + _mode = e_mode(recvBuf[REG_MODE_RW]); + _command = e_cmd(recvBuf[REG_COMMAND_RW]); + } + + return ret; +} + +void MD25::status(char *string, size_t n) +{ + snprintf(string, n, + "version:\t%10d\n" \ + "motor 1 speed:\t%10.2f\n" \ + "motor 2 speed:\t%10.2f\n" \ + "revolutions 1:\t%10.2f\n" \ + "revolutions 2:\t%10.2f\n" \ + "battery volts :\t%10.2f\n" \ + "motor 1 current :\t%10.2f\n" \ + "motor 2 current :\t%10.2f\n" \ + "motor accel :\t%10d\n" \ + "mode :\t%10d\n" \ + "command :\t%10d\n", + getVersion(), + double(getMotor1Speed()), + double(getMotor2Speed()), + double(getRevolutions1()), + double(getRevolutions2()), + double(getBatteryVolts()), + double(getMotor1Current()), + double(getMotor2Current()), + getMotorAccel(), + getMode(), + getCommand()); +} + +uint8_t MD25::getVersion() +{ + return _version; +} + +float MD25::getMotor1Speed() +{ + return _motor1Speed; +} + +float MD25::getMotor2Speed() +{ + return _motor2Speed; +} + +float MD25::getRevolutions1() +{ + return _revolutions1; +} + +float MD25::getRevolutions2() +{ + return _revolutions2; +} + +float MD25::getBatteryVolts() +{ + return _batteryVoltage; +} + +float MD25::getMotor1Current() +{ + return _motor1Current; +} +float MD25::getMotor2Current() +{ + return _motor2Current; +} + +uint8_t MD25::getMotorAccel() +{ + return _motorAccel; +} + +MD25::e_mode MD25::getMode() +{ + return _mode; +} + +MD25::e_cmd MD25::getCommand() +{ + return _command; +} + +int MD25::resetEncoders() +{ + return _writeUint8(REG_COMMAND_RW, + CMD_RESET_ENCODERS); +} + +int MD25::_setMode(e_mode mode) +{ + return _writeUint8(REG_MODE_RW, + mode); +} + +int MD25::setSpeedRegulation(bool enable) +{ + if (enable) { + return _writeUint8(REG_COMMAND_RW, + CMD_ENABLE_SPEED_REGULATION); + + } else { + return _writeUint8(REG_COMMAND_RW, + CMD_DISABLE_SPEED_REGULATION); + } +} + +int MD25::setTimeout(bool enable) +{ + if (enable) { + return _writeUint8(REG_COMMAND_RW, + CMD_ENABLE_TIMEOUT); + + } else { + return _writeUint8(REG_COMMAND_RW, + CMD_DISABLE_TIMEOUT); + } +} + +int MD25::setDeviceAddress(uint8_t address) +{ + uint8_t sendBuf[1]; + sendBuf[0] = CMD_CHANGE_I2C_SEQ_0; + int ret = OK; + ret = transfer(sendBuf, sizeof(sendBuf), + nullptr, 0); + + if (ret != OK) { + warnc(ret, "MD25::setDeviceAddress"); + return ret; + } + + usleep(5000); + sendBuf[0] = CMD_CHANGE_I2C_SEQ_1; + ret = transfer(sendBuf, sizeof(sendBuf), + nullptr, 0); + + if (ret != OK) { + warnc(ret, "MD25::setDeviceAddress"); + return ret; + } + + usleep(5000); + sendBuf[0] = CMD_CHANGE_I2C_SEQ_2; + ret = transfer(sendBuf, sizeof(sendBuf), + nullptr, 0); + + if (ret != OK) { + warnc(ret, "MD25::setDeviceAddress"); + return ret; + } + + return OK; +} + +int MD25::setMotor1Speed(float value) +{ + return _writeUint8(REG_SPEED1_RW, + _normToUint8(value)); +} + +int MD25::setMotor2Speed(float value) +{ + return _writeUint8(REG_SPEED2_RW, + _normToUint8(value)); +} + +void MD25::update() +{ + // wait for an actuator publication, + // check for exit condition every second + // note "::poll" is required to distinguish global + // poll from member function for driver + if (::poll(&_controlPoll, 1, 1000) < 0) return; // poll error + + // if new data, send to motors + if (_actuators.updated()) { + _actuators.update(); + setMotor1Speed(_actuators.control[CH_SPEED_LEFT]); + setMotor2Speed(_actuators.control[CH_SPEED_RIGHT]); + } +} + +int MD25::probe() +{ + uint8_t goodAddress = 0; + bool found = false; + int ret = OK; + + // try initial address first, if good, then done + if (readData() == OK) return ret; + + // try all other addresses + uint8_t testAddress = 0; + + //printf("searching for MD25 address\n"); + while (true) { + set_address(testAddress); + ret = readData(); + + if (ret == OK && !found) { + //printf("device found at address: 0x%X\n", testAddress); + if (!found) { + found = true; + goodAddress = testAddress; + } + } + + if (testAddress > 254) { + break; + } + + testAddress++; + } + + if (found) { + set_address(goodAddress); + return OK; + + } else { + set_address(0); + return ret; + } +} + +int MD25::search() +{ + uint8_t goodAddress = 0; + bool found = false; + int ret = OK; + // try all other addresses + uint8_t testAddress = 0; + + //printf("searching for MD25 address\n"); + while (true) { + set_address(testAddress); + ret = readData(); + + if (ret == OK && !found) { + printf("device found at address: 0x%X\n", testAddress); + + if (!found) { + found = true; + goodAddress = testAddress; + } + } + + if (testAddress > 254) { + break; + } + + testAddress++; + } + + if (found) { + set_address(goodAddress); + return OK; + + } else { + set_address(0); + return ret; + } +} + +int MD25::_writeUint8(uint8_t reg, uint8_t value) +{ + uint8_t sendBuf[2]; + sendBuf[0] = reg; + sendBuf[1] = value; + return transfer(sendBuf, sizeof(sendBuf), + nullptr, 0); +} + +int MD25::_writeInt8(uint8_t reg, int8_t value) +{ + uint8_t sendBuf[2]; + sendBuf[0] = reg; + sendBuf[1] = value; + return transfer(sendBuf, sizeof(sendBuf), + nullptr, 0); +} + +float MD25::_uint8ToNorm(uint8_t value) +{ + // TODO, should go from 0 to 255 + // possibly should handle this differently + return (value - 128) / 127.0; +} + +uint8_t MD25::_normToUint8(float value) +{ + if (value > 1) value = 1; + + if (value < -1) value = -1; + + // TODO, should go from 0 to 255 + // possibly should handle this differently + return 127 * value + 128; +} + +int md25Test(const char *deviceName, uint8_t bus, uint8_t address) +{ + printf("md25 test: starting\n"); + + // setup + MD25 md25("/dev/md25", bus, address); + + // print status + char buf[200]; + md25.status(buf, sizeof(buf)); + printf("%s\n", buf); + + // setup for test + md25.setSpeedRegulation(true); + md25.setTimeout(true); + float dt = 0.1; + float speed = 0.2; + float t = 0; + + // motor 1 test + printf("md25 test: spinning motor 1 forward for 1 rev at 0.1 speed\n"); + t = 0; + + while (true) { + t += dt; + md25.setMotor1Speed(speed); + md25.readData(); + usleep(1000000 * dt); + + if (md25.getRevolutions1() > 1) { + printf("finished 1 revolution fwd\n"); + break; + } + + if (t > 2.0f) break; + } + + md25.setMotor1Speed(0); + printf("revolution of wheel 1: %8.4f\n", double(md25.getRevolutions1())); + md25.resetEncoders(); + + t = 0; + + while (true) { + t += dt; + md25.setMotor1Speed(-speed); + md25.readData(); + usleep(1000000 * dt); + + if (md25.getRevolutions1() < -1) { + printf("finished 1 revolution rev\n"); + break; + } + + if (t > 2.0f) break; + } + + md25.setMotor1Speed(0); + printf("revolution of wheel 1: %8.4f\n", double(md25.getRevolutions1())); + md25.resetEncoders(); + + // motor 2 test + printf("md25 test: spinning motor 2 forward for 1 rev at 0.1 speed\n"); + t = 0; + + while (true) { + t += dt; + md25.setMotor2Speed(speed); + md25.readData(); + usleep(1000000 * dt); + + if (md25.getRevolutions2() > 1) { + printf("finished 1 revolution fwd\n"); + break; + } + + if (t > 2.0f) break; + } + + md25.setMotor2Speed(0); + printf("revolution of wheel 2: %8.4f\n", double(md25.getRevolutions2())); + md25.resetEncoders(); + + t = 0; + + while (true) { + t += dt; + md25.setMotor2Speed(-speed); + md25.readData(); + usleep(1000000 * dt); + + if (md25.getRevolutions2() < -1) { + printf("finished 1 revolution rev\n"); + break; + } + + if (t > 2.0f) break; + } + + md25.setMotor2Speed(0); + printf("revolution of wheel 2: %8.4f\n", double(md25.getRevolutions2())); + md25.resetEncoders(); + + printf("Test complete\n"); + return 0; +} + +// vi:noet:smarttab:autoindent:ts=4:sw=4:tw=78 diff --git a/apps/drivers/md25/MD25.hpp b/apps/drivers/md25/MD25.hpp new file mode 100644 index 0000000000..e77511b163 --- /dev/null +++ b/apps/drivers/md25/MD25.hpp @@ -0,0 +1,293 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * @file md25.cpp + * + * Driver for MD25 I2C Motor Driver + * + * references: + * http://www.robot-electronics.co.uk/htm/md25tech.htm + * http://www.robot-electronics.co.uk/files/rpi_md25.c + * + */ + +#pragma once + +#include +#include +#include +#include +#include + +/** + * This is a driver for the MD25 motor controller utilizing the I2C interface. + */ +class MD25 : public device::I2C +{ +public: + + /** + * modes + * + * NOTE: this driver assumes we are always + * in mode 0! + * + * seprate speed mode: + * motor speed1 = speed1 + * motor speed2 = speed2 + * turn speed mode: + * motor speed1 = speed1 + speed2 + * motor speed2 = speed2 - speed2 + * unsigned: + * full rev (0), stop(128), full fwd (255) + * signed: + * full rev (-127), stop(0), full fwd (128) + * + * modes numbers: + * 0 : unsigned separate (default) + * 1 : signed separate + * 2 : unsigned turn + * 3 : signed turn + */ + enum e_mode { + MODE_UNSIGNED_SPEED = 0, + MODE_SIGNED_SPEED, + MODE_UNSIGNED_SPEED_TURN, + MODE_SIGNED_SPEED_TURN, + }; + + /** commands */ + enum e_cmd { + CMD_RESET_ENCODERS = 32, + CMD_DISABLE_SPEED_REGULATION = 48, + CMD_ENABLE_SPEED_REGULATION = 49, + CMD_DISABLE_TIMEOUT = 50, + CMD_ENABLE_TIMEOUT = 51, + CMD_CHANGE_I2C_SEQ_0 = 160, + CMD_CHANGE_I2C_SEQ_1 = 170, + CMD_CHANGE_I2C_SEQ_2 = 165, + }; + + /** control channels */ + enum e_channels { + CH_SPEED_LEFT = 0, + CH_SPEED_RIGHT + }; + + /** + * constructor + * @param deviceName the name of the device e.g. "/dev/md25" + * @param bus the I2C bus + * @param address the adddress on the I2C bus + * @param speed the speed of the I2C communication + */ + MD25(const char *deviceName, + int bus, + uint16_t address, + uint32_t speed = 100000); + + /** + * deconstructor + */ + virtual ~MD25(); + + /** + * @return software version + */ + uint8_t getVersion(); + + /** + * @return speed of motor, normalized (-1, 1) + */ + float getMotor1Speed(); + + /** + * @return speed of motor 2, normalized (-1, 1) + */ + float getMotor2Speed(); + + /** + * @return number of rotations since reset + */ + float getRevolutions1(); + + /** + * @return number of rotations since reset + */ + float getRevolutions2(); + + /** + * @return battery voltage, volts + */ + float getBatteryVolts(); + + /** + * @return motor 1 current, amps + */ + float getMotor1Current(); + + /** + * @return motor 2 current, amps + */ + float getMotor2Current(); + + /** + * @return the motor acceleration + * controls motor speed change (1-10) + * accel rate | time for full fwd. to full rev. + * 1 | 6.375 s + * 2 | 1.6 s + * 3 | 0.675 s + * 5(default) | 1.275 s + * 10 | 0.65 s + */ + uint8_t getMotorAccel(); + + /** + * @return motor output mode + * */ + e_mode getMode(); + + /** + * @return current command register value + */ + e_cmd getCommand(); + + /** + * resets the encoders + * @return non-zero -> error + * */ + int resetEncoders(); + + /** + * enable/disable speed regulation + * @return non-zero -> error + */ + int setSpeedRegulation(bool enable); + + /** + * set the timeout for the motors + * enable/disable timeout (motor stop) + * after 2 sec of no i2c messages + * @return non-zero -> error + */ + int setTimeout(bool enable); + + /** + * sets the device address + * can only be done with one MD25 + * on the bus + * @return non-zero -> error + */ + int setDeviceAddress(uint8_t address); + + /** + * set motor 1 speed + * @param normSpeed normalize speed between -1 and 1 + * @return non-zero -> error + */ + int setMotor1Speed(float normSpeed); + + /** + * set motor 2 speed + * @param normSpeed normalize speed between -1 and 1 + * @return non-zero -> error + */ + int setMotor2Speed(float normSpeed); + + /** + * main update loop that updates MD25 motor + * speeds based on actuator publication + */ + void update(); + + /** + * probe for device + */ + virtual int probe(); + + /** + * search for device + */ + int search(); + + /** + * read data from i2c + */ + int readData(); + + /** + * print status + */ + void status(char *string, size_t n); + +private: + /** poll structure for control packets */ + struct pollfd _controlPoll; + + /** actuator controls subscription */ + control::UOrbSubscription _actuators; + + // local copy of data from i2c device + uint8_t _version; + float _motor1Speed; + float _motor2Speed; + float _revolutions1; + float _revolutions2; + float _batteryVoltage; + float _motor1Current; + float _motor2Current; + uint8_t _motorAccel; + e_mode _mode; + e_cmd _command; + + // private methods + int _writeUint8(uint8_t reg, uint8_t value); + int _writeInt8(uint8_t reg, int8_t value); + float _uint8ToNorm(uint8_t value); + uint8_t _normToUint8(float value); + + /** + * set motor control mode, + * this driver assumed we are always in mode 0 + * so we don't let the user change the mode + * @return non-zero -> error + */ + int _setMode(e_mode); +}; + +// unit testing +int md25Test(const char *deviceName, uint8_t bus, uint8_t address); + +// vi:noet:smarttab:autoindent:ts=4:sw=4:tw=78 diff --git a/apps/drivers/md25/Makefile b/apps/drivers/md25/Makefile new file mode 100644 index 0000000000..cce2fd0953 --- /dev/null +++ b/apps/drivers/md25/Makefile @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (C) 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# MD25 I2C Based Motor Controller +# http://www.robot-electronics.co.uk/htm/md25tech.htm +# + +APPNAME = md25 +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/md25/md25_main.cpp b/apps/drivers/md25/md25_main.cpp new file mode 100644 index 0000000000..85aaab7f6d --- /dev/null +++ b/apps/drivers/md25/md25_main.cpp @@ -0,0 +1,264 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + + + +/** + * @ file md25.cpp + * + * Driver for MD25 I2C Motor Driver + * + * references: + * http://www.robot-electronics.co.uk/htm/md25tech.htm + * http://www.robot-electronics.co.uk/files/rpi_md25.c + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include "MD25.hpp" + +static bool thread_should_exit = false; /**< Deamon exit flag */ +static bool thread_running = false; /**< Deamon status flag */ +static int deamon_task; /**< Handle of deamon task / thread */ + +/** + * Deamon management function. + */ +extern "C" __EXPORT int md25_main(int argc, char *argv[]); + +/** + * Mainloop of deamon. + */ +int md25_thread_main(int argc, char *argv[]); + +/** + * Print the correct usage. + */ +static void usage(const char *reason); + +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + + fprintf(stderr, "usage: md25 {start|stop|status|search|test|change_address}\n\n"); + exit(1); +} + +/** + * The deamon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int md25_main(int argc, char *argv[]) +{ + + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "start")) { + + if (thread_running) { + printf("md25 already running\n"); + /* this is not an error */ + exit(0); + } + + thread_should_exit = false; + deamon_task = task_spawn("md25", + SCHED_DEFAULT, + SCHED_PRIORITY_MAX - 10, + 2048, + md25_thread_main, + (const char **)argv); + exit(0); + } + + if (!strcmp(argv[1], "test")) { + + if (argc < 4) { + printf("usage: md25 test bus address\n"); + exit(0); + } + + const char *deviceName = "/dev/md25"; + + uint8_t bus = strtoul(argv[2], nullptr, 0); + + uint8_t address = strtoul(argv[3], nullptr, 0); + + md25Test(deviceName, bus, address); + + exit(0); + } + + if (!strcmp(argv[1], "probe")) { + if (argc < 4) { + printf("usage: md25 probe bus address\n"); + exit(0); + } + + const char *deviceName = "/dev/md25"; + + uint8_t bus = strtoul(argv[2], nullptr, 0); + + uint8_t address = strtoul(argv[3], nullptr, 0); + + MD25 md25(deviceName, bus, address); + + int ret = md25.probe(); + + if (ret == OK) { + printf("MD25 found on bus %d at address 0x%X\n", bus, md25.get_address()); + + } else { + printf("MD25 not found on bus %d\n", bus); + } + + exit(0); + } + + if (!strcmp(argv[1], "search")) { + if (argc < 3) { + printf("usage: md25 search bus\n"); + exit(0); + } + + const char *deviceName = "/dev/md25"; + + uint8_t bus = strtoul(argv[2], nullptr, 0); + + uint8_t address = strtoul(argv[3], nullptr, 0); + + MD25 md25(deviceName, bus, address); + + md25.search(); + + exit(0); + } + + if (!strcmp(argv[1], "change_address")) { + if (argc < 5) { + printf("usage: md25 change_address bus old_address new_address\n"); + exit(0); + } + + const char *deviceName = "/dev/md25"; + + uint8_t bus = strtoul(argv[2], nullptr, 0); + + uint8_t old_address = strtoul(argv[3], nullptr, 0); + + uint8_t new_address = strtoul(argv[4], nullptr, 0); + + MD25 md25(deviceName, bus, old_address); + + int ret = md25.setDeviceAddress(new_address); + + if (ret == OK) { + printf("MD25 new address set to 0x%X\n", new_address); + + } else { + printf("MD25 failed to set address to 0x%X\n", new_address); + } + + exit(0); + } + + if (!strcmp(argv[1], "stop")) { + thread_should_exit = true; + exit(0); + } + + if (!strcmp(argv[1], "status")) { + if (thread_running) { + printf("\tmd25 app is running\n"); + + } else { + printf("\tmd25 app not started\n"); + } + + exit(0); + } + + usage("unrecognized command"); + exit(1); +} + +int md25_thread_main(int argc, char *argv[]) +{ + printf("[MD25] starting\n"); + + if (argc < 5) { + // extra md25 in arg list since this is a thread + printf("usage: md25 start bus address\n"); + exit(0); + } + + const char *deviceName = "/dev/md25"; + + uint8_t bus = strtoul(argv[3], nullptr, 0); + + uint8_t address = strtoul(argv[4], nullptr, 0); + + // start + MD25 md25("/dev/md25", bus, address); + + thread_running = true; + + // loop + while (!thread_should_exit) { + md25.update(); + } + + // exit + printf("[MD25] exiting.\n"); + thread_running = false; + return 0; +} + +// vi:noet:smarttab:autoindent:ts=4:sw=4:tw=78 diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 82ab94be78..300ed3f31a 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -128,6 +128,7 @@ CONFIGURED_APPS += drivers/mkblctrl CONFIGURED_APPS += drivers/hil CONFIGURED_APPS += drivers/gps CONFIGURED_APPS += drivers/mb12xx +CONFIGURED_APPS += drivers/md25 # Testing stuff CONFIGURED_APPS += px4/sensors_bringup diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 130886aac2..b89a08708d 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -647,10 +647,14 @@ CONFIG_DISABLE_POLL=n # CONFIG_LIBC_FIXEDPRECISION - Sets 7 digits after dot for printing: # 5.1234567 # CONFIG_HAVE_LONG_LONG - Enabled printf("%llu) +# CONFIG_LIBC_STRERR - allow printing of error text +# CONFIG_LIBC_STRERR_SHORT - allow printing of short error text # CONFIG_NOPRINTF_FIELDWIDTH=n CONFIG_LIBC_FLOATINGPOINT=y CONFIG_HAVE_LONG_LONG=y +CONFIG_LIBC_STRERROR=n +CONFIG_LIBC_STRERROR_SHORT=n # # Allow for architecture optimized implementations From 1caffca3584fe323c83206379cc337e19768d854 Mon Sep 17 00:00:00 2001 From: px4dev Date: Wed, 8 May 2013 22:50:18 -0700 Subject: [PATCH 108/129] whitespace --- makefiles/firmware.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index fff0e1c65c..b63aa28d73 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -193,7 +193,7 @@ EXTRA_CLEANS = # for GMSL). # where to look for modules -MODULE_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) +MODULE_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) # sort and unique the modules list MODULES := $(sort $(MODULES)) From 296a19072d26dfb814f7ca164e508b9203d51ac1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 15:39:54 +0200 Subject: [PATCH 109/129] Enabled leds on FMU again --- makefiles/config_px4fmu_default.mk | 1 + src/drivers/boards/px4fmu/module.mk | 3 ++- src/drivers/boards/px4fmu/px4fmu_init.c | 27 +++++++++++++++++------- src/drivers/boards/px4fmu/px4fmu_led.c | 28 ++++++++++++++++--------- src/drivers/led/led.cpp | 21 ++++++++++++------- 5 files changed, 54 insertions(+), 26 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 07f9bdbc32..7f12ca7315 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -14,6 +14,7 @@ MODULES += drivers/device MODULES += drivers/stm32 MODULES += drivers/stm32/adc MODULES += drivers/stm32/tone_alarm +MODULES += drivers/led MODULES += drivers/px4io MODULES += drivers/px4fmu MODULES += drivers/boards/px4fmu diff --git a/src/drivers/boards/px4fmu/module.mk b/src/drivers/boards/px4fmu/module.mk index 2cb261d305..66b7769173 100644 --- a/src/drivers/boards/px4fmu/module.mk +++ b/src/drivers/boards/px4fmu/module.mk @@ -6,4 +6,5 @@ SRCS = px4fmu_can.c \ px4fmu_init.c \ px4fmu_pwm_servo.c \ px4fmu_spi.c \ - px4fmu_usb.c + px4fmu_usb.c \ + px4fmu_led.c diff --git a/src/drivers/boards/px4fmu/px4fmu_init.c b/src/drivers/boards/px4fmu/px4fmu_init.c index 5dd70c3f95..69edc23ab2 100644 --- a/src/drivers/boards/px4fmu/px4fmu_init.c +++ b/src/drivers/boards/px4fmu/px4fmu_init.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -91,6 +91,19 @@ # endif #endif +/* + * Ideally we'd be able to get these from up_internal.h, + * but since we want to be able to disable the NuttX use + * of leds for system indication at will and there is no + * separate switch, we need to build independent of the + * CONFIG_ARCH_LEDS configuration switch. + */ +__BEGIN_DECLS +extern void led_init(); +extern void led_on(int led); +extern void led_off(int led); +__END_DECLS + /**************************************************************************** * Protected Functions ****************************************************************************/ @@ -114,7 +127,7 @@ __EXPORT void stm32_boardinitialize(void) /* configure SPI interfaces */ stm32_spiinitialize(); - /* configure LEDs */ + /* configure LEDs (empty call to NuttX' ledinit) */ up_ledinit(); } @@ -178,11 +191,11 @@ __EXPORT int nsh_archinitialize(void) (hrt_callout)stm32_serial_dma_poll, NULL); - // initial LED state -// drv_led_start(); - up_ledoff(LED_BLUE); - up_ledoff(LED_AMBER); - up_ledon(LED_BLUE); + /* initial LED state */ + drv_led_start(); + led_off(LED_AMBER); + led_on(LED_BLUE); + /* Configure SPI-based devices */ diff --git a/src/drivers/boards/px4fmu/px4fmu_led.c b/src/drivers/boards/px4fmu/px4fmu_led.c index fd1e159aa7..34fd194c33 100644 --- a/src/drivers/boards/px4fmu/px4fmu_led.c +++ b/src/drivers/boards/px4fmu/px4fmu_led.c @@ -39,19 +39,27 @@ #include -#include #include -#include -#include - -#include "chip.h" -#include "up_arch.h" -#include "up_internal.h" #include "stm32_internal.h" #include "px4fmu_internal.h" -__EXPORT void up_ledinit() +#include + +/* + * Ideally we'd be able to get these from up_internal.h, + * but since we want to be able to disable the NuttX use + * of leds for system indication at will and there is no + * separate switch, we need to build independent of the + * CONFIG_ARCH_LEDS configuration switch. + */ +__BEGIN_DECLS +extern void led_init(); +extern void led_on(int led); +extern void led_off(int led); +__END_DECLS + +__EXPORT void led_init() { /* Configure LED1-2 GPIOs for output */ @@ -59,7 +67,7 @@ __EXPORT void up_ledinit() stm32_configgpio(GPIO_LED2); } -__EXPORT void up_ledon(int led) +__EXPORT void led_on(int led) { if (led == 0) { @@ -73,7 +81,7 @@ __EXPORT void up_ledon(int led) } } -__EXPORT void up_ledoff(int led) +__EXPORT void led_off(int led) { if (led == 0) { diff --git a/src/drivers/led/led.cpp b/src/drivers/led/led.cpp index c7c45525e1..04b565358c 100644 --- a/src/drivers/led/led.cpp +++ b/src/drivers/led/led.cpp @@ -41,12 +41,17 @@ #include #include -/* Ideally we'd be able to get these from up_internal.h */ -//#include +/* + * Ideally we'd be able to get these from up_internal.h, + * but since we want to be able to disable the NuttX use + * of leds for system indication at will and there is no + * separate switch, we need to build independent of the + * CONFIG_ARCH_LEDS configuration switch. + */ __BEGIN_DECLS -extern void up_ledinit(); -extern void up_ledon(int led); -extern void up_ledoff(int led); +extern void led_init(); +extern void led_on(int led); +extern void led_off(int led); __END_DECLS class LED : device::CDev @@ -74,7 +79,7 @@ int LED::init() { CDev::init(); - up_ledinit(); + led_init(); return 0; } @@ -86,11 +91,11 @@ LED::ioctl(struct file *filp, int cmd, unsigned long arg) switch (cmd) { case LED_ON: - up_ledon(arg); + led_on(arg); break; case LED_OFF: - up_ledoff(arg); + led_off(arg); break; default: From 3ec536a876a66f4e56549957e81ed4547c92a0c3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 17:13:38 +0200 Subject: [PATCH 110/129] Improved GPS update rate calculation --- src/drivers/gps/gps.cpp | 4 ++-- src/drivers/gps/gps_helper.cpp | 11 +++++++++-- src/drivers/gps/gps_helper.h | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index 7db2578160..38835418b0 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -288,7 +288,6 @@ GPS::task_main() // GPS is obviously detected successfully, reset statistics _Helper->reset_update_rates(); - warnx("module configuration successful"); while (_Helper->receive(TIMEOUT_5HZ) > 0 && !_task_should_exit) { // lock(); @@ -306,6 +305,8 @@ GPS::task_main() _rate = last_rate_count / ((float)((hrt_absolute_time() - last_rate_measurement)) / 1000000.0f); last_rate_measurement = hrt_absolute_time(); last_rate_count = 0; + _Helper->store_update_rates(); + _Helper->reset_update_rates(); } if (!_healthy) { @@ -381,7 +382,6 @@ GPS::print_info() warnx("rate velocity: \t%6.2f Hz", (double)_Helper->get_velocity_update_rate()); warnx("rate publication:\t%6.2f Hz", (double)_rate); - _Helper->reset_update_rates(); } usleep(100000); diff --git a/src/drivers/gps/gps_helper.cpp b/src/drivers/gps/gps_helper.cpp index 54ac90dabd..ba86d370a8 100644 --- a/src/drivers/gps/gps_helper.cpp +++ b/src/drivers/gps/gps_helper.cpp @@ -46,13 +46,13 @@ float GPS_Helper::get_position_update_rate() { - return _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); + return _rate_lat_lon; } float GPS_Helper::get_velocity_update_rate() { - return _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); + return _rate_vel; } float @@ -63,6 +63,13 @@ GPS_Helper::reset_update_rates() _interval_rate_start = hrt_absolute_time(); } +float +GPS_Helper::store_update_rates() +{ + _rate_vel = _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); + _rate_lat_lon = _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f); +} + int GPS_Helper::set_baudrate(const int &fd, unsigned baud) { diff --git a/src/drivers/gps/gps_helper.h b/src/drivers/gps/gps_helper.h index 7e456a6aae..defc1a074a 100644 --- a/src/drivers/gps/gps_helper.h +++ b/src/drivers/gps/gps_helper.h @@ -52,11 +52,15 @@ public: float get_position_update_rate(); float get_velocity_update_rate(); float reset_update_rates(); + float store_update_rates(); protected: uint8_t _rate_count_lat_lon; uint8_t _rate_count_vel; + float _rate_lat_lon; + float _rate_vel; + uint64_t _interval_rate_start; }; From fa1b7388f3485d8c7af42607b154f529d43153ea Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 17:34:00 +0200 Subject: [PATCH 111/129] Implemented new led status proposal --- src/modules/commander/commander.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/modules/commander/commander.c b/src/modules/commander/commander.c index 01ab9e3d9c..cd2ef8137e 100644 --- a/src/modules/commander/commander.c +++ b/src/modules/commander/commander.c @@ -1503,22 +1503,40 @@ int commander_thread_main(int argc, char *argv[]) if ((current_status.state_machine == SYSTEM_STATE_GROUND_READY || current_status.state_machine == SYSTEM_STATE_AUTO || current_status.state_machine == SYSTEM_STATE_MANUAL)) { - /* armed */ - led_toggle(LED_BLUE); + /* armed, solid */ + led_on(LED_AMBER); } else if (counter % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0) { /* not armed */ - led_toggle(LED_BLUE); + led_toggle(LED_AMBER); } - /* toggle error led at 5 Hz in HIL mode */ + if (hrt_absolute_time() - gps_position.timestamp_position < 2000000) { + + /* toggle GPS (blue) led at 1 Hz if GPS present but no lock, make is solid once locked */ + if ((hrt_absolute_time() - gps_position.timestamp_position < 2000000) + && (gps_position.fix_type == GPS_FIX_TYPE_3D)) { + /* GPS lock */ + led_on(LED_BLUE); + + } else if (counter % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0) { + /* no GPS lock, but GPS module is aquiring lock */ + led_toggle(LED_BLUE); + } + + } else { + /* no GPS info, don't light the blue led */ + led_off(LED_BLUE); + } + + /* toggle GPS led at 5 Hz in HIL mode */ if (current_status.flag_hil_enabled) { /* hil enabled */ - led_toggle(LED_AMBER); + led_toggle(LED_BLUE); } else if (bat_remain < 0.3f && (low_voltage_counter > LOW_VOLTAGE_BATTERY_COUNTER_LIMIT)) { /* toggle error (red) at 5 Hz on low battery or error */ - led_toggle(LED_AMBER); + led_toggle(LED_BLUE); } else { // /* Constant error indication in standby mode without GPS */ From 26efba2ff365b1463ca9f6aaaf936557a92c4eb1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 17:38:12 +0200 Subject: [PATCH 112/129] New blink patterns for safety switch, removed GPS lock indicator --- src/drivers/px4io/px4io.cpp | 11 ++--------- src/modules/px4iofirmware/protocol.h | 1 - src/modules/px4iofirmware/safety.c | 9 +++------ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index b4703839bf..e69fbebf74 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -502,8 +502,7 @@ PX4IO::init() io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, PX4IO_P_SETUP_ARMING_ARM_OK | PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK | - PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK | - PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK, 0); + PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK, 0); /* publish RC config to IO */ ret = io_set_rc_config(); @@ -707,11 +706,6 @@ PX4IO::io_set_arming_state() } else { clear |= PX4IO_P_SETUP_ARMING_ARM_OK; } - if (vstatus.flag_vector_flight_mode_ok) { - set |= PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK; - } else { - clear |= PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK; - } if (vstatus.flag_external_manual_override_ok) { set |= PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK; } else { @@ -1309,11 +1303,10 @@ PX4IO::print_status() /* setup and state */ printf("features 0x%04x\n", io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FEATURES)); uint16_t arming = io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING); - printf("arming 0x%04x%s%s%s%s\n", + printf("arming 0x%04x%s%s%s\n", arming, ((arming & PX4IO_P_SETUP_ARMING_ARM_OK) ? " ARM_OK" : ""), ((arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) ? " MANUAL_OVERRIDE_OK" : ""), - ((arming & PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK) ? " VECTOR_FLIGHT_OK" : ""), ((arming & PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK) ? " INAIR_RESTART_OK" : "")); printf("rates 0x%04x default %u alt %u relays 0x%04x\n", io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_RATES), diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index b80551a077..d015fb629a 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -147,7 +147,6 @@ #define PX4IO_P_SETUP_ARMING 1 /* arming controls */ #define PX4IO_P_SETUP_ARMING_ARM_OK (1 << 0) /* OK to arm */ #define PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK (1 << 2) /* OK to switch to manual override via override RC channel */ -#define PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK (1 << 3) /* OK to perform position / vector control (= position lock) */ #define PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK (1 << 4) /* OK to try in-air restart */ #define PX4IO_P_SETUP_PWM_RATES 2 /* bitmask, 0 = low rate, 1 = high rate */ diff --git a/src/modules/px4iofirmware/safety.c b/src/modules/px4iofirmware/safety.c index 5495d5ae12..a2880d2efb 100644 --- a/src/modules/px4iofirmware/safety.c +++ b/src/modules/px4iofirmware/safety.c @@ -56,11 +56,10 @@ static unsigned counter = 0; /* * Define the various LED flash sequences for each system state. */ -#define LED_PATTERN_SAFE 0xffff /**< always on */ -#define LED_PATTERN_VECTOR_FLIGHT_MODE_OK 0xFFFE /**< always on with short break */ -#define LED_PATTERN_FMU_ARMED 0x4444 /**< slow blinking */ +#define LED_PATTERN_SAFE 0x000f /**< always on */ +#define LED_PATTERN_FMU_ARMED 0x5555 /**< slow blinking */ #define LED_PATTERN_IO_ARMED 0x5555 /**< fast blinking */ -#define LED_PATTERN_IO_FMU_ARMED 0x5050 /**< long off then double blink */ +#define LED_PATTERN_IO_FMU_ARMED 0xffff /**< long off then double blink */ static unsigned blink_counter = 0; @@ -151,8 +150,6 @@ safety_check_button(void *arg) } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) { pattern = LED_PATTERN_FMU_ARMED; - } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK) { - pattern = LED_PATTERN_VECTOR_FLIGHT_MODE_OK; } /* Turn the LED on if we have a 1 at the current bit position */ From d6cb588c3c078d3858d8c7bcb78ca72373aa73d8 Mon Sep 17 00:00:00 2001 From: px4dev Date: Thu, 9 May 2013 10:02:56 -0700 Subject: [PATCH 113/129] fix capitalisation of include file name Marko Pagott --- src/drivers/md25/md25_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/md25/md25_main.cpp b/src/drivers/md25/md25_main.cpp index 85aaab7f6d..740dd0b287 100644 --- a/src/drivers/md25/md25_main.cpp +++ b/src/drivers/md25/md25_main.cpp @@ -55,7 +55,7 @@ #include #include -#include "MD25.hpp" +#include "md25.hpp" static bool thread_should_exit = false; /**< Deamon exit flag */ static bool thread_running = false; /**< Deamon status flag */ From b7a9e0778359b9da7eb27e1292557e7a0f9a7278 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 19:03:24 +0200 Subject: [PATCH 114/129] Hotfix: Wrong capitalization on header file name --- src/drivers/md25/md25_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/md25/md25_main.cpp b/src/drivers/md25/md25_main.cpp index 85aaab7f6d..80850e7088 100644 --- a/src/drivers/md25/md25_main.cpp +++ b/src/drivers/md25/md25_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,7 +55,7 @@ #include #include -#include "MD25.hpp" +#include "md25.hpp" static bool thread_should_exit = false; /**< Deamon exit flag */ static bool thread_running = false; /**< Deamon status flag */ From 304ce63f00e72cf8a8162abad295a52a5773265d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 May 2013 19:03:24 +0200 Subject: [PATCH 115/129] Hotfix: Wrong capitalization on header file name --- src/drivers/md25/md25_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/md25/md25_main.cpp b/src/drivers/md25/md25_main.cpp index 85aaab7f6d..80850e7088 100644 --- a/src/drivers/md25/md25_main.cpp +++ b/src/drivers/md25/md25_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,7 +55,7 @@ #include #include -#include "MD25.hpp" +#include "md25.hpp" static bool thread_should_exit = false; /**< Deamon exit flag */ static bool thread_running = false; /**< Deamon status flag */ From 196ee8b16fcd42fca04d1fb7e11ec46dd45c8421 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 11 May 2013 11:32:05 -0700 Subject: [PATCH 116/129] Change the way modules are built so that object paths are relative and use vpath for locating sources (so source paths are also shorter). Add some basic documentation for the build system files while we're at it. --- makefiles/README.txt | 71 +++++++++++++++++++++++++++++ makefiles/firmware.mk | 7 ++- makefiles/module.mk | 51 +++++++++++++-------- src/modules/mathlib/CMSIS/module.mk | 5 +- 4 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 makefiles/README.txt diff --git a/makefiles/README.txt b/makefiles/README.txt new file mode 100644 index 0000000000..8b84e4c40d --- /dev/null +++ b/makefiles/README.txt @@ -0,0 +1,71 @@ +PX4 Build System +================ + +The files in this directory implement the PX4 runtime firmware build system +and configuration for the standard PX4 boards and software, in conjunction +with Makefile in the parent directory. + +../Makefile + + Top-level makefile for the PX4 build system. This makefile supports + building NuttX archives, as well as supervising the building of all + of the defined PX4 firmware configurations. + + Try 'make help' in the parent directory for documentation. + +firmware.mk + + Manages the build for one specific firmware configuration. + See the comments at the top of this file for detailed documentation. + + Builds modules, builtin command lists and the ROMFS (if configured). + + This is the makefile directly used by external build systems; it can + be configured to compile modules both inside and outside the PX4 + source tree. When used in this mode, at least BOARD, MODULES and + CONFIG_FILE must be set. + +module.mk + + Called by firmware.mk to build individual modules. + See the comments at the top of this file for detailed documentation. + + Not normally used other than by firmware.mk. + +nuttx.mk + + Called by ../Makefile to build or download the NuttX archives. + +upload.mk + + Called by ../Makefile to upload files to a target board. Can be used + by external build systems as well. + +setup.mk + + Provides common path and tool definitions. Implements host system-specific + compatibility hacks. + +board_.mk + + Board-specific configuration for . Typically sets CONFIG_ARCH + and then includes the toolchain definition for the board. + +config__.mk + + Parameters for a specific configuration on a specific board. + The board name is derived from the filename. Sets MODULES to select + source modules to be included in the configuration, may also set + ROMFS_ROOT to build a ROMFS and BUILTIN_COMMANDS to include non-module + commands (e.g. from NuttX) + +toolchain_.mk + + Provides macros used to compile and link source files. + Accepts EXTRADEFINES to add additional pre-processor symbol definitions, + EXTRACFLAGS, EXTRACXXFLAGS, EXTRAAFLAGS and EXTRALDFLAGS to pass + additional flags to the C compiler, C++ compiler, assembler and linker + respectively. + + Defines the COMPILE, COMPILEXX, ASSEMBLE, PRELINK, ARCHIVE and LINK + macros that are used elsewhere in the build system. diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index b63aa28d73..e6a45a4e8a 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -223,12 +223,15 @@ MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module .PHONY: $(MODULE_OBJS) $(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) $(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) +$(MODULE_OBJS): workdir = $(@D) $(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) + $(Q) $(MKDIR) -p $(workdir) $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ - MODULE_WORK_DIR=$(dir $@) \ + -C $(workdir) \ + MODULE_WORK_DIR=$(workdir) \ MODULE_OBJ=$@ \ MODULE_MK=$(mkfile) \ - MODULE_NAME=$(lastword $(subst /, ,$(@D))) \ + MODULE_NAME=$(lastword $(subst /, ,$(workdir))) \ module # make a list of phony clean targets for modules diff --git a/makefiles/module.mk b/makefiles/module.mk index 0fe6f0ffec..db6f4e15ec 100644 --- a/makefiles/module.mk +++ b/makefiles/module.mk @@ -39,6 +39,10 @@ # symbols, as the global namespace is shared between all modules. Normally an # module will just export one or more _main functions. # +# IMPORTANT NOTE: +# +# This makefile assumes it is being invoked in the module's output directory. +# # # Variables that can be set by the module's module.mk: @@ -179,26 +183,30 @@ CXXFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibi # module: $(MODULE_OBJ) $(MODULE_COMMAND_FILES) +## +## Locate sources (allows relative source paths in module.mk) +## +#define SRC_SEARCH +# $(abspath $(firstword $(wildcard $1) $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) +#endef # -# Locate sources (allows relative source paths in module.mk) +#ABS_SRCS ?= $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) +#MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) +#ifneq ($(MISSING_SRCS),) +#$(error $(MODULE_MK): missing in SRCS: $(MISSING_SRCS)) +#endif +#ifeq ($(ABS_SRCS),) +#$(error $(MODULE_MK): nothing to compile in SRCS) +#endif # -define SRC_SEARCH - $(abspath $(firstword $(wildcard $1) $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) -endef +## +## Object files we will generate from sources +## +#OBJS := $(foreach src,$(ABS_SRCS),$(MODULE_WORK_DIR)$(src).o) -ABS_SRCS ?= $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) -MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) -ifneq ($(MISSING_SRCS),) -$(error $(MODULE_MK): missing in SRCS: $(MISSING_SRCS)) -endif -ifeq ($(ABS_SRCS),) -$(error $(MODULE_MK): nothing to compile in SRCS) -endif - -# -# Object files we will generate from sources -# -OBJS := $(foreach src,$(ABS_SRCS),$(MODULE_WORK_DIR)$(src).o) +OBJS = $(addsuffix .o,$(SRCS)) +$(info SRCS $(SRCS)) +$(info OBJS $(OBJS)) # # SRCS -> OBJS rules @@ -206,13 +214,16 @@ OBJS := $(foreach src,$(ABS_SRCS),$(MODULE_WORK_DIR)$(src).o) $(OBJS): $(GLOBAL_DEPS) -$(filter %.c.o,$(OBJS)): $(MODULE_WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) +vpath %.c $(MODULE_SRC) +$(filter %.c.o,$(OBJS)): %.c.o: %.c $(GLOBAL_DEPS) $(call COMPILE,$<,$@) -$(filter %.cpp.o,$(OBJS)): $(MODULE_WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) +vpath %.cpp $(MODULE_SRC) +$(filter %.cpp.o,$(OBJS)): %.cpp.o: %.cpp $(GLOBAL_DEPS) $(call COMPILEXX,$<,$@) -$(filter %.S.o,$(OBJS)): $(MODULE_WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) +vpath %.S $(MODULE_SRC) +$(filter %.S.o,$(OBJS)): %.S.o: %.S $(GLOBAL_DEPS) $(call ASSEMBLE,$<,$@) # diff --git a/src/modules/mathlib/CMSIS/module.mk b/src/modules/mathlib/CMSIS/module.mk index c676f32618..ba45b159ea 100644 --- a/src/modules/mathlib/CMSIS/module.mk +++ b/src/modules/mathlib/CMSIS/module.mk @@ -38,8 +38,9 @@ # # Find sources # -DSPLIB_SRCDIR := $(PX4_MODULE_SRC)/modules/mathlib/CMSIS -ABS_SRCS := $(wildcard $(DSPLIB_SRCDIR)/DSP_Lib/Source/*/*.c) +DSPLIB_SRCDIR := $(dir $(lastword $(MAKEFILE_LIST))) +SRCLIST := $(wildcard $(DSPLIB_SRCDIR)DSP_Lib/Source/*/*.c) +SRCS := $(patsubst $(DSPLIB_SRCDIR)%,%,$(SRCLIST)) zork.c INCLUDE_DIRS += $(DSPLIB_SRCDIR)/Include \ $(DSPLIB_SRCDIR)/Device/ARM/ARMCM4/Include \ From 555d42e0cd2724225391bede58629d3bcea175db Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 11 May 2013 16:46:52 -0700 Subject: [PATCH 117/129] Oops, left in some test code. --- src/modules/mathlib/CMSIS/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mathlib/CMSIS/module.mk b/src/modules/mathlib/CMSIS/module.mk index ba45b159ea..5e1abe642f 100644 --- a/src/modules/mathlib/CMSIS/module.mk +++ b/src/modules/mathlib/CMSIS/module.mk @@ -40,7 +40,7 @@ # DSPLIB_SRCDIR := $(dir $(lastword $(MAKEFILE_LIST))) SRCLIST := $(wildcard $(DSPLIB_SRCDIR)DSP_Lib/Source/*/*.c) -SRCS := $(patsubst $(DSPLIB_SRCDIR)%,%,$(SRCLIST)) zork.c +SRCS := $(patsubst $(DSPLIB_SRCDIR)%,%,$(SRCLIST)) INCLUDE_DIRS += $(DSPLIB_SRCDIR)/Include \ $(DSPLIB_SRCDIR)/Device/ARM/ARMCM4/Include \ From 0c43da3b6424dbc877c464b6898f18fe650c703f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 May 2013 13:11:12 +0200 Subject: [PATCH 118/129] Tested with PX4FMU and PX4IO with GPS and arming --- src/modules/commander/commander.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/commander.c b/src/modules/commander/commander.c index cd2ef8137e..aab8f3e04d 100644 --- a/src/modules/commander/commander.c +++ b/src/modules/commander/commander.c @@ -1519,7 +1519,7 @@ int commander_thread_main(int argc, char *argv[]) /* GPS lock */ led_on(LED_BLUE); - } else if (counter % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0) { + } else if ((counter + 4) % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0) { /* no GPS lock, but GPS module is aquiring lock */ led_toggle(LED_BLUE); } @@ -1535,8 +1535,8 @@ int commander_thread_main(int argc, char *argv[]) led_toggle(LED_BLUE); } else if (bat_remain < 0.3f && (low_voltage_counter > LOW_VOLTAGE_BATTERY_COUNTER_LIMIT)) { - /* toggle error (red) at 5 Hz on low battery or error */ - led_toggle(LED_BLUE); + /* toggle arming (red) at 5 Hz on low battery or error */ + led_toggle(LED_AMBER); } else { // /* Constant error indication in standby mode without GPS */ From 0ee738e9c91c49739798ac5ff8dd4a12c06bb82f Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 12 May 2013 10:51:25 -0700 Subject: [PATCH 119/129] Fix ROMFS dependency scan, add a warning if ROMFS_ROOT appears to be empty. --- makefiles/firmware.mk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index e6a45a4e8a..6fa0ae3eb0 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -269,13 +269,17 @@ endif # # Add dependencies on anything in the ROMFS root -ROMFS_DEPS += $(wildcard \ - (ROMFS_ROOT)/* \ - (ROMFS_ROOT)/*/* \ - (ROMFS_ROOT)/*/*/* \ - (ROMFS_ROOT)/*/*/*/* \ - (ROMFS_ROOT)/*/*/*/*/* \ - (ROMFS_ROOT)/*/*/*/*/*/*) +ROMFS_FILES += $(wildcard \ + $(ROMFS_ROOT)/* \ + $(ROMFS_ROOT)/*/* \ + $(ROMFS_ROOT)/*/*/* \ + $(ROMFS_ROOT)/*/*/*/* \ + $(ROMFS_ROOT)/*/*/*/*/* \ + $(ROMFS_ROOT)/*/*/*/*/*/*) +ifeq ($(ROMFS_FILES),) +$(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files) +endif +ROMFS_DEPS += $(ROMFS_FILES) ROMFS_IMG = $(WORK_DIR)romfs.img ROMFS_CSRC = $(ROMFS_IMG:.img=.c) ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) From 79f9b61aff0570d1ab98dc5a4c7e6a71eec5009b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 May 2013 20:05:20 +0200 Subject: [PATCH 120/129] Fixed led patterns to be up to the latest specs --- src/drivers/px4io/px4io.cpp | 32 ++++++++++++-------- src/modules/commander/state_machine_helper.c | 5 +++ src/modules/px4iofirmware/protocol.h | 3 +- src/modules/px4iofirmware/safety.c | 26 ++++++++-------- src/modules/uORB/topics/actuator_controls.h | 1 + 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index e69fbebf74..3006cf885b 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -416,7 +416,7 @@ PX4IO::init() * already armed, and has been configured for in-air restart */ if ((reg & PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK) && - (reg & PX4IO_P_SETUP_ARMING_ARM_OK)) { + (reg & PX4IO_P_SETUP_ARMING_FMU_ARMED)) { mavlink_log_emergency(_mavlink_fd, "[IO] RECOVERING FROM FMU IN-AIR RESTART"); @@ -500,7 +500,7 @@ PX4IO::init() /* dis-arm IO before touching anything */ io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, - PX4IO_P_SETUP_ARMING_ARM_OK | + PX4IO_P_SETUP_ARMING_FMU_ARMED | PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK | PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK, 0); @@ -701,11 +701,18 @@ PX4IO::io_set_arming_state() uint16_t set = 0; uint16_t clear = 0; - if (armed.armed) { - set |= PX4IO_P_SETUP_ARMING_ARM_OK; + if (armed.armed && !armed.lockdown) { + set |= PX4IO_P_SETUP_ARMING_FMU_ARMED; } else { - clear |= PX4IO_P_SETUP_ARMING_ARM_OK; + clear |= PX4IO_P_SETUP_ARMING_FMU_ARMED; } + + if (armed.ready_to_arm) { + set |= PX4IO_P_SETUP_ARMING_IO_ARM_OK; + } else { + clear |= PX4IO_P_SETUP_ARMING_IO_ARM_OK; + } + if (vstatus.flag_external_manual_override_ok) { set |= PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK; } else { @@ -1271,9 +1278,9 @@ PX4IO::print_status() io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_IBATT), io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_VBATT_SCALE)); printf("amp_per_volt %.3f amp_offset %.3f mAhDischarged %.3f\n", - _battery_amp_per_volt, - _battery_amp_bias, - _battery_mamphour_total); + (double)_battery_amp_per_volt, + (double)_battery_amp_bias, + (double)_battery_mamphour_total); printf("actuators"); for (unsigned i = 0; i < _max_actuators; i++) printf(" %u", io_reg_get(PX4IO_PAGE_ACTUATORS, i)); @@ -1303,9 +1310,10 @@ PX4IO::print_status() /* setup and state */ printf("features 0x%04x\n", io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FEATURES)); uint16_t arming = io_reg_get(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING); - printf("arming 0x%04x%s%s%s\n", + printf("arming 0x%04x%s%s%s%s\n", arming, - ((arming & PX4IO_P_SETUP_ARMING_ARM_OK) ? " ARM_OK" : ""), + ((arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) ? " FMU_ARMED" : ""), + ((arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK) ? " IO_ARM_OK" : ""), ((arming & PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK) ? " MANUAL_OVERRIDE_OK" : ""), ((arming & PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK) ? " INAIR_RESTART_OK" : "")); printf("rates 0x%04x default %u alt %u relays 0x%04x\n", @@ -1347,12 +1355,12 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg) switch (cmd) { case PWM_SERVO_ARM: /* set the 'armed' bit */ - ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, 0, PX4IO_P_SETUP_ARMING_ARM_OK); + ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, 0, PX4IO_P_SETUP_ARMING_FMU_ARMED); break; case PWM_SERVO_DISARM: /* clear the 'armed' bit */ - ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, PX4IO_P_SETUP_ARMING_ARM_OK, 0); + ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, PX4IO_P_SETUP_ARMING_FMU_ARMED, 0); break; case PWM_SERVO_SET_UPDATE_RATE: diff --git a/src/modules/commander/state_machine_helper.c b/src/modules/commander/state_machine_helper.c index bea388a101..ab728c7bbb 100644 --- a/src/modules/commander/state_machine_helper.c +++ b/src/modules/commander/state_machine_helper.c @@ -249,6 +249,11 @@ void publish_armed_status(const struct vehicle_status_s *current_status) { struct actuator_armed_s armed; armed.armed = current_status->flag_system_armed; + + /* XXX allow arming by external components on multicopters only if not yet armed by RC */ + /* XXX allow arming only if core sensors are ok */ + armed.ready_to_arm = true; + /* lock down actuators if required, only in HIL */ armed.lockdown = (current_status->flag_hil_enabled) ? true : false; orb_advert_t armed_pub = orb_advertise(ORB_ID(actuator_armed), &armed); diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index d015fb629a..e575bd8412 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -145,7 +145,8 @@ #define PX4IO_P_SETUP_FEATURES 0 #define PX4IO_P_SETUP_ARMING 1 /* arming controls */ -#define PX4IO_P_SETUP_ARMING_ARM_OK (1 << 0) /* OK to arm */ +#define PX4IO_P_SETUP_ARMING_IO_ARM_OK (1 << 0) /* OK to arm the IO side */ +#define PX4IO_P_SETUP_ARMING_FMU_ARMED (1 << 1) /* FMU is already armed */ #define PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK (1 << 2) /* OK to switch to manual override via override RC channel */ #define PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK (1 << 4) /* OK to try in-air restart */ diff --git a/src/modules/px4iofirmware/safety.c b/src/modules/px4iofirmware/safety.c index a2880d2efb..f6cd5fb450 100644 --- a/src/modules/px4iofirmware/safety.c +++ b/src/modules/px4iofirmware/safety.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Safety button logic. + * @file safety.c + * Safety button logic. */ #include @@ -56,10 +57,10 @@ static unsigned counter = 0; /* * Define the various LED flash sequences for each system state. */ -#define LED_PATTERN_SAFE 0x000f /**< always on */ -#define LED_PATTERN_FMU_ARMED 0x5555 /**< slow blinking */ -#define LED_PATTERN_IO_ARMED 0x5555 /**< fast blinking */ -#define LED_PATTERN_IO_FMU_ARMED 0xffff /**< long off then double blink */ +#define LED_PATTERN_FMU_OK_TO_ARM 0x0003 /**< slow blinking */ +#define LED_PATTERN_FMU_REFUSE_TO_ARM 0x5555 /**< fast blinking */ +#define LED_PATTERN_IO_ARMED 0x5050 /**< long off, then double blink */ +#define LED_PATTERN_IO_FMU_ARMED 0xffff /**< constantly on */ static unsigned blink_counter = 0; @@ -108,7 +109,8 @@ safety_check_button(void *arg) * state machine, keep ARM_COUNTER_THRESHOLD the same * length in all cases of the if/else struct below. */ - if (safety_button_pressed && !(r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { + if (safety_button_pressed && !(r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED) && + (r_setup_arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK)) { if (counter < ARM_COUNTER_THRESHOLD) { counter++; @@ -119,8 +121,6 @@ safety_check_button(void *arg) counter++; } - /* Disarm quickly */ - } else if (safety_button_pressed && (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { if (counter < ARM_COUNTER_THRESHOLD) { @@ -137,18 +137,18 @@ safety_check_button(void *arg) } /* Select the appropriate LED flash pattern depending on the current IO/FMU arm state */ - uint16_t pattern = LED_PATTERN_SAFE; + uint16_t pattern = LED_PATTERN_FMU_REFUSE_TO_ARM; if (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED) { - if (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) { + if (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) { pattern = LED_PATTERN_IO_FMU_ARMED; } else { pattern = LED_PATTERN_IO_ARMED; } - } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) { - pattern = LED_PATTERN_FMU_ARMED; + } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK) { + pattern = LED_PATTERN_FMU_OK_TO_ARM; } diff --git a/src/modules/uORB/topics/actuator_controls.h b/src/modules/uORB/topics/actuator_controls.h index 0b50a29ac8..b7c4196c0a 100644 --- a/src/modules/uORB/topics/actuator_controls.h +++ b/src/modules/uORB/topics/actuator_controls.h @@ -69,6 +69,7 @@ ORB_DECLARE(actuator_controls_3); /** global 'actuator output is live' control. */ struct actuator_armed_s { bool armed; /**< Set to true if system is armed */ + bool ready_to_arm; /**< Set to true if system is ready to be armed */ bool lockdown; /**< Set to true if actuators are forced to being disabled (due to emergency or HIL) */ }; From 6ea204c8136a3e4c81e2e542e56a865c57f381e7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 May 2013 20:08:09 +0200 Subject: [PATCH 121/129] Added fixed wing controller example --- makefiles/config_px4fmu_default.mk | 4 + src/examples/fixedwing_control/main.c | 474 +++++++++++++++++++++++ src/examples/fixedwing_control/module.mk | 41 ++ src/examples/fixedwing_control/params.c | 77 ++++ src/examples/fixedwing_control/params.h | 65 ++++ 5 files changed, 661 insertions(+) create mode 100644 src/examples/fixedwing_control/main.c create mode 100644 src/examples/fixedwing_control/module.mk create mode 100644 src/examples/fixedwing_control/params.c create mode 100644 src/examples/fixedwing_control/params.h diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 00d402c4a9..27bf0f973b 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -105,6 +105,10 @@ MODULES += modules/uORB # https://pixhawk.ethz.ch/px4/dev/debug_values #MODULES += examples/px4_mavlink_debug +# Tutorial code from +# https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control +MODULES += examples/fixedwing_control + # # Transitional support - add commands from the NuttX export archive. # diff --git a/src/examples/fixedwing_control/main.c b/src/examples/fixedwing_control/main.c new file mode 100644 index 0000000000..1753070e2f --- /dev/null +++ b/src/examples/fixedwing_control/main.c @@ -0,0 +1,474 @@ +/**************************************************************************** + * + * Copyright (c) 2013 PX4 Development Team. All rights reserved. + * Author: Lorenz Meier + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ +/** + * @file main.c + * Implementation of a fixed wing attitude controller. This file is a complete + * fixed wing controller flying manual attitude control or auto waypoint control. + * There is no need to touch any other system components to extend / modify the + * complete control architecture. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* process-specific header files */ +#include "params.h" + +/* Prototypes */ +/** + * Daemon management function. + */ +__EXPORT int ex_fixedwing_control_main(int argc, char *argv[]); + +/** + * Mainloop of daemon. + */ +int fixedwing_control_thread_main(int argc, char *argv[]); + +/** + * Print the correct usage. + */ +static void usage(const char *reason); + +void control_attitude(const struct vehicle_attitude_setpoint_s *att_sp, const struct vehicle_attitude_s *att, + float speed_body[], float gyro[], struct vehicle_rates_setpoint_s *rates_sp, + struct actuator_controls_s *actuators); + +void control_heading(const struct vehicle_global_position_s *pos, const struct vehicle_global_position_setpoint_s *sp, + const struct vehicle_attitude_s *att, struct vehicle_attitude_setpoint_s *att_sp); + +/* Variables */ +static bool thread_should_exit = false; /**< Daemon exit flag */ +static bool thread_running = false; /**< Daemon status flag */ +static int deamon_task; /**< Handle of deamon task / thread */ +static struct params p; +static struct param_handles ph; + +void control_attitude(const struct vehicle_attitude_setpoint_s *att_sp, const struct vehicle_attitude_s *att, + float speed_body[], float gyro[], struct vehicle_rates_setpoint_s *rates_sp, + struct actuator_controls_s *actuators) +{ + + /* + * The PX4 architecture provides a mixer outside of the controller. + * The mixer is fed with a default vector of actuator controls, representing + * moments applied to the vehicle frame. This vector + * is structured as: + * + * Control Group 0 (attitude): + * + * 0 - roll (-1..+1) + * 1 - pitch (-1..+1) + * 2 - yaw (-1..+1) + * 3 - thrust ( 0..+1) + * 4 - flaps (-1..+1) + * ... + * + * Control Group 1 (payloads / special): + * + * ... + */ + + /* + * Calculate roll error and apply P gain + */ + float roll_err = att->roll - att_sp->roll_body; + actuators->control[0] = roll_err * p.roll_p; + + /* + * Calculate pitch error and apply P gain + */ + float pitch_err = att->pitch - att_sp->pitch_body; + actuators->control[1] = pitch_err * p.pitch_p; +} + +void control_heading(const struct vehicle_global_position_s *pos, const struct vehicle_global_position_setpoint_s *sp, + const struct vehicle_attitude_s *att, struct vehicle_attitude_setpoint_s *att_sp) +{ + + /* + * Calculate heading error of current position to desired position + */ + + /* PX4 uses 1e7 scaled integers to represent global coordinates for max resolution */ + float bearing = get_bearing_to_next_waypoint(pos->lat/1e7d, pos->lon/1e7d, sp->lat/1e7d, sp->lon/1e7d); + + /* calculate heading error */ + float yaw_err = att->yaw - bearing; + /* apply control gain */ + att_sp->roll_body = yaw_err * p.hdng_p; +} + +/* Main Thread */ +int fixedwing_control_thread_main(int argc, char *argv[]) +{ + /* read arguments */ + bool verbose = false; + + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) { + verbose = true; + } + } + + /* welcome user (warnx prints a line, including an appended\n, with variable arguments */ + warnx("[example fixedwing control] started"); + + /* initialize parameters, first the handles, then the values */ + parameters_init(&ph); + parameters_update(&ph, &p); + + /* declare and safely initialize all structs to zero */ + struct vehicle_attitude_s att; + memset(&att, 0, sizeof(att)); + struct vehicle_attitude_setpoint_s att_sp; + memset(&att_sp, 0, sizeof(att_sp)); + struct vehicle_rates_setpoint_s rates_sp; + memset(&rates_sp, 0, sizeof(rates_sp)); + struct vehicle_global_position_s global_pos; + memset(&global_pos, 0, sizeof(global_pos)); + struct manual_control_setpoint_s manual_sp; + memset(&manual_sp, 0, sizeof(manual_sp)); + struct vehicle_status_s vstatus; + memset(&vstatus, 0, sizeof(vstatus)); + struct vehicle_global_position_setpoint_s global_sp; + memset(&global_sp, 0, sizeof(global_sp)); + + /* output structs */ + struct actuator_controls_s actuators; + memset(&actuators, 0, sizeof(actuators)); + + + /* publish actuator controls */ + for (unsigned i = 0; i < NUM_ACTUATOR_CONTROLS; i++) { + actuators.control[i] = 0.0f; + } + + orb_advert_t actuator_pub = orb_advertise(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, &actuators); + orb_advert_t rates_pub = orb_advertise(ORB_ID(vehicle_rates_setpoint), &rates_sp); + + /* subscribe */ + int att_sub = orb_subscribe(ORB_ID(vehicle_attitude)); + int att_sp_sub = orb_subscribe(ORB_ID(vehicle_attitude_setpoint)); + int global_pos_sub = orb_subscribe(ORB_ID(vehicle_global_position)); + int manual_sp_sub = orb_subscribe(ORB_ID(manual_control_setpoint)); + int vstatus_sub = orb_subscribe(ORB_ID(vehicle_status)); + int global_sp_sub = orb_subscribe(ORB_ID(vehicle_global_position_setpoint)); + int param_sub = orb_subscribe(ORB_ID(parameter_update)); + + /* Setup of loop */ + float gyro[3] = {0.0f, 0.0f, 0.0f}; + float speed_body[3] = {0.0f, 0.0f, 0.0f}; + struct pollfd fds[2] = {{ .fd = param_sub, .events = POLLIN }, + { .fd = att_sub, .events = POLLIN }}; + + while (!thread_should_exit) { + + /* + * Wait for a sensor or param update, check for exit condition every 500 ms. + * This means that the execution will block here without consuming any resources, + * but will continue to execute the very moment a new attitude measurement or + * a param update is published. So no latency in contrast to the polling + * design pattern (do not confuse the poll() system call with polling). + * + * This design pattern makes the controller also agnostic of the attitude + * update speed - it runs as fast as the attitude updates with minimal latency. + */ + int ret = poll(fds, 2, 500); + + if (ret < 0) { + /* poll error, this will not really happen in practice */ + warnx("poll error"); + + } else if (ret == 0) { + /* no return value = nothing changed for 500 ms, ignore */ + } else { + + /* only update parameters if they changed */ + if (fds[0].revents & POLLIN) { + /* read from param to clear updated flag (uORB API requirement) */ + struct parameter_update_s update; + orb_copy(ORB_ID(parameter_update), param_sub, &update); + + /* if a param update occured, re-read our parameters */ + parameters_update(&ph, &p); + } + + /* only run controller if attitude changed */ + if (fds[1].revents & POLLIN) { + + + /* Check if there is a new position measurement or position setpoint */ + bool pos_updated; + orb_check(global_pos_sub, &pos_updated); + bool global_sp_updated; + orb_check(global_sp_sub, &global_sp_updated); + + /* get a local copy of attitude */ + orb_copy(ORB_ID(vehicle_attitude), att_sub, &att); + + if (global_sp_updated) + orb_copy(ORB_ID(vehicle_global_position_setpoint), global_sp_sub, &global_sp); + + if (pos_updated) { + orb_copy(ORB_ID(vehicle_global_position), global_pos_sub, &global_pos); + + if (att.R_valid) { + speed_body[0] = att.R[0][0] * global_pos.vx + att.R[0][1] * global_pos.vy + att.R[0][2] * global_pos.vz; + speed_body[1] = att.R[1][0] * global_pos.vx + att.R[1][1] * global_pos.vy + att.R[1][2] * global_pos.vz; + speed_body[2] = att.R[2][0] * global_pos.vx + att.R[2][1] * global_pos.vy + att.R[2][2] * global_pos.vz; + + } else { + speed_body[0] = 0; + speed_body[1] = 0; + speed_body[2] = 0; + + warnx("Did not get a valid R\n"); + } + } + + orb_copy(ORB_ID(manual_control_setpoint), manual_sp_sub, &manual_sp); + orb_copy(ORB_ID(vehicle_status), vstatus_sub, &vstatus); + + gyro[0] = att.rollspeed; + gyro[1] = att.pitchspeed; + gyro[2] = att.yawspeed; + + /* control */ + + if (vstatus.state_machine == SYSTEM_STATE_AUTO || + vstatus.state_machine == SYSTEM_STATE_STABILIZED) { + + /* simple heading control */ + control_heading(&global_pos, &global_sp, &att, &att_sp); + + /* nail pitch and yaw (rudder) to zero. This example only controls roll (index 0) */ + actuators.control[1] = 0.0f; + actuators.control[2] = 0.0f; + + /* simple attitude control */ + control_attitude(&att_sp, &att, speed_body, gyro, &rates_sp, &actuators); + + /* pass through throttle */ + actuators.control[3] = att_sp.thrust; + + /* set flaps to zero */ + actuators.control[4] = 0.0f; + + } else if (vstatus.state_machine == SYSTEM_STATE_MANUAL) { + if (vstatus.manual_control_mode == VEHICLE_MANUAL_CONTROL_MODE_SAS) { + + /* if the RC signal is lost, try to stay level and go slowly back down to ground */ + if (vstatus.rc_signal_lost) { + + /* put plane into loiter */ + att_sp.roll_body = 0.3f; + att_sp.pitch_body = 0.0f; + + /* limit throttle to 60 % of last value if sane */ + if (isfinite(manual_sp.throttle) && + (manual_sp.throttle >= 0.0f) && + (manual_sp.throttle <= 1.0f)) { + att_sp.thrust = 0.6f * manual_sp.throttle; + + } else { + att_sp.thrust = 0.0f; + } + + att_sp.yaw_body = 0; + + // XXX disable yaw control, loiter + + } else { + + att_sp.roll_body = manual_sp.roll; + att_sp.pitch_body = manual_sp.pitch; + att_sp.yaw_body = 0; + att_sp.thrust = manual_sp.throttle; + } + + att_sp.timestamp = hrt_absolute_time(); + + /* attitude control */ + control_attitude(&att_sp, &att, speed_body, gyro, &rates_sp, &actuators); + + /* pass through throttle */ + actuators.control[3] = att_sp.thrust; + + /* pass through flaps */ + if (isfinite(manual_sp.flaps)) { + actuators.control[4] = manual_sp.flaps; + + } else { + actuators.control[4] = 0.0f; + } + + } else if (vstatus.manual_control_mode == VEHICLE_MANUAL_CONTROL_MODE_DIRECT) { + /* directly pass through values */ + actuators.control[0] = manual_sp.roll; + /* positive pitch means negative actuator -> pull up */ + actuators.control[1] = manual_sp.pitch; + actuators.control[2] = manual_sp.yaw; + actuators.control[3] = manual_sp.throttle; + + if (isfinite(manual_sp.flaps)) { + actuators.control[4] = manual_sp.flaps; + + } else { + actuators.control[4] = 0.0f; + } + } + } + + /* publish rates */ + orb_publish(ORB_ID(vehicle_rates_setpoint), rates_pub, &rates_sp); + + /* sanity check and publish actuator outputs */ + if (isfinite(actuators.control[0]) && + isfinite(actuators.control[1]) && + isfinite(actuators.control[2]) && + isfinite(actuators.control[3])) { + orb_publish(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, actuator_pub, &actuators); + } + } + } + } + + printf("[ex_fixedwing_control] exiting, stopping all motors.\n"); + thread_running = false; + + /* kill all outputs */ + for (unsigned i = 0; i < NUM_ACTUATOR_CONTROLS; i++) + actuators.control[i] = 0.0f; + + orb_publish(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, actuator_pub, &actuators); + + fflush(stdout); + + return 0; +} + +/* Startup Functions */ + +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + + fprintf(stderr, "usage: ex_fixedwing_control {start|stop|status}\n\n"); + exit(1); +} + +/** + * The daemon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int ex_fixedwing_control_main(int argc, char *argv[]) +{ + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "start")) { + + if (thread_running) { + printf("ex_fixedwing_control already running\n"); + /* this is not an error */ + exit(0); + } + + thread_should_exit = false; + deamon_task = task_spawn("ex_fixedwing_control", + SCHED_DEFAULT, + SCHED_PRIORITY_MAX - 20, + 2048, + fixedwing_control_thread_main, + (argv) ? (const char **)&argv[2] : (const char **)NULL); + thread_running = true; + exit(0); + } + + if (!strcmp(argv[1], "stop")) { + thread_should_exit = true; + exit(0); + } + + if (!strcmp(argv[1], "status")) { + if (thread_running) { + printf("\tex_fixedwing_control is running\n"); + + } else { + printf("\tex_fixedwing_control not started\n"); + } + + exit(0); + } + + usage("unrecognized command"); + exit(1); +} + + + diff --git a/src/examples/fixedwing_control/module.mk b/src/examples/fixedwing_control/module.mk new file mode 100644 index 0000000000..d2c48934fc --- /dev/null +++ b/src/examples/fixedwing_control/module.mk @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# Fixedwing Attitude Control Demo / Example Application +# + +MODULE_COMMAND = ex_fixedwing_control + +SRCS = main.c \ + params.c diff --git a/src/examples/fixedwing_control/params.c b/src/examples/fixedwing_control/params.c new file mode 100644 index 0000000000..8042c74f5e --- /dev/null +++ b/src/examples/fixedwing_control/params.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * + * Copyright (c) 2013 PX4 Development Team. All rights reserved. + * Author: Lorenz Meier + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* + * @file params.c + * + * Parameters for fixedwing demo + */ + +#include "params.h" + +/* controller parameters, use max. 15 characters for param name! */ + +/** + * + */ +PARAM_DEFINE_FLOAT(EXFW_HDNG_P, 0.2f); + +/** + * + */ +PARAM_DEFINE_FLOAT(EXFW_ROLL_P, 0.2f); + +/** + * + */ +PARAM_DEFINE_FLOAT(EXFW_PITCH_P, 0.2f); + +int parameters_init(struct param_handles *h) +{ + /* PID parameters */ + h->hdng_p = param_find("EXFW_HDNG_P"); + h->roll_p = param_find("EXFW_ROLL_P"); + h->pitch_p = param_find("EXFW_PITCH_P"); + + return OK; +} + +int parameters_update(const struct param_handles *h, struct params *p) +{ + param_get(h->hdng_p, &(p->hdng_p)); + param_get(h->roll_p, &(p->roll_p)); + param_get(h->pitch_p, &(p->pitch_p)); + + return OK; +} diff --git a/src/examples/fixedwing_control/params.h b/src/examples/fixedwing_control/params.h new file mode 100644 index 0000000000..4ae8e90ec4 --- /dev/null +++ b/src/examples/fixedwing_control/params.h @@ -0,0 +1,65 @@ +/**************************************************************************** + * + * Copyright (c) 2013 PX4 Development Team. All rights reserved. + * Author: Lorenz Meier + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* + * @file params.h + * + * Definition of parameters for fixedwing example + */ + +#include + +struct params { + float hdng_p; + float roll_p; + float pitch_p; +}; + +struct param_handles { + param_t hdng_p; + param_t roll_p; + param_t pitch_p; +}; + +/** + * Initialize all parameter handles and values + * + */ +int parameters_init(struct param_handles *h); + +/** + * Update all parameters + * + */ +int parameters_update(const struct param_handles *h, struct params *p); From edb0e01dfd9c38b826ec038ff7b8387e8ce0bd21 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 12 May 2013 14:04:57 -0700 Subject: [PATCH 122/129] HOTFIX: simplify symbol names going into the ROMFS object, hopefully this avoids inconsistent symbol naming on Windows. --- Makefile | 9 +++++++-- makefiles/firmware.mk | 2 +- makefiles/toolchain_gnu-arm-eabi.mk | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 224910e0fc..1d1287b7f7 100644 --- a/Makefile +++ b/Makefile @@ -159,11 +159,11 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC) $(NUTTX_APPS) .PHONY: clean clean: $(Q) $(RMDIR) $(BUILD_DIR)*.build - $(Q) $(REMOVE) -f $(IMAGE_DIR)*.px4 + $(Q) $(REMOVE) $(IMAGE_DIR)*.px4 .PHONY: distclean distclean: clean - $(Q) $(REMOVE) -f $(ARCHIVE_DIR)*.export + $(Q) $(REMOVE) $(ARCHIVE_DIR)*.export $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean # @@ -196,6 +196,11 @@ help: @echo " distclean" @echo " Remove all compilation products, including NuttX RTOS archives." @echo "" + @echo " upload" + @echo " When exactly one config is being built, add this target to upload the" + @echo " firmware to the board when the build is complete. Not supported for" + @echo " all configurations." + @echo "" @echo " Common options:" @echo " ---------------" @echo "" diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 6fa0ae3eb0..7afa3e787d 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -280,7 +280,7 @@ ifeq ($(ROMFS_FILES),) $(error ROMFS_ROOT $(ROMFS_ROOT) specifies a directory containing no files) endif ROMFS_DEPS += $(ROMFS_FILES) -ROMFS_IMG = $(WORK_DIR)romfs.img +ROMFS_IMG = romfs.img ROMFS_CSRC = $(ROMFS_IMG:.img=.c) ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) LIBS += $(ROMFS_OBJ) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk index 0e651e53c8..874e7154c7 100644 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -254,6 +254,20 @@ endef # - relink the object and insert the binary file # - edit symbol names to suit # +# NOTE: exercise caution using this with absolute pathnames; it looks +# like the MinGW tools insert an extra _ in the binary symbol name; e.g. +# the path: +# +# /d/px4/firmware/Build/px4fmu_default.build/romfs.img +# +# is assigned symbols like: +# +# _binary_d__px4_firmware_Build_px4fmu_default_build_romfs_img_size +# +# when we would expect +# +# _binary__d_px4_firmware_Build_px4fmu_default_build_romfs_img_size +# define BIN_SYM_PREFIX _binary_$(subst /,_,$(subst .,_,$1)) endef @@ -267,4 +281,5 @@ define BIN_TO_OBJ --redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \ --redefine-sym $(call BIN_SYM_PREFIX,$1)_size=$3_len \ --strip-symbol $(call BIN_SYM_PREFIX,$1)_end + $(Q) $(REMOVE) $2.c $2.c.o endef From 1ff6c80866775b48bf38de5cdf5dea5f99691fc0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 08:28:36 +0200 Subject: [PATCH 123/129] More example fixes --- makefiles/config_px4fmu_default.mk | 2 +- src/examples/px4_daemon_app/module.mk | 2 +- src/examples/px4_mavlink_debug/module.mk | 2 +- src/examples/px4_simple_app/module.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk index 27bf0f973b..ae62b70347 100644 --- a/makefiles/config_px4fmu_default.mk +++ b/makefiles/config_px4fmu_default.mk @@ -107,7 +107,7 @@ MODULES += modules/uORB # Tutorial code from # https://pixhawk.ethz.ch/px4/dev/example_fixedwing_control -MODULES += examples/fixedwing_control +MODULES += examples/fixedwing_control # # Transitional support - add commands from the NuttX export archive. diff --git a/src/examples/px4_daemon_app/module.mk b/src/examples/px4_daemon_app/module.mk index d23c19b75d..5f8aa73d57 100644 --- a/src/examples/px4_daemon_app/module.mk +++ b/src/examples/px4_daemon_app/module.mk @@ -37,4 +37,4 @@ MODULE_COMMAND = px4_daemon_app -SRCS = px4_daemon_app.c +SRCS = px4_daemon_app.c diff --git a/src/examples/px4_mavlink_debug/module.mk b/src/examples/px4_mavlink_debug/module.mk index 3d400fdbfc..fefd614961 100644 --- a/src/examples/px4_mavlink_debug/module.mk +++ b/src/examples/px4_mavlink_debug/module.mk @@ -37,4 +37,4 @@ MODULE_COMMAND = px4_mavlink_debug -SRCS = px4_mavlink_debug.c \ No newline at end of file +SRCS = px4_mavlink_debug.c \ No newline at end of file diff --git a/src/examples/px4_simple_app/module.mk b/src/examples/px4_simple_app/module.mk index 2c102fa500..32b06c3a58 100644 --- a/src/examples/px4_simple_app/module.mk +++ b/src/examples/px4_simple_app/module.mk @@ -37,4 +37,4 @@ MODULE_COMMAND = px4_simple_app -SRCS = px4_simple_app.c +SRCS = px4_simple_app.c From ff518e72d4f8628a44ff5d4106cf56ace6ec97f7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 08:34:48 +0200 Subject: [PATCH 124/129] Make it harder to run into a non-existent uORB error --- ROMFS/px4fmu_common/init.d/rc.sensors | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 42c2f52e94..62c7184b85 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -7,6 +7,14 @@ # Start sensor drivers here. # +# +# Check for UORB +# +if uorb start +then + echo "uORB started" +fi + ms5611 start adc start From 69571c48c4fa742cfbfe9ce2333fc3d9c1f06034 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 10:02:15 +0200 Subject: [PATCH 125/129] Fixed compile and logic errors, behaving now --- src/modules/px4iofirmware/mixer.cpp | 4 ++-- src/modules/px4iofirmware/registers.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/modules/px4iofirmware/mixer.cpp b/src/modules/px4iofirmware/mixer.cpp index f38593d2aa..5ada1b220e 100644 --- a/src/modules/px4iofirmware/mixer.cpp +++ b/src/modules/px4iofirmware/mixer.cpp @@ -174,7 +174,7 @@ mixer_tick(void) * here. */ bool should_arm = ( - /* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && + /* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) && /* IO is armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED) && /* there is valid input */ (r_status_flags & (PX4IO_P_STATUS_FLAGS_RAW_PWM | PX4IO_P_STATUS_FLAGS_MIXER_OK)) && /* IO initialised without error */ (r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK) && @@ -246,7 +246,7 @@ void mixer_handle_text(const void *buffer, size_t length) { /* do not allow a mixer change while fully armed */ - if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && + if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) && /* IO is armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { return; } diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 4f3addfea8..61049c8b6a 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -142,9 +142,10 @@ volatile uint16_t r_page_setup[] = }; #define PX4IO_P_SETUP_FEATURES_VALID (0) -#define PX4IO_P_SETUP_ARMING_VALID (PX4IO_P_SETUP_ARMING_ARM_OK | \ +#define PX4IO_P_SETUP_ARMING_VALID (PX4IO_P_SETUP_ARMING_FMU_ARMED | \ PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK | \ - PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK) + PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK | \ + PX4IO_P_SETUP_ARMING_IO_ARM_OK) #define PX4IO_P_SETUP_RATES_VALID ((1 << IO_SERVO_COUNT) - 1) #define PX4IO_P_SETUP_RELAYS_VALID ((1 << PX4IO_RELAY_CHANNELS) - 1) @@ -311,7 +312,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) * so that an in-air reset of FMU can not lead to a * lockup of the IO arming state. */ - if ((r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && !(value & PX4IO_P_SETUP_ARMING_ARM_OK)) { + if ((r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) && !(value & PX4IO_P_SETUP_ARMING_FMU_ARMED)) { r_status_flags &= ~PX4IO_P_STATUS_FLAGS_ARMED; } @@ -362,7 +363,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) case PX4IO_PAGE_RC_CONFIG: { /* do not allow a RC config change while fully armed */ - if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && + if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) && /* IO is armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { break; } From 3ac76c4476038b170c319cfccd4a934363e1aca4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 10:15:36 +0200 Subject: [PATCH 126/129] Blink pattern fixes --- src/modules/px4iofirmware/safety.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/px4iofirmware/safety.c b/src/modules/px4iofirmware/safety.c index f6cd5fb450..4dbecc2744 100644 --- a/src/modules/px4iofirmware/safety.c +++ b/src/modules/px4iofirmware/safety.c @@ -60,6 +60,7 @@ static unsigned counter = 0; #define LED_PATTERN_FMU_OK_TO_ARM 0x0003 /**< slow blinking */ #define LED_PATTERN_FMU_REFUSE_TO_ARM 0x5555 /**< fast blinking */ #define LED_PATTERN_IO_ARMED 0x5050 /**< long off, then double blink */ +#define LED_PATTERN_FMU_ARMED 0x5500 /**< long off, then quad blink */ #define LED_PATTERN_IO_FMU_ARMED 0xffff /**< constantly on */ static unsigned blink_counter = 0; @@ -147,6 +148,8 @@ safety_check_button(void *arg) pattern = LED_PATTERN_IO_ARMED; } + } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) { + pattern = LED_PATTERN_FMU_ARMED; } else if (r_setup_arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK) { pattern = LED_PATTERN_FMU_OK_TO_ARM; From 7ae053c16b6bfb8bcd01cfc5418771854363f659 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 10:26:42 +0200 Subject: [PATCH 127/129] Hotfix: Make the param file name less then 8 characters --- ROMFS/px4fmu_common/init.d/rc.FMU_quad_x | 6 +++--- ROMFS/px4fmu_common/init.d/rc.IO_QUAD | 6 +++--- ROMFS/px4fmu_common/init.d/rc.PX4IO | 6 +++--- ROMFS/px4fmu_common/init.d/rc.PX4IOAR | 8 ++++---- ROMFS/px4fmu_common/init.d/rc.hil | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x index 8787443ea2..980197d68e 100644 --- a/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x +++ b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x @@ -20,10 +20,10 @@ uorb start # Load microSD params # echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] +param select /fs/microsd/params +if [ -f /fs/microsd/params ] then - param load /fs/microsd/parameters + param load /fs/microsd/params fi # diff --git a/ROMFS/px4fmu_common/init.d/rc.IO_QUAD b/ROMFS/px4fmu_common/init.d/rc.IO_QUAD index 287cb0483b..5f2de0d7e0 100644 --- a/ROMFS/px4fmu_common/init.d/rc.IO_QUAD +++ b/ROMFS/px4fmu_common/init.d/rc.IO_QUAD @@ -13,10 +13,10 @@ uorb start # Load microSD params # echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] +param select /fs/microsd/params +if [ -f /fs/microsd/params ] then - param load /fs/microsd/parameters + param load /fs/microsd/params fi # diff --git a/ROMFS/px4fmu_common/init.d/rc.PX4IO b/ROMFS/px4fmu_common/init.d/rc.PX4IO index 7ae4a55860..925a5703e7 100644 --- a/ROMFS/px4fmu_common/init.d/rc.PX4IO +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IO @@ -13,10 +13,10 @@ uorb start # Load microSD params # echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] +param select /fs/microsd/params +if [ -f /fs/microsd/params ] then - param load /fs/microsd/parameters + param load /fs/microsd/params fi # diff --git a/ROMFS/px4fmu_common/init.d/rc.PX4IOAR b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR index ab29e21c7e..f55ac2ae34 100644 --- a/ROMFS/px4fmu_common/init.d/rc.PX4IOAR +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR @@ -17,13 +17,13 @@ echo "[init] doing PX4IOAR startup..." uorb start # -# Init the parameter storage +# Load microSD params # echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] +param select /fs/microsd/params +if [ -f /fs/microsd/params ] then - param load /fs/microsd/parameters + param load /fs/microsd/params fi # diff --git a/ROMFS/px4fmu_common/init.d/rc.hil b/ROMFS/px4fmu_common/init.d/rc.hil index 980b78edda..7614ac0feb 100644 --- a/ROMFS/px4fmu_common/init.d/rc.hil +++ b/ROMFS/px4fmu_common/init.d/rc.hil @@ -17,10 +17,10 @@ hil mode_pwm # Load microSD params # echo "[init] loading microSD params" -param select /fs/microsd/parameters -if [ -f /fs/microsd/parameters ] +param select /fs/microsd/params +if [ -f /fs/microsd/params ] then - param load /fs/microsd/parameters + param load /fs/microsd/params fi # From 9a07788d58dd6f1ca6657e18048bf88eae5f6e10 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 13 May 2013 23:25:18 +0200 Subject: [PATCH 128/129] Hotfix: Off-by-one fix in overflow check --- src/drivers/ardrone_interface/ardrone_motor_control.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/ardrone_interface/ardrone_motor_control.c b/src/drivers/ardrone_interface/ardrone_motor_control.c index f15c74a22d..ecd31a073d 100644 --- a/src/drivers/ardrone_interface/ardrone_motor_control.c +++ b/src/drivers/ardrone_interface/ardrone_motor_control.c @@ -482,10 +482,10 @@ void ardrone_mixing_and_output(int ardrone_write, const struct actuator_controls motor_pwm[3] = (motor_pwm[3] > 0) ? motor_pwm[3] : 10; /* Failsafe logic - should never be necessary */ - motor_pwm[0] = (motor_pwm[0] <= 512) ? motor_pwm[0] : 512; - motor_pwm[1] = (motor_pwm[1] <= 512) ? motor_pwm[1] : 512; - motor_pwm[2] = (motor_pwm[2] <= 512) ? motor_pwm[2] : 512; - motor_pwm[3] = (motor_pwm[3] <= 512) ? motor_pwm[3] : 512; + motor_pwm[0] = (motor_pwm[0] <= 511) ? motor_pwm[0] : 511; + motor_pwm[1] = (motor_pwm[1] <= 511) ? motor_pwm[1] : 511; + motor_pwm[2] = (motor_pwm[2] <= 511) ? motor_pwm[2] : 511; + motor_pwm[3] = (motor_pwm[3] <= 511) ? motor_pwm[3] : 511; /* send motors via UART */ ardrone_write_motor_commands(ardrone_write, motor_pwm[0], motor_pwm[1], motor_pwm[2], motor_pwm[3]); From 0c43315c1ed8538daee9ad47c14731c295c2dda2 Mon Sep 17 00:00:00 2001 From: px4dev Date: Mon, 13 May 2013 22:20:08 -0700 Subject: [PATCH 129/129] Hotfix: better error messages for missing modules --- makefiles/firmware.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 7afa3e787d..497e792376 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -201,9 +201,9 @@ MODULES := $(sort $(MODULES)) # locate the first instance of a module by full path or by looking on the # module search path define MODULE_SEARCH - $(abspath $(firstword $(wildcard $(1)/module.mk) \ - $(foreach search_dir,$(MODULE_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/module.mk)) \ - MISSING_$1)) + $(firstword $(abspath $(wildcard $(1)/module.mk)) \ + $(abspath $(foreach search_dir,$(MODULE_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/module.mk))) \ + MISSING_$1) endef # make a list of module makefiles and check that we found them all