[Tinyos-devel] Bug in AM.h in T2 release

Joe Polastre joe at polastre.com
Mon Nov 20 13:20:16 PST 2006


Actually, you could put this in ActiveMesssage as an __attribute((C))
function and then AM.h could simply use the __attribute((C)) name and
require that any radio that implements ActiveMessageC (or better yet,
that a Platform needs to specify its primary radio with
__attribute((C)) function) needs to include the __attribute((C))
function.

Personally, I'm lazy and don't want to do:

components ActiveMessageC;
Impl.AMPacket -> ActiveMessageC;
uses AMPacket;
if (call AMPacket.address() == 1) { }

when instead I could just say:

TOS_AM_ADDRESS == 1

for my primary radio which applies to 99.9% of the cases out there.

Then again, the problem that is being abstracted here is one that will
probably only occur once in my lifetime, so I can just make this
change for my tree...

-Joe

On 11/20/06, Philip Levis <pal at cs.stanford.edu> wrote:
> On Nov 20, 2006, at 12:09 PM, Joe Polastre wrote:
>
> > FYI,
> >
> > TOS_AM_ADDRESS will never get updated on a 'make platform reinstall'
> > command because it is statically compiled into the app.  See the
> > following from AM.h:
> >
> > #ifndef DEFINED_TOS_AM_ADDRESS
> > #define DEFINED_TOS_AM_ADDRESS 1
> > #endif
> >
> > enum {
> >  TOS_AM_GROUP = DEFINED_TOS_AM_GROUP,
> >  TOS_AM_ADDRESS = DEFINED_TOS_AM_ADDRESS
> > };
> >
> > A quick fix (proposed by Cory) is to #define TOS_AM_ADDRESS to
> > directly call the AM.address() function.
>
> This is intentional: you should never be using TOS_AM_ADDRESS, rather
> you should be calling AMPacket.address(). This is for cases when you
> have two radios which might have different AM addresses.  The #define
> will break whenever you have have an "as" on the interface.
>
> Phil
>


More information about the Tinyos-devel mailing list