Hi, the network types are nx_XXXX or nw_XXXX ? http://nescc.sourceforge.net/networktypes/network-types.txt
thanks, -Bill > The msp430 requires 16-bit aligned addresses for 16-bit operations. > > In the MSP430 x1xx User's Guide, Section 1.4.5 RISC 16-bit CPU, > Instruction Set, Memory Organization, > > "Bytes are located at even or odd addresses. Words are only located at > even addresses as shown in Figure 1-3. When using word instructions, > only even addresses may be used. The low byte of a word is always an > even address. The high byte is at the next odd address." > > In the MSPGCC Manual in section "Byte and word issues" > http://mspgcc.sourceforge.net/manual/x214.html: > > "Word operands must be located at even addresses. ... The processor's > behaviour when a word is accessed at an odd location is poorly > documented. In all current processors the lower bit is just silently > ignored. The effect is, therefore, the same as specifying an address > which is one less." > > This is why the packed attribute is very, very bad for the msp430. > Your 32-bit args value is placed at an odd-value address with the > packed attribute. When given that odd address, the msp430 quietly > converts it to the next lower even address, thus overwriting your type > variable. > > If your structure must be 5 bytes and byte aligned, use nesC's network > types (nx_uint8_t, nx_uint32_t, etc) and leave out the packed > attribute. > > Cory > > On 2/17/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I have a problem when using __attribute((packed)) for a struct under >> msp430 (telosb). >> This is the struct I have >> >> typedef struct{ >> uint32_t interval; >> }start_args_t; >> >> typedef struct{ >> uint32_t time; >> }set_time_args_t; >> >> typedef struct{ >> uint8_t type; >> union{ >> start_args_t startArgs; >> set_time_args_t setTimeArgs; >> }args; >> }Cmd_t __attribute((packed)) ; >> >> Without the "packed" attribute the struct has a sizeof 6 and padding in >> this way >> >> type 1 byte >> 0x00 padding byte >> args 4 bytes >> >> With the "packed" attibute the struct has a sizeof 5, but the variable >> type and the args starts at the same address. I mean that if I set first >> the args and then the type field, I am rewriting the LSB of the args >> field. >> >> If I change the struct to this one >> >> typedef struct{ >> union{ >> start_args_t startArgs; >> set_time_args_t setTimeArgs; >> }args; >> uint8_t type; >> }Cmd_t __attribute((packed)) ; >> >> The "packet" attribute behaves well. It seems like if the odd field are >> at >> the end of the struct de packing behaves well. >> >> I wonder if this a compiler related bug or I am missing something. >> >> thanks in advance, >> >> -Bill >> >> _______________________________________________ >> Tinyos-help mailing list >> [email protected] >> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >> > _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
