Difference between revisions of "Configuration of Boards and Pins"

From Ethersex_Wiki
Jump to: navigation, search
(make menuconfig)
m (meta.m4)
Line 27: Line 27:
  
 
=== meta.m4 ===
 
=== 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 --".  
+
If you have a 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.
 
You find there m4 macros which are used to integrate the modul into the main program of ethersex. Details later.

Revision as of 18:27, 17 May 2012

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

Integration of modules into menuconfig look is described on this page Own module#Menuconfig - 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
    • it incluences also the build process of the binary file
    • 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 a 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 by 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 by 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.

What is in ${named_pin_simple_files}?

That should be a chapter for itself - containing how the internals of defining pins works.

In the default case that are probably the following files:

  • core/portio/np_simple.m4
  • protocols/ecmd/np_simple_glue.m4

meta.h

is also generated from m4 macros.

Files used:

  • scripts/meta_header_magic.m4
    framework of meta.h and macros.
  • meta.m4

meta.m4 is part of meta.c and meta.h - how is it possible, may someone ask. The answer: macros, which are not defined, eval to empty string. So it depends on the defined macros to what meta.m4 is expanded.

More about the he interesting concept of meta.

pinning.c

The detailied concept of pinning will be descriped in an own chapter.

At the moment is important to know that each processor has several ports which can have different functions and are connected sometimes to devices on the board already. If you connect your own hardware to the board which should be supported by an ethersex module you must configure the port(s) which are connects the hardware with the processor.

Files from which pinning.c is build:

  • pinning/internals/header.m4
  • pinning/controllers/<mcuname>.m4
    mcuname is defined by make var MCU
  • pinning/internals/hackery_<mcuname>.m4
  • pinning/hardware/<boardname>.m4
    <boardname> is definned by make var HARDWARE
  • pinning/internals/footer.m4
  • autoconfig.h
    is converted and each define line results into one m4 command line parameter of the form -Dconf_<parname>

What you should realize is, the pinning.c file is independent from any module, so the connection of module and pinning must be defined in one of the mentioned files!