1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Revert "Fix to make stacs auto-loading of UAVObjects downwards compatible, since its not working on all architectures"

Note: This patch did not build after a clean build.

This reverts commit 7e75b5d16481a32689433c868b67916816d8b9fb.

Conflicts:

	flight/CopterControl/Makefile

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2651 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-02-01 01:56:02 +00:00 committed by peabody124
parent 87881734b0
commit bbbdea26b9
8 changed files with 32 additions and 60 deletions

View File

@ -151,7 +151,6 @@ SRC += $(OPSYSTEM)/taskmonitor.c
SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/eventdispatcher.c
SRC += $(OPUAVOBJ)/uavobjectsinit_linker.c
else
## TESTCODE
SRC += $(OPTESTS)/test_common.c
@ -186,6 +185,7 @@ SRC += $(OPUAVSYNTHDIR)/mixersettings.c
SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
SRC += $(OPUAVSYNTHDIR)/ahrssettings.c
SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c
SRC += $(OPUAVSYNTHDIR)/uavobjectsinit.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

View File

@ -159,7 +159,6 @@ SRC += $(OPSYSTEM)/taskmonitor.c
SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/eventdispatcher.c
SRC += $(OPUAVOBJ)/uavobjectsinit_linker.c
else
## TESTCODE
SRC += $(OPTESTS)/test_common.c

View File

@ -143,7 +143,6 @@ SRC += $(OPSYSTEM)/taskmonitor.c
SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/eventdispatcher.c
SRC += $(OPUAVSYNTHDIR)/init/uavobjectsinit.c
else
## TESTCODE
SRC += $(OPTESTS)/test_common.c

View File

@ -31,14 +31,31 @@
#ifndef PIOS_INITCALL_H
#define PIOS_INITCALL_H
/**
* Just a stub define to make things compile.
* Automatically link based initialization currently doesn't work
* since posix really runs on a multitude of architectures
* and we cannot define a linker script for each of them atm
/*
* This implementation is heavily based on the Linux Kernel initcall
* infrastructure:
* http://lxr.linux.no/#linux/include/linux/init.h
* http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=include/linux/init.h
*/
#define uavobj_initcall(fn)
/*
* Used for initialization calls..
*/
typedef int32_t (*initcall_t)(void);
/* initcalls are now grouped by functionality into separate
* subsections. Ordering inside the subsections is determined
* by link order.
*
* The `id' arg to __define_initcall() is needed so that multiple initcalls
* can point at the same handler without causing duplicate-symbol build errors.
*/
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __attribute__((__used__)) \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define uavobj_initcall(fn) __define_initcall("uavobj",fn,1)
#endif /* PIOS_INITCALL_H */

View File

@ -1,45 +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"
/**
* Function used to initialize the first instance of each object.
* This file is automatically updated by the UAVObjectGenerator.
*/
extern initcall_t __uavobj_initcall_start[], __uavobj_initcall_end[];
void UAVObjectsInitializeAll()
{
initcall_t *fn;
int32_t ret;
for (fn = __uavobj_initcall_start; fn < __uavobj_initcall_end; fn++)
ret = (*fn)();
}

View File

@ -28,13 +28,18 @@
*/
#include "openpilot.h"
$(OBJINC)
/**
* Function used to initialize the first instance of each object.
* This file is automatically updated by the UAVObjectGenerator.
*/
extern initcall_t __uavobj_initcall_start[], __uavobj_initcall_end[];
void UAVObjectsInitializeAll()
{
$(OBJINIT)
initcall_t *fn;
int32_t ret;
for (fn = __uavobj_initcall_start; fn < __uavobj_initcall_end; fn++)
ret = (*fn)();
}

View File

@ -37,8 +37,6 @@ bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString template
flightCodePath = QDir( templatepath + QString("flight/UAVObjects"));
flightOutputPath = QDir( outputpath + QString("flight") );
flightOutputPath.mkpath(flightOutputPath.absolutePath());
flightInitOutputPath = QDir( outputpath + QString("flight/init") );
flightInitOutputPath.mkpath(flightInitOutputPath.absolutePath());
flightCodeTemplate = readFile( flightCodePath.absoluteFilePath("uavobjecttemplate.c") );
flightIncludeTemplate = readFile( flightCodePath.absoluteFilePath("inc/uavobjecttemplate.h") );
@ -59,7 +57,7 @@ bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString template
// Write the flight object inialization files
flightInitTemplate.replace( QString("$(OBJINC)"), objInc);
flightInitTemplate.replace( QString("$(OBJINIT)"), flightObjInit);
bool res = writeFileIfDiffrent( flightInitOutputPath.absolutePath() + "/uavobjectsinit.c",
bool res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/uavobjectsinit.c",
flightInitTemplate );
if (!res) {
cout << "Error: Could not write flight object init files" << endl;

View File

@ -37,7 +37,6 @@ public:
QString flightCodeTemplate, flightIncludeTemplate, flightInitTemplate;
QDir flightCodePath;
QDir flightOutputPath;
QDir flightInitOutputPath;
private:
bool process_object(ObjectInfo* info);