In T1 the platform/harware.h files have a define to prevent multiple inclusions, e.g.: TOSH_HARDWARE_MICA2, that you might be able to use if, as I suspect, there is no formal method.
However the more TOSish way to deal with the problem is to put platform dependent files in the individual porting directories. MS Rodriguez Oscar wrote: > 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 > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
