1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-26 15:54:15 +01:00

UAVObjects-flight: Move generated files into build dir

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2520 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
stac 2011-01-22 17:38:15 +00:00 committed by stac
parent dbcae23e07
commit 2d53902148
7 changed files with 67 additions and 146 deletions

89
.gitignore vendored
View File

@ -67,95 +67,6 @@
#ignore autogenerated files - they should really go into special dirs to be ignored more easy #ignore autogenerated files - they should really go into special dirs to be ignored more easy
flight/UAVObjects/actuatorcommand.c
flight/UAVObjects/actuatordesired.c
flight/UAVObjects/actuatorsettings.c
flight/UAVObjects/ahrscalibration.c
flight/UAVObjects/ahrssettings.c
flight/UAVObjects/ahrsstatus.c
flight/UAVObjects/attitudeactual.c
flight/UAVObjects/attitudedesired.c
flight/UAVObjects/attituderaw.c
flight/UAVObjects/baroaltitude.c
flight/UAVObjects/batterysettings.c
flight/UAVObjects/firmwareiapobj.c
flight/UAVObjects/flightbatterystate.c
flight/UAVObjects/flightplancontrol.c
flight/UAVObjects/flightplansettings.c
flight/UAVObjects/flightplanstatus.c
flight/UAVObjects/flighttelemetrystats.c
flight/UAVObjects/gcstelemetrystats.c
flight/UAVObjects/gpsposition.c
flight/UAVObjects/gpssatellites.c
flight/UAVObjects/gpstime.c
flight/UAVObjects/guidancesettings.c
flight/UAVObjects/homelocation.c
flight/UAVObjects/i2cstats.c
flight/UAVObjects/inc/actuatorcommand.h
flight/UAVObjects/inc/actuatordesired.h
flight//UAVObjects/inc/actuatorsettings.h
flight/UAVObjects/inc/ahrscalibration.h
flight/UAVObjects/inc/ahrssettings.h
flight/UAVObjects/inc/ahrsstatus.h
flight/UAVObjects/inc/attitudeactual.h
flight/UAVObjects/inc/attitudedesired.h
flight/UAVObjects/inc/attituderaw.h
flight/UAVObjects/inc/baroaltitude.h
flight/UAVObjects/inc/batterysettings.h
flight/UAVObjects/inc/firmwareiapobj.h
flight/UAVObjects/inc/flightbatterystate.h
flight/UAVObjects/inc/flightplancontrol.h
flight/UAVObjects/inc/flightplansettings.h
flight/UAVObjects/inc/flightplanstatus.h
flight/UAVObjects/inc/flighttelemetrystats.h
flight/UAVObjects/inc/gcstelemetrystats.h
flight/UAVObjects/inc/gpsposition.h
flight/UAVObjects/inc/gpssatellites.h
flight/UAVObjects/inc/gpstime.h
flight/UAVObjects/inc/guidancesettings.h
flight/UAVObjects/inc/homelocation.h
flight/UAVObjects/inc/i2cstats.h
flight/UAVObjects/inc/manualcontrolcommand.h
flight/UAVObjects/inc/manualcontrolsettings.h
flight/UAVObjects/inc/mixersettings.h
flight/UAVObjects/inc/mixerstatus.h
flight/UAVObjects/inc/objectpersistence.h
flight/UAVObjects/inc/pipxtrememodemsettings.h
flight/UAVObjects/inc/pipxtrememodemstatus.h
flight/UAVObjects/inc/positionactual.h
flight/UAVObjects/inc/positiondesired.h
flight/UAVObjects/inc/ratedesired.h
flight/UAVObjects/inc/stabilizationsettings.h
flight/UAVObjects/inc/systemalarms.h
flight/UAVObjects/inc/systemsettings.h
flight/UAVObjects/inc/systemstats.h
flight/UAVObjects/inc/taskinfo.h
flight/UAVObjects/inc/telemetrysettings.h
flight/UAVObjects/inc/velocityactual.h
flight/UAVObjects/inc/velocitydesired.h
flight/UAVObjects/inc/watchdogstatus.h
flight/UAVObjects/manualcontrolcommand.c
flight/UAVObjects/manualcontrolsettings.c
flight/UAVObjects/mixersettings.c
flight/UAVObjects/mixerstatus.c
flight/UAVObjects/objectpersistence.c
flight/UAVObjects/pipxtrememodemsettings.c
flight/UAVObjects/pipxtrememodemstatus.c
flight/UAVObjects/positionactual.c
flight/UAVObjects/positiondesired.c
flight/UAVObjects/ratedesired.c
flight/UAVObjects/stabilizationsettings.c
flight/UAVObjects/systemalarms.c
flight/UAVObjects/systemsettings.c
flight/UAVObjects/systemstats.c
flight/UAVObjects/taskinfo.c
flight/UAVObjects/telemetrysettings.c
flight/UAVObjects/velocityactual.c
flight/UAVObjects/velocitydesired.c
flight/UAVObjects/watchdogstatus.c
flight/UAVObjects/uavobjectsinit.c
ground/src/plugins/uavobjects/actuatorcommand.cpp ground/src/plugins/uavobjects/actuatorcommand.cpp
ground/src/plugins/uavobjects/actuatordesired.cpp ground/src/plugins/uavobjects/actuatordesired.cpp
ground/src/plugins/uavobjects/actuatorsettings.cpp ground/src/plugins/uavobjects/actuatorsettings.cpp

