On Aug 19, 2010, at 8:57 PM, Xiaohui Liu wrote:
> Hi,
>
> The following appears in my header file.
> enum {
> SWS = 15,
> NUM_OF_QUANTILES = 4,
> LINK_MARKER_COUNTS = 11,
> };
> typedef struct neighbor_table_entry {
> am_addr_t ll_addr;
> uint8_t lastseq;
> uint8_t rcvcnt;
> uint8_t failcnt;
> uint8_t flags;
> uint8_t inage;
> uint8_t inquality;
> uint16_t eetx;
> uint8_t data_success;
> uint8_t data_total;
> } neighbor_table_entry_t;
>
> Till now, everything works as expected. However, after the blue part is
> appended to the structure definition to the following, which is the only
> change to my program, it's not working anymore. Then I append the red part
> and it goes back to normal. Can anyone help me understand what is going on? I
> guess this may be related to alignment and order issue. I've encountered
> several problems so far and every time I have to randomly change the order of
> some fields or add some padding bytes till it's working. Is there a rule
> regarding how a structure must be defined in TinyOS? Thanks.
There are no special rules. Chances are you have a memory access bug in your
program somewhere; adding the padding leads the compiler to place the structure
differently, such that you don't see the bug manifest.
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help