[Tinyos-help] Preprocessor defines for platform detection
?????????
o-rodrig at rapapaing.com
Tue Apr 28 20:34:22 PDT 2009
Hello,
I am trying to port my TinyOS 2.0 program, which was designed to work on
MICAz motes, to IRIS motes. Around 90% of the code is multi-platform,
but I'm also doing some platform-specific things with the radio chips.
I have clearly identified the sections of code that are
platform-specific and I have now written code for the IRIS platform. Now
all I need is a way to detect the platform I'm building for, via
preprocessor, and conditionally compile the platform-specific code for
each platform.
However, I have not found a way to reliably detect the platform I'm
currently building for. I have also checked the manuals, tutorials and
the mailing list, but have found very few information on how to make
portable code.
I think that simply adding to support/make/iris.target, something like:
CFLAGS += -DPLATFORM_IRIS
and doing the same for all platforms could solve this problem.
I am, however, not doing this because I would like my code to build with
the offical version of TinyOS.
Is there a way to check for the platform that I'm building for that I am
not aware of? If not, I would like to know your comments for this issue.
Best regards,
Oscar Rodriguez
More information about the Tinyos-help
mailing list