View File

@ -209,21 +209,21 @@ uavobjgenerator:
$(MAKE) -w ; \ $(MAKE) -w ; \
) )
.PHONY: build_dir .PHONY: uavobjects-synthetics
bzild_dir: uavobject-synthetics:
mkdir -p $(BUILD_DIR)/$@ mkdir -p $(BUILD_DIR)/$@
.PHONY:uavobjects .PHONY:uavobjects
uavobjects: build_dir uavobjgenerator uavobjects: uavobjects_gcs uavobjects_flight
$(UAVOBJGENERATOR) "$(ROOT_DIR)/"
uavobjects_gcs: build_dir uavobjgenerator uavobjects_gcs: uavobject-synthetics uavobjgenerator
$(UAVOBJGENERATOR) -gcs "$(ROOT_DIR)/" $(UAVOBJGENERATOR) -gcs "$(ROOT_DIR)/"
uavobjects_flight: build_dir uavobjgenerator uavobjects_flight: uavobject-synthetics uavobjgenerator
mkdir -p $(BUILD_DIR)/uavobject-synthetics/flight
$(UAVOBJGENERATOR) -flight "$(ROOT_DIR)/" $(UAVOBJGENERATOR) -flight "$(ROOT_DIR)/"
uavobjects_test: build_dir uavobjgenerator uavobjects_test: uavobject-synthetics uavobjgenerator
$(UAVOBJGENERATOR) -v -none "$(ROOT_DIR)/" $(UAVOBJGENERATOR) -v -none "$(ROOT_DIR)/"
############################## ##############################

View File

@ -89,6 +89,8 @@ OPSYSINC = $(OPDIR)/System/inc
BOOT = ../Bootloaders/AHRS BOOT = ../Bootloaders/AHRS
BOOTINC = $(BOOT)/inc BOOTINC = $(BOOT)/inc
OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files # use file-extension c for "c-only"-files
@ -182,7 +184,7 @@ EXTRAINCDIRS += $(PIOSBOARDS)
EXTRAINCDIRS += $(STMSPDINCDIR) EXTRAINCDIRS += $(STMSPDINCDIR)
EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(CMSISDIR)
EXTRAINCDIRS += $(AHRSINC) EXTRAINCDIRS += $(AHRSINC)
EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(OPUAVSYNTHDIR)
EXTRAINCDIRS += $(BOOTINC) EXTRAINCDIRS += $(BOOTINC)
# List any extra directories to look for library files here. # List any extra directories to look for library files here.

