In general, once you pass a message pointer to a send or return it from a receive you say "it's yours, I'm not going to use it anymore" (until you give it back). This allows re-using the same data over and over again (because the same pointers are just passed back and forth). By-and-by, the pointer returned from the receive will be used again to store newly received data (it might be on the next receive, but if a the receive interface uses a queue, it might not be.)
So, to get to the skinny: 1) The pointer (location) returned MUST NOT be on the stack. If it is, "bad things" will happen with mangling and all that. 2) Do not muck with the data referred to by the returned pointer. You can use the data reference by the pointer only up until you return from the receive. Better have it extracted in any tasks, etc. You can maintain buffer rings, but it is likely easies just to memcpy it out (and generally much less error prone). HTH, Paul _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
