Configuration of Boards and Pins

From Ethersex_Wiki
Revision as of 12:30, 1 May 2012 by Tkaltenbrunner (talk | contribs) (meta.m4)
Jump to: navigation, search

Intro

This page will explain some of the details behind menuconfig. It is meant for developers who want to look behind the curtain or if someone wants to debug a modul which does not work or compile any more ....

make menuconfig

May be someone can explain how to add or extend the menuconfig system - here a look at the results and the output of menuconfig.

The configuration is saved in two different formats:

  • file .config for the menuconfig itself -
    • it is used for including it into the makefile
    • definition auf makefile variables
  • file autoconfig.h -
    • it is for including it in the compilation
    • definition of C preprocessor macros and defines

I thing the details of the configuration should become clear after doing the menuconfig and reading about the modules. May be I can explain some "core" configuration later.

make

The first steps in the build process are to get all the configuration information and build some source files which put it all together. Besides some usual unix tools like sed the m4 macro processor plays an important role. Even if it is not in the scope of this wiki, I added a very short intro here: m4 - very short intro

meta.m4

If you have look at the different source codes of the modules, you find at the bottom of the main c-file a comment section starting with "-- Ethersex META --".

You find there m4 macros which are used to integrate the modul into the main program of ethersex. Details later.

meta.m4 is the extraction and collection of these sections.

The files which are used, are denfined by the makefile of each "module". Each C source files has to be added to the make var "y_SRC".

A nice trick is used there by the use of ".config", where all the used and configured feature are assigned a "y" to make vars. i.e.

MODULX_GENERAL_SUPPORT=y

Then in the makefile of ModuleX:

$(MODULX_GENERAL_SUPPORT)_SRC += file1.c file2.c ...

If the module is not activated the files added to _SRC instead of y_SRC.

meta.c

Is generated by m4 macros.

The inputs are: (controlled centrally in the Makefile!)

  • autoconfig.h
    is converted and each define line results into one m4 command line parameter of the form -Dconf_<parname>
  • scripts/meta_magic.m4
    contains the framework for meta.c
  • protocols/ecmd/ecmd_magic.m4
    only if ECMD parser support is activated - make var $(ECMD_PARSER_SUPPORT) must be set to "y"
  • protocols/soap/soap_magic.m4
    only if SOAP support is activated - make var $(SOAP_SUPPORT) must be set to "y"
  • meta.m4
    see above
  • protocols/ecmd/ecmd_defs.m4
    only if ECMD parser support is activated - make var $(ECMD_PARSER_SUPPORT) must be set to "y"
  • files referenced thru the make var ${named_pin_simple_files}
    only if ECMD parser support is activated - make var $(ECMD_PARSER_SUPPORT) must be set to "y"
  • files referenced thru the make var $(y_NP_SIMPLE_META_SRC)
    unconditional ... but contain the following files, if ECMD parser or SOAP support is activated:
    • protocols/ecmd/ecmd_defs.m4
    • ${named_pin_simple_files}
    so I think it could be a small bug - if ECMD parser support is on, the files are added twice - may be this does not matter.

pinning.c

meta.h