View File

@ -130,6 +130,8 @@ PYMITEINC += $(OUTDIR)
FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib
FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans
OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files # use file-extension c for "c-only"-files
@ -156,7 +158,6 @@ SRC += $(OPSYSTEM)/alarms.c
SRC += $(OPSYSTEM)/taskmonitor.c SRC += $(OPSYSTEM)/taskmonitor.c
SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/uavobjectsinit.c
SRC += $(OPUAVOBJ)/eventdispatcher.c SRC += $(OPUAVOBJ)/eventdispatcher.c
else else
## TESTCODE ## TESTCODE
@ -168,48 +169,49 @@ endif
## UAVOBJECTS ## UAVOBJECTS
ifndef TESTAPP ifndef TESTAPP
SRC += $(OPUAVOBJ)/objectpersistence.c SRC += $(OPUAVSYNTHDIR)/objectpersistence.c
SRC += $(OPUAVOBJ)/positionactual.c SRC += $(OPUAVSYNTHDIR)/positionactual.c
SRC += $(OPUAVOBJ)/gpsposition.c SRC += $(OPUAVSYNTHDIR)/gpsposition.c
SRC += $(OPUAVOBJ)/gpstime.c SRC += $(OPUAVSYNTHDIR)/gpstime.c
SRC += $(OPUAVOBJ)/gpssatellites.c SRC += $(OPUAVSYNTHDIR)/gpssatellites.c
SRC += $(OPUAVOBJ)/gcstelemetrystats.c SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c
SRC += $(OPUAVOBJ)/flighttelemetrystats.c SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c
SRC += $(OPUAVOBJ)/systemstats.c SRC += $(OPUAVSYNTHDIR)/systemstats.c
SRC += $(OPUAVOBJ)/systemalarms.c SRC += $(OPUAVSYNTHDIR)/systemalarms.c
SRC += $(OPUAVOBJ)/systemsettings.c SRC += $(OPUAVSYNTHDIR)/systemsettings.c
SRC += $(OPUAVOBJ)/telemetrysettings.c SRC += $(OPUAVSYNTHDIR)/telemetrysettings.c
SRC += $(OPUAVOBJ)/actuatorcommand.c SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c
SRC += $(OPUAVOBJ)/actuatordesired.c SRC += $(OPUAVSYNTHDIR)/actuatordesired.c
SRC += $(OPUAVOBJ)/actuatorsettings.c SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c
SRC += $(OPUAVOBJ)/manualcontrolcommand.c SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c
SRC += $(OPUAVOBJ)/manualcontrolsettings.c SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c
SRC += $(OPUAVOBJ)/attitudedesired.c SRC += $(OPUAVSYNTHDIR)/attitudedesired.c
SRC += $(OPUAVOBJ)/stabilizationsettings.c SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c
SRC += $(OPUAVOBJ)/ahrsstatus.c SRC += $(OPUAVSYNTHDIR)/ahrsstatus.c
SRC += $(OPUAVOBJ)/i2cstats.c SRC += $(OPUAVSYNTHDIR)/i2cstats.c
SRC += $(OPUAVOBJ)/baroaltitude.c SRC += $(OPUAVSYNTHDIR)/baroaltitude.c
SRC += $(OPUAVOBJ)/ahrscalibration.c SRC += $(OPUAVSYNTHDIR)/ahrscalibration.c
SRC += $(OPUAVOBJ)/attitudeactual.c SRC += $(OPUAVSYNTHDIR)/attitudeactual.c
SRC += $(OPUAVOBJ)/ahrssettings.c SRC += $(OPUAVSYNTHDIR)/ahrssettings.c
SRC += $(OPUAVOBJ)/flightbatterystate.c SRC += $(OPUAVSYNTHDIR)/flightbatterystate.c
SRC += $(OPUAVOBJ)/attituderaw.c SRC += $(OPUAVSYNTHDIR)/attituderaw.c
SRC += $(OPUAVOBJ)/homelocation.c SRC += $(OPUAVSYNTHDIR)/homelocation.c
SRC += $(OPUAVOBJ)/mixersettings.c SRC += $(OPUAVSYNTHDIR)/mixersettings.c
SRC += $(OPUAVOBJ)/mixerstatus.c SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
SRC += $(OPUAVOBJ)/positiondesired.c SRC += $(OPUAVSYNTHDIR)/positiondesired.c
SRC += $(OPUAVOBJ)/velocitydesired.c SRC += $(OPUAVSYNTHDIR)/velocitydesired.c
SRC += $(OPUAVOBJ)/velocityactual.c SRC += $(OPUAVSYNTHDIR)/velocityactual.c
SRC += $(OPUAVOBJ)/guidancesettings.c SRC += $(OPUAVSYNTHDIR)/guidancesettings.c
SRC += $(OPUAVOBJ)/firmwareiapobj.c SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c
SRC += $(OPUAVOBJ)/ratedesired.c SRC += $(OPUAVSYNTHDIR)/ratedesired.c
SRC += $(OPUAVOBJ)/batterysettings.c SRC += $(OPUAVSYNTHDIR)/batterysettings.c
SRC += $(OPUAVOBJ)/flightplancontrol.c SRC += $(OPUAVSYNTHDIR)/flightplancontrol.c
SRC += $(OPUAVOBJ)/flightplanstatus.c SRC += $(OPUAVSYNTHDIR)/flightplanstatus.c
SRC += $(OPUAVOBJ)/flightplansettings.c SRC += $(OPUAVSYNTHDIR)/flightplansettings.c
SRC += $(OPUAVOBJ)/taskinfo.c SRC += $(OPUAVSYNTHDIR)/taskinfo.c
SRC += $(OPUAVOBJ)/watchdogstatus.c SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c
SRC += $(OPUAVOBJ)/nedaccel.c SRC += $(OPUAVSYNTHDIR)/nedaccel.c
SRC += $(OPUAVSYNTHDIR)/uavobjectsinit.c
endif endif
## PIOS Hardware (STM32F10x) ## PIOS Hardware (STM32F10x)
@ -346,6 +348,7 @@ EXTRAINCDIRS += $(OPUAVTALK)
EXTRAINCDIRS += $(OPUAVTALKINC) EXTRAINCDIRS += $(OPUAVTALKINC)
EXTRAINCDIRS += $(OPUAVOBJ) EXTRAINCDIRS += $(OPUAVOBJ)
EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(OPUAVOBJINC)
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
EXTRAINCDIRS += $(PIOS) EXTRAINCDIRS += $(PIOS)
EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(PIOSINC)
EXTRAINCDIRS += $(FLIGHTLIBINC) EXTRAINCDIRS += $(FLIGHTLIBINC)

