[En-Nut-Discussion] Configuration: Is there something like a "forced" macro?

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Oct 4 20:46:16 CEST 2012


>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:

    Harald> Hi Uwe, On 03.10.2012 23:37, Uwe Bonnes wrote:
    >> I miss a functionality in the configurator: Write out a macro name
    >> "XXX" if some requirement is fullfilled, even if "XXX" is _not_
    >> defined in the conf file.

    Harald> I'm not sure, if I understood your requirement. If not, please
    Harald> correct me.

    Harald> For example, the AT91 family is quite large and in order to
    Harald> avoid long ifdef lists, additional macros are generated by the
    Harald> Configurator.  Looking to the AT91SAM7X-EK board:

    Harald>  #define MCU_AT91SAM7X256

    Harald> is created by

    Harald>  MCU_AT91SAM7X256 = ""

    Harald> in the config file. Based on this, the Configurator additionally
    Harald> creates

Ah,  I learn something new every day. Have to revise how the STM32 *.nut
files when time allows

    >> forced_macro = "HW_BOARD_HEADER",
    Harald> ...
    >> #if defined(HW_BOARD_HEADER) #include HW_BOARD_HEADER #endif

    Harald> I kept symbols starting with HW_ exclusively reserved for
    Harald> hardware provisions/requirements in the Configurator. IMHO, this
    Harald> makes it easier to handle the large number of symbols in the
    Harald> configuration files, specifically with global searching. I never
    Harald> use macro names starting with HW_.

You critises the dummy implementation with dummy name, but you don't talk
about the proposes idea.

Here is the idea again:

I would like to have in the arch/<arch>.nut files, in the
"nutarch_<arch>_family clause
            {
                macro = "PLATFORM_HEADER",
                requires = { "PLATFORM" },
                brief = "Platform Board header",
                description = "String constant identifying the target \
                              hardware header used.\n\n",
                flavor = "integer",
                default = function() return \
         {"include/board/<arch>/"..string.lower(c_macro_edit("PLATFORM"))..".h" };
                                     end,
                file = "include/cfg/arch.h",
            },

That way we could get rid of all the inclusion on top of include/dev/board.h
and only have
#if defined(PLATFORM_HEADER)
#include PLATFORM_HEADER
#endif

People can then locally have any board.h file, without the need to edit
board.h. At the moment above code and similar formulations are ignored. I
stared at nutcomponent.c for some time, but didn't see any chance to
understand. 

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list