1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

List of modules in Makefile - Automatic init of included modules

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@716 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
FredericG 2010-06-05 15:17:31 +00:00 committed by FredericG
parent dbcfea244e
commit 8a7eba0675
4 changed files with 32 additions and 48 deletions

View File

@ -44,6 +44,11 @@ FLASH_TOOL = OPENOCD
# in SRC and CPPSRC
USE_THUMB_MODE = YES
# List of modules to include
MODULES = Telemetry GPS ManualControl Actuator Altitude Attitude
#MODULES = Telemetry MK/MKSerial
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)
# - MODEL used for linker-script name (-T) and passed as define
@ -73,22 +78,6 @@ OPUAVOBJ = ./UAVObjects
OPUAVOBJINC = $(OPUAVOBJ)/inc
OPTESTS = ./Tests
OPMODULEDIR = ./Modules
MODEXAMPLE = $(OPMODULEDIR)/Example
MODEXAMPLEINC = $(MODEXAMPLE)/inc
MODSYSTEM = $(OPMODULEDIR)/System
MODSYSTEMINC = $(MODSYSTEM)/inc
MODTELEMETRY = $(OPMODULEDIR)/Telemetry
MODTELEMETRYINC = $(MODTELEMETRY)/inc
MODGPS = $(OPMODULEDIR)/GPS
MODGPSINC = $(MODGPS)/inc
MODMANUALCONTROL = $(OPMODULEDIR)/ManualControl
MODMANUALCONTROLINC = $(MODMANUALCONTROL)/inc
MODACTUATOR = $(OPMODULEDIR)/Actuator
MODACTUATORINC = $(MODACTUATOR)/inc
MODALTITUDE = $(OPMODULEDIR)/Altitude
MODALTITUDEINC = $(MODALTITUDE)/inc
MODATTITUDE = $(OPMODULEDIR)/Attitude
MODATTITUDEINC = $(MODATTITUDE)/inc
PIOS = ../PiOS
PIOSINC = $(PIOS)/inc
PIOSSTM32F10X = $(PIOS)/STM32F10x
@ -110,22 +99,17 @@ RTOSSRCDIR = $(RTOSDIR)/Source
RTOSINCDIR = $(RTOSSRCDIR)/include
DOXYGENDIR = ../Doc/Doxygen
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
## MODULES
ifndef TESTAPP
SRC = $(MODEXAMPLE)/examplemodevent.c $(MODEXAMPLE)/examplemodperiodic.c $(MODEXAMPLE)/examplemodthread.c
SRC += $(MODSYSTEM)/systemmod.c
SRC += $(MODTELEMETRY)/telemetry.c
SRC += $(MODGPS)/GPS.c $(MODGPS)/buffer.c
SRC += $(MODMANUALCONTROL)/manualcontrol.c
SRC += $(MODACTUATOR)/actuator.c
SRC += $(MODALTITUDE)/altitude.c
SRC += $(MODATTITUDE)/attitude.c
MODNAMES = $(notdir ${MODULES})
## OPENPILOT:
ifndef TESTAPP
## MODULES
SRC += ${foreach MOD, ${MODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
SRC += ${OUTDIR}/InitMods.c
## OPENPILOT CORE:
SRC += ${OPMODULEDIR}/System/systemmod.c
SRC += $(OPSYSTEM)/openpilot.c
SRC += $(OPSYSTEM)/alarms.c
SRC += $(OPUAVTALK)/uavtalk.c
@ -308,6 +292,8 @@ EXTRAINCDIRS += $(RTOSINCDIR)
EXTRAINCDIRS += $(APPLIBDIR)
EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, Modules/${MOD}/inc} ${OPMODULEDIR}/System/inc
# List any extra directories to look for library files here.
# Also add directories where the linker should search for
@ -480,6 +466,7 @@ REMOVE = $(REMOVE_CMD) -f
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
MSG_END = -------- end --------
MSG_MODINIT = "**** Generating ModInit.c:"
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after build:
MSG_LOAD_FILE = Creating load file:
@ -510,8 +497,8 @@ LSTFILES = $(addprefix $(OUTDIR)/, $(addsuffix .lst, $(ALLSRCBASE)))
# Define all depedency-files (used for make clean).
DEPFILES = $(addprefix $(OUTDIR)/dep/, $(addsuffix .o.d, $(ALLSRCBASE)))
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
elf: $(OUTDIR)/$(TARGET).elf
lss: $(OUTDIR)/$(TARGET).lss
sym: $(OUTDIR)/$(TARGET).sym
hex: $(OUTDIR)/$(TARGET).hex
bin: $(OUTDIR)/$(TARGET).bin
@ -535,6 +522,14 @@ endif
endif
${OUTDIR}/InitMods.c: Makefile
@echo ${MSG_MODINIT}
@echo // Autogenerated file > ${OUTDIR}/InitMods.c
@echo ${foreach MOD, ${MODNAMES}, extern unsigned int ${MOD}Initialize(void);} >> ${OUTDIR}/InitMods.c
@echo void InitModules() { >> ${OUTDIR}/InitMods.c
@echo ${foreach MOD, ${MODNAMES}, ${MOD}Initialize();} >> ${OUTDIR}/InitMods.c
@echo } >> ${OUTDIR}/InitMods.c
# Eye candy.
begin:
## @echo

View File

@ -85,7 +85,7 @@ char NmeaPacket[NMEA_BUFFERSIZE];
* \return -1 if initialisation failed
* \return 0 on success
*/
int32_t GpsInitialize(void)
int32_t GPSInitialize(void)
{
signed portBASE_TYPE xReturn;
// TODO: Get gps settings object

View File

@ -29,6 +29,6 @@
#ifndef GPS_H
#define GPS_H
int32_t GpsInitialize(void);
int32_t GPSInitialize(void);
#endif // GPS_H

View File

@ -30,13 +30,7 @@
#include "telemetry.h"
#include "GPS.h"
#include "systemmod.h"
#include "examplemodevent.h"
#include "examplemodperiodic.h"
#include "examplemodthread.h"
#include "manualcontrol.h"
#include "actuator.h"
#include "altitude.h"
#include "attitude.h"
/* Task Priorities */
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
@ -63,6 +57,9 @@ static void TaskSDCard(void *pvParameters);
int32_t CONSOLE_Parse(COMPortTypeDef port, char c);
void OP_ADC_NotifyChange(uint32_t pin, uint32_t pin_value);
/* Prototype of generated InitModules() function */
extern void InitModules(void);
/**
* OpenPilot Main function
*/
@ -134,15 +131,7 @@ void OpenPilotInit()
PIOS_I2C_Init();
/* Initialize modules */
TelemetryInitialize();
ExampleModPeriodicInitialize();
//ExampleModThreadInitialize();
//ExampleModEventInitialize();
GpsInitialize();
ManualControlInitialize();
ActuatorInitialize();
AltitudeInitialize();
AttitudeInitialize();
InitModules();
/* Create test tasks */
//xTaskCreate(TaskTesting, (signed portCHAR *)"Testing", configMINIMAL_STACK_SIZE , NULL, 4, NULL);