[En-Nut-Discussion] nutconf and platform macros (-DETHERNUT2) suggestion
Henrik Maier
hmlists at focus-sw.com
Wed Feb 23 00:33:06 CET 2005
Hello!
Since the introduction of nutconf we have now a very versatile concept
of configuring Nut/Os for the various platforms.
But besides the OS itself there is also the occasion where application
code needs to be platform specific and this is typically done by
conditional compilation sections based on preprocessor macros. Example
is "#ifdef ETHERNUT2".
If one compiles and configures Nut/OS for the Ethernut 1.3 board, the
demo applications will be compiled for the Ethernut2 board because of
HWDEF += -DETHERNUT2 which is put into UserConf.mk by nutconf.
To overcome this issue I suggest that each .conf file can contain a
platform macro definition entry which then is put into the makefiles and
eventually passed on to the compiler.
For example the files ethernut13f.conf and ethernut13g.conf could
contain the following line:
HWDEF = "-DETHERNUT1"
and ethernut20a.conf could contain:
HWDEF = "-DETHERNUT2 -DETHERNUT20A"
and ethernut21b.conf could contain:
HWDEF = "-DETHERNUT2 -DETHERNUT21B"
etc.
nutconf then could use this entry and write it as it is to the generated
makefiles.
Henrik
--
FOCUS Software Engineering Pty Ltd
Brisbane, Australia - Web: www.focus-sw.com
Phone: +61-402 970 933 - Fax: +61-7-3009 0399
More information about the En-Nut-Discussion
mailing list