View File

@ -28,13 +28,14 @@
using namespace std; using namespace std;
bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath) { bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath,QString outputpath) {
fieldTypeStrC << "int8_t" << "int16_t" << "int32_t" <<"uint8_t" fieldTypeStrC << "int8_t" << "int16_t" << "int32_t" <<"uint8_t"
<<"uint16_t" << "uint32_t" << "float" << "uint8_t"; <<"uint16_t" << "uint32_t" << "float" << "uint8_t";
QString flightObjInit,objInc; QString flightObjInit,objInc;
flightCodePath = QDir( basepath + QString("flight/UAVObjects")); flightCodePath = QDir( basepath + QString("flight/UAVObjects"));
flightOutputPath = QDir( outputpath + QString("flight"));
flightCodeTemplate = readFile( flightCodePath.absoluteFilePath("uavobjecttemplate.c") ); flightCodeTemplate = readFile( flightCodePath.absoluteFilePath("uavobjecttemplate.c") );
flightIncludeTemplate = readFile( flightCodePath.absoluteFilePath("inc/uavobjecttemplate.h") ); flightIncludeTemplate = readFile( flightCodePath.absoluteFilePath("inc/uavobjecttemplate.h") );
@ -55,7 +56,7 @@ bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath
// Write the flight object inialization files // Write the flight object inialization files
flightInitTemplate.replace( QString("$(OBJINC)"), objInc); flightInitTemplate.replace( QString("$(OBJINC)"), objInc);
flightInitTemplate.replace( QString("$(OBJINIT)"), flightObjInit); flightInitTemplate.replace( QString("$(OBJINIT)"), flightObjInit);
bool res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/uavobjectsinit.c", bool res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/uavobjectsinit.c",
flightInitTemplate ); flightInitTemplate );
if (!res) { if (!res) {
cout << "Error: Could not write flight object init files" << endl; cout << "Error: Could not write flight object init files" << endl;
@ -221,13 +222,13 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo* info)
outCode.replace(QString("$(INITFIELDS)"), initfields); outCode.replace(QString("$(INITFIELDS)"), initfields);
// Write the flight code // Write the flight code
bool res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/" + info->namelc + ".c", outCode ); bool res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/" + info->namelc + ".c", outCode );
if (!res) { if (!res) {
cout << "Error: Could not write flight code files" << endl; cout << "Error: Could not write flight code files" << endl;
return false; return false;
} }
res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/inc/" + info->namelc + ".h", outInclude ); res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/" + info->namelc + ".h", outInclude );
if (!res) { if (!res) {
cout << "Error: Could not write flight include files" << endl; cout << "Error: Could not write flight include files" << endl;
return false; return false;

View File

@ -32,10 +32,11 @@
class UAVObjectGeneratorFlight class UAVObjectGeneratorFlight
{ {
public: public:
bool generate(UAVObjectParser* gen,QString basepath); bool generate(UAVObjectParser* gen,QString basepath,QString outputpath);
QStringList fieldTypeStrC; QStringList fieldTypeStrC;
QString flightCodeTemplate, flightIncludeTemplate, flightInitTemplate; QString flightCodeTemplate, flightIncludeTemplate, flightInitTemplate;
QDir flightCodePath; QDir flightCodePath;
QDir flightOutputPath;
private: private:
bool process_object(ObjectInfo* info); bool process_object(ObjectInfo* info);

View File

@ -79,6 +79,7 @@ int main(int argc, char *argv[])
cout << "- OpenPilot UAVObject Generator -" << endl; cout << "- OpenPilot UAVObject Generator -" << endl;
QString basepath; QString basepath;
QString outputpath;
QStringList arguments_stringlist; QStringList arguments_stringlist;
// process arguments // process arguments
@ -110,6 +111,8 @@ int main(int argc, char *argv[])
if (!basepath.endsWith("/")) if (!basepath.endsWith("/"))
basepath.append("/"); // append a slash if it is not there basepath.append("/"); // append a slash if it is not there
outputpath = basepath + QString("build/uavobject-synthetics/");
QDir xmlPath = QDir( basepath + QString("ground/src/shared/uavobjectdefinition")); QDir xmlPath = QDir( basepath + QString("ground/src/shared/uavobjectdefinition"));
UAVObjectParser* parser = new UAVObjectParser(); UAVObjectParser* parser = new UAVObjectParser();
@ -166,7 +169,7 @@ int main(int argc, char *argv[])
if (do_flight|do_all) { if (do_flight|do_all) {
cout << "generating flight code" << endl ; cout << "generating flight code" << endl ;
UAVObjectGeneratorFlight flightgen; UAVObjectGeneratorFlight flightgen;
flightgen.generate(parser,basepath); flightgen.generate(parser,basepath,outputpath);
} }
// generate gcs code if wanted // generate gcs code if wanted