diff --git a/Makefile b/Makefile index cb91bfaf5..0a0ac055c 100644 --- a/Makefile +++ b/Makefile @@ -255,8 +255,9 @@ ahrs_%: uavobjects_flight .PHONY: coptercontrol coptercontrol: coptercontrol_elf -coptercontrol_%: uavobjects +coptercontrol_%: uavobjgenerator mkdir -p $(BUILD_DIR)/coptercontrol + $(MAKE) OUTDIR="$(BUILD_DIR)/coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" -C $(ROOT_DIR)/flight/CopterControl uavobjects $(MAKE) OUTDIR="$(BUILD_DIR)/coptercontrol" TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" -C $(ROOT_DIR)/flight/CopterControl $* .PHONY: pipxtreme diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 3b6e14634..7bd7dd203 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -65,6 +65,30 @@ MODULES = Telemetry ManualControl Actuator CCAttitude #Stabilization #MODULES = Telemetry #MODULES += Osd/OsdEtStd +# List of UAVObjects to include +UAVOBJECTS = ObjectPersistence +UAVOBJECTS += GCSTelemetryStats +UAVOBJECTS += FlightTelemetryStats +UAVOBJECTS += SystemStats +UAVOBJECTS += SystemAlarms +UAVOBJECTS += SystemSettings +UAVOBJECTS += ActuatorCommand +UAVOBJECTS += ActuatorDesired +UAVOBJECTS += AttitudeRaw +UAVOBJECTS += AttitudeActual +UAVOBJECTS += AttitudeDesired +UAVOBJECTS += ManualControlCommand +UAVOBJECTS += TaskInfo +UAVOBJECTS += I2CStats +UAVOBJECTS += WatchdogStatus +UAVOBJECTS += TelemetrySettings +UAVOBJECTS += StabilizationSettings +UAVOBJECTS += ActuatorSettings +UAVOBJECTS += RateDesired +UAVOBJECTS += AHRSSettings +UAVOBJECTS += ManualControlSettings +UAVOBJECTS += MixerSettings +UAVOBJECTS += MixerStatus # MCU name, submodel and board # - MCU used for compiler-option (-mcpu) @@ -82,7 +106,20 @@ BOOT_MODEL = $(MODEL)_NB endif # Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.) -OUTDIR = ../../build/coptercontrol +ROOT_DIR = $(CURDIR)/../.. +BUILD_DIR = $(ROOT_DIR)/build +OUTDIR = $(BUILD_DIR)/coptercontrol + +# We almost need to consider autoconf/automake instead of this +# I don't know if windows supports uname :-( +UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/debug/uavobjgenerator.exe" +UNAME := $(shell uname) +ifeq ($(UNAME), Linux) + UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" +endif +ifeq ($(UNAME), Darwin) + UAVOBJGENERATOR="$(BUILD_DIR)/ground/uavobjgenerator/uavobjgenerator" +endif # Target file name (without extension). TARGET = CopterControl @@ -131,7 +168,7 @@ PYMITEINC += $(OUTDIR) FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans -OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight +OPUAVSYNTHDIR = $(OUTDIR)/uavobject-synthetics/flight # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files @@ -150,7 +187,8 @@ SRC += $(OPSYSTEM)/alarms.c SRC += $(OPSYSTEM)/taskmonitor.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/uavobjectsinit_cc.c +#SRC += $(OPUAVOBJ)/uavobjectsinit_cc.c +#will use uavobjectsinit.c generated specially for CopterControl instead SRC += $(OPUAVOBJ)/eventdispatcher.c else ## TESTCODE @@ -162,33 +200,7 @@ endif ## UAVOBJECTS ifndef TESTAPP -SRC += $(OPUAVSYNTHDIR)/objectpersistence.c -SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c -SRC += $(OPUAVSYNTHDIR)/systemstats.c -SRC += $(OPUAVSYNTHDIR)/systemalarms.c -SRC += $(OPUAVSYNTHDIR)/systemsettings.c -SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c -SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c -SRC += $(OPUAVSYNTHDIR)/actuatordesired.c -SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c -SRC += $(OPUAVSYNTHDIR)/attituderaw.c -SRC += $(OPUAVSYNTHDIR)/attitudeactual.c -SRC += $(OPUAVSYNTHDIR)/attitudedesired.c -SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c -SRC += $(OPUAVSYNTHDIR)/taskinfo.c -SRC += $(OPUAVSYNTHDIR)/i2cstats.c -SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c -SRC += $(OPUAVSYNTHDIR)/telemetrysettings.c -SRC += $(OPUAVSYNTHDIR)/ratedesired.c -SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c -SRC += $(OPUAVSYNTHDIR)/mixersettings.c -SRC += $(OPUAVSYNTHDIR)/mixerstatus.c -SRC += $(OPUAVSYNTHDIR)/ahrssettings.c -#${wildcard ${OBJ}/$(shell echo $(VAR) | tr A-Z a-z)/*.c} -#SRC += ${foreach OBJ, ${UAVOBJECTS}, $(UAVOBJECTS)/$(OBJ).c} -# Cant use until i can automatically generate list of UAVObjects -#SRC += ${OUTDIR}/InitObjects.c +SRC += $(wildcard $(OPUAVSYNTHDIR)/*.c) endif ## PIOS Hardware (STM32F10x) @@ -598,7 +610,7 @@ endif # Generate intermediate code for objects -gencode: ${OUTDIR}/InitObjects.c ${OUTDIR}/InitMods.c +gencode: ${OUTDIR}/InitMods.c # Generate code for object initialization ${OUTDIR}/InitObjects.c: Makefile @@ -813,9 +825,23 @@ else -include $(shell mkdir -p $(OUTDIR) 2>/dev/null) $(shell mkdir $(OUTDIR)/dep 2>/dev/null) $(wildcard $(OUTDIR)/dep/*) endif +UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition +UAVOBJ_OUT_DIR := $(OUTDIR)/uavobject-synthetics +$(UAVOBJ_OUT_DIR): +ifdef ComSpec + $(shell md $(subst /,\\,$@) 2>NUL) +else + $(shell mkdir -p $@ 2>/dev/null) +endif + +uavobjects: $(UAVOBJ_OUT_DIR) + ( cd $(UAVOBJ_OUT_DIR) ; \ + $(REMOVE) $(wildcard $(OPUAVSYNTHDIR)/*.c) ; \ + $(UAVOBJGENERATOR) -flight $(UAVOBJ_XML_DIR) $(ROOT_DIR) $(UAVOBJECTS); \ + ) # Listing of phony targets. .PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex bin lss sym clean clean_list program gencode +build elf hex bin lss sym clean clean_list program gencode uavobjects diff --git a/flight/UAVObjects/uavobjectsinit_cc.c b/flight/UAVObjects/uavobjectsinit_cc.c deleted file mode 100644 index 9a58eccf1..000000000 --- a/flight/UAVObjects/uavobjectsinit_cc.c +++ /dev/null @@ -1,102 +0,0 @@ -/** - ****************************************************************************** - * - * @file uavobjectsinit.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Initialize all objects. - * Automatically generated by the UAVObjectGenerator. - * - * @note This is an automatically generated file. - * DO NOT modify manually. - * @see The GNU Public License (GPL) Version 3 - * - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "openpilot.h" -#include "actuatorcommand.h" -#include "actuatordesired.h" -#include "actuatorsettings.h" -#include "ahrscalibration.h" -#include "ahrssettings.h" -#include "ahrsstatus.h" -#include "attitudeactual.h" -#include "attitudedesired.h" -#include "attituderaw.h" -#include "baroaltitude.h" -#include "batterysettings.h" -#include "firmwareiapobj.h" -#include "flightbatterystate.h" -#include "flightplancontrol.h" -#include "flightplansettings.h" -#include "flightplanstatus.h" -#include "flighttelemetrystats.h" -#include "gcstelemetrystats.h" -#include "gpsposition.h" -#include "gpssatellites.h" -#include "gpstime.h" -#include "guidancesettings.h" -#include "homelocation.h" -#include "i2cstats.h" -#include "manualcontrolcommand.h" -#include "manualcontrolsettings.h" -#include "mixersettings.h" -#include "mixerstatus.h" -#include "objectpersistence.h" -#include "positionactual.h" -#include "positiondesired.h" -#include "ratedesired.h" -#include "stabilizationsettings.h" -#include "systemalarms.h" -#include "systemsettings.h" -#include "systemstats.h" -#include "taskinfo.h" -#include "telemetrysettings.h" -#include "velocityactual.h" -#include "velocitydesired.h" -#include "watchdogstatus.h" - -/** - * Function used to initialize the first instance of each object. - * This file is automatically updated by the UAVObjectGenerator. - */ -void UAVObjectsInitializeAll() -{ - ObjectPersistenceInitialize(); - GCSTelemetryStatsInitialize(); - FlightTelemetryStatsInitialize(); - SystemStatsInitialize(); - SystemAlarmsInitialize(); - SystemSettingsInitialize(); - ActuatorCommandInitialize(); - ActuatorDesiredInitialize(); - AttitudeRawInitialize(); - AttitudeActualInitialize(); - AttitudeDesiredInitialize(); - ManualControlCommandInitialize(); - TaskInfoInitialize(); - I2CStatsInitialize(); - WatchdogStatusInitialize(); - TelemetrySettingsInitialize(); - StabilizationSettingsInitialize(); - ActuatorSettingsInitialize(); - RateDesiredInitialize(); - AHRSSettingsInitialize(); - ManualControlSettingsInitialize(); - MixerSettingsInitialize(); - MixerStatusInitialize(); -} diff --git a/shared/uavobjectdefinition/firmwareiap.xml b/shared/uavobjectdefinition/firmwareiapobj.xml similarity index 100% rename from shared/uavobjectdefinition/firmwareiap.xml rename to shared/uavobjectdefinition/firmwareiapobj.xml