From e03e3c2ed8e99e5c5aa1a60eba4b9dff0f120705 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Fri, 11 Nov 2011 11:22:54 +0100 Subject: [PATCH] removed "special code" to start optional modules --- flight/CopterControl/System/coptercontrol.c | 6 ------ flight/Modules/System/systemmod.c | 5 ----- flight/OpenPilot/Makefile | 14 +------------- flight/OpenPilot/Makefile.posix | 16 ++-------------- flight/PiOS.posix/inc/pios_initcall.h | 12 ------------ flight/PiOS/inc/pios_initcall.h | 12 ------------ 6 files changed, 3 insertions(+), 62 deletions(-) diff --git a/flight/CopterControl/System/coptercontrol.c b/flight/CopterControl/System/coptercontrol.c index 41a30b9b1..7d4ca0627 100644 --- a/flight/CopterControl/System/coptercontrol.c +++ b/flight/CopterControl/System/coptercontrol.c @@ -73,12 +73,6 @@ int main() /* Initialize modules */ MODULE_INITIALISE_ALL - /* Optional module initialization. This code might want to go somewhere else as - * it grows */ - uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM]; - HwSettingsOptionalModulesGet(optionalModules); - MODULE_INITIALISE_OPTIONAL(optionalModules) - /* swap the stack to use the IRQ stack */ Stack_Change(); diff --git a/flight/Modules/System/systemmod.c b/flight/Modules/System/systemmod.c index 47c76816b..d5a6bfb12 100644 --- a/flight/Modules/System/systemmod.c +++ b/flight/Modules/System/systemmod.c @@ -138,11 +138,6 @@ static void systemTask(void *parameters) /* create all modules thread */ MODULE_TASKCREATE_ALL - /* create optional module threads */ - uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM]; - HwSettingsOptionalModulesGet(optionalModules); - MODULE_TASKCREATE_OPTIONAL(optionalModules) - // Initialize vars idleCounter = 0; idleCounterClear = 0; diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index 4701ed96d..cb989f2bc 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -481,22 +481,10 @@ endif endif # Generate intermediate code -gencode: ${OUTDIR}/InitOptMods.h - -$(SRC): gencode # this is supposed to be standard function, but apparently it is not uc = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) -${OUTDIR}/InitOptMods.h: Makefile - @echo ${quote}${foreach MOD, ${OPTMODULES}, int32_t ${MOD}Initialize(); }${quote} > ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, int32_t ${MOD}Start(); }${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}#define MODULE_INITIALISE_OPTIONAL(list) \${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, OPTMODULE_INIT(list, $(call uc, ${MOD}), ${MOD});}${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}#define MODULE_TASKCREATE_OPTIONAL(list) \${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, OPTMODULE_START(list, $(call uc, ${MOD}), ${MOD});}${quote} >> ${OUTDIR}/InitOptMods.h - - # Generate code for PyMite ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h: $(wildcard ${PYMITELIB}/*.py) $(wildcard ${PYMITEPLAT}/*.py) $(wildcard ${FLIGHTPLANLIB}/*.py) $(wildcard ${FLIGHTPLANS}/*.py) @echo $(MSG_PYMITEINIT) $(call toprel, $@) @@ -603,4 +591,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list gencode install +.PHONY : all build clean clean_list install diff --git a/flight/OpenPilot/Makefile.posix b/flight/OpenPilot/Makefile.posix index 161999ff0..352db440c 100644 --- a/flight/OpenPilot/Makefile.posix +++ b/flight/OpenPilot/Makefile.posix @@ -126,6 +126,7 @@ UAVOBJPYTHONSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/python # use file-extension c for "c-only"-files MODNAMES = $(notdir ${MODULES}) +MODNAMES += $(notdir ${OPTMODULES}) ifndef TESTAPP @@ -448,24 +449,11 @@ else quote = endif -# Generate intermediate code -gencode: ${OUTDIR}/InitOptMods.h - -$(SRC): gencode - # this is supposed to be standard function, but apparently it is not uc = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) # Generate code for module initialization -${OUTDIR}/InitOptMods.h: Makefile.posix - @echo ${quote}${foreach MOD, ${OPTMODULES}, int32_t ${MOD}Initialize(); }${quote} > ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, int32_t ${MOD}Start(); }${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}#define MODULE_INITIALISE_OPTIONAL(list) \${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, OPTMODULE_INIT(list, $(call uc, ${MOD}), ${MOD});}${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}#define MODULE_TASKCREATE_OPTIONAL(list) \${quote} >> ${OUTDIR}/InitOptMods.h - @echo ${quote}${foreach MOD, ${OPTMODULES}, OPTMODULE_START(list, $(call uc, ${MOD}), ${MOD});}${quote} >> ${OUTDIR}/InitOptMods.h - ${OUTDIR}/InitMods.c: Makefile.posix @echo ${MSG_MODINIT} @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c @@ -677,5 +665,5 @@ endif # 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 diff --git a/flight/PiOS.posix/inc/pios_initcall.h b/flight/PiOS.posix/inc/pios_initcall.h index f5f9ee875..f88081c33 100644 --- a/flight/PiOS.posix/inc/pios_initcall.h +++ b/flight/PiOS.posix/inc/pios_initcall.h @@ -31,8 +31,6 @@ #ifndef PIOS_INITCALL_H #define PIOS_INITCALL_H -#include "InitOptMods.h" - /** * Just a stub define to make things compile. * Automatically link based initialization currently doesn't work @@ -66,16 +64,6 @@ extern void StartModules(); /* Initialize the system thread */ \ SystemModInitialize();} -#define OPTMODULE_INIT(list,moduc,mod) \ - if(list[ HWSETTINGS_OPTIONALMODULES_##moduc ] == HWSETTINGS_OPTIONALMODULES_ENABLED) { \ - mod##Initialize(); \ - } - -#define OPTMODULE_START(list,moduc,mod) \ - if(list[ HWSETTINGS_OPTIONALMODULES_##moduc ] == HWSETTINGS_OPTIONALMODULES_ENABLED) { \ - mod##Start(); \ - } - #endif /* PIOS_INITCALL_H */ /** diff --git a/flight/PiOS/inc/pios_initcall.h b/flight/PiOS/inc/pios_initcall.h index 8b7ac7e47..e242989c0 100644 --- a/flight/PiOS/inc/pios_initcall.h +++ b/flight/PiOS/inc/pios_initcall.h @@ -31,8 +31,6 @@ #ifndef PIOS_INITCALL_H #define PIOS_INITCALL_H -#include "InitOptMods.h" - /* * This implementation is heavily based on the Linux Kernel initcall * infrastructure: @@ -79,16 +77,6 @@ extern initmodule_t __module_initcall_start[], __module_initcall_end[]; if (fn->fn_tinit) \ (fn->fn_tinit)(); } -#define OPTMODULE_INIT(list,moduc,mod) \ - if(list[ HWSETTINGS_OPTIONALMODULES_##moduc ] == HWSETTINGS_OPTIONALMODULES_ENABLED) { \ - mod##Initialize(); \ - } - -#define OPTMODULE_START(list,moduc,mod) \ - if(list[ HWSETTINGS_OPTIONALMODULES_##moduc ] == HWSETTINGS_OPTIONALMODULES_ENABLED) { \ - mod##Start(); \ - } - #endif /* PIOS_INITCALL_H */ /**