Hi Urs,
let me thank you for your clear response. now, i can see the difference much
better.
actually, the main reason i asked about "packed attribute" is that; i found
a source code in tiny contrib ( TinyDiff application) where they use packed
attribute. and i wonna use this code in order to implement the Directed
Diffusion protocol but only for simulation purposes. and once i read the
hint, i got confused.

i would like to reply to "Tiny User" about "having some experience with
Tossim".... i am,  actually, new either with tinyOS and Tossim. i am trying
to implement a protocol using Tossim. so i am still learning.
but we can help each other, just send your problem and i'll see if i (or
someone else from the tinyOS Help list) can response.

best regards.


2008/4/14 Urs Hunkeler <[EMAIL PROTECTED]>:

> Hi Fatima,
>
> I think it's mainly a question of style. Often something starts as a
> simple test, and then all of a sudden the code is in some production release
> and everybody has forgotten about the little hack for testing purposes.
>
> Then again, why would you need the packet attribute anyways? The only
> reason I see for using the packet attribute (on TinyOS 1.x) is to actually
> ensure that all platforms put the data bytes at the same offset when
> transmitting data. So if you only use one platform (simulation), then the
> packed attribute is not necessary, and if you use multiple platforms
> (testing on real hardware) you should not use it :-)
>
> Cheers,
> Urs
>
>
> fatima zohra wrote:
>
> > hello,
> > thanks for both of you for your reply.
> > however, i'm still confused.
> > actually my code will be use for simulation with Tossim; i have no real
> > motes to implement. so, there is no precised platform to use.
> > is it still a problem to use this "packed attribute" only for simulation
> > purpose?
> >
> > Best Regards.
> >
> > 2008/4/14 Urs Hunkeler <[EMAIL PROTECTED]>:
> >
> >  Hi,
> > >
> > > I thought that the compiler for the MSP430 architecture would simply
> > > ignore the packet attribute.
> > >
> > > Even if the code executes on the motes, some compilers might ignore
> > > the
> > > packet attribute. This results in the packet format not being equal on
> > > all
> > > platforms, essentially meaning that motes from different platforms
> > > cannot
> > > communicate.
> > >
> > > In TinyOS 2.x the nx_ types were introduced (like nx_uint8_t) that
> > > should
> > > be used for packet structs. The nx_ types ensure the same endianeness
> > > and
> > > the same data packing for all platforms.
> > >
> > > Cheers,
> > > Urs
> > >
> > >
> > > Philip Levis wrote:
> > >
> > >  On Apr 13, 2008, at 7:32 AM, fatima zohra wrote:
> > > >
> > > >  hello,
> > > > > while reading the TinyOS programmation manual here, i came across
> > > > >  this important Hint :
> > > > >
> > > > > Programming Hint 14: Never, ever use the "packed" attribute.
> > > > >
> > > > >
> > > > > can anyone explain to me why is it so important to notice this
> > > > >  problem ?? is it a big issue if we use packed attribute ?
> > > > >
> > > > >  Because if you used the packed attribute, words will not
> > > > necessarily  be
> > > > aligned on word boundaries. Some architectures (such as the MSP430
> > > >  of Telos
> > > > nodes) require words be aligned on word boundaries, or return
> > > >  undefined
> > > > results. So if you use the packed attribute, you could have  code
> > > > that
> > > > cannot work correctly.
> > > >
> > > > Phil
> > > >
> > > >
> >
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to