mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
removed "special code" to start optional modules
This commit is contained in:
parent
5e14e69a08
commit
e03e3c2ed8
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
/**
|
||||
|
@ -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 */
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user