[Tinyos-help] Send Data "Hello Wold"

Michael Schippling schip at santafe.edu
Mon Jan 12 11:58:59 PST 2009


I think the pad/no-pad thing is probably a compiler level feature
and was most certainly for multi-byte objects on differing platforms.
(The OP's struct had an int16-int8-int16, which on some platforms
would have been layed out as int16-int8-padbyte-int16...or worse).
Given that nx_ types are byte arrays they don't need it and are
probably packed efficiently. Being an old guy I never trust that
new-fangled stuff and thus avoid it...but thanks for the info.

MS

Eric Decker wrote:
> 
> 
> On Mon, Jan 12, 2009 at 11:17 AM, Michael Schippling <schip at santafe.edu 
> <mailto:schip at santafe.edu>> wrote:
> 
>     There "used to be" a pad/no-pad option especially for this.
>     Are the nx_ types defined to always be no-pad?
> 
> 
> I've looked at the code generated and the nx_types are defined as arrays 
> of uint8_t.  Not sure
> how the pad no_pad used to work.  I suspect it is for multibyte objects 
> such as uint16_t etc.
> 
> But for the question originally asked int8_t were being asked about.
> 
> eric
>  
> 
> 
>     thx
>     MS
> 
>     Eric Decker wrote:
> 
> 
> 
>         On Mon, Jan 12, 2009 at 10:59 AM, Michael Schippling
>         <schip at santafe.edu <mailto:schip at santafe.edu>
>         <mailto:schip at santafe.edu <mailto:schip at santafe.edu>>> wrote:
> 
>            You could change datax to:  nx_uint8_t datax[14]
>            and then use a string or array copy to set it.
>            You've only got 28 or 29 bytes (depending on the
>            TOS version and standard settings) to play with
>            in your message, and the other fields add up to
>            14 bytes already...or perhaps more if the int8's
>            are padded -- in fact I would group those two
>            int8's together in the hopes that the compiler
>            will not pad them.
> 
> 
>         The compiler won't pad them. if they are bytes.
> 
>         eric
>          
> 
> 
> 
> 
> -- 
> Eric B. Decker
> Senior (over 50 :-) Researcher
> Autonomous Systems Lab
> Jack Baskin School of Engineering
> UCSC
> 

-- 
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew



More information about the Tinyos-help mailing list