[Tinyos-devel] nesc.xml bitoffset error

WenZhan Song wenzhan.song at gmail.com
Tue Feb 5 09:38:05 PST 2008


We are using iMote2 platform with TinyOS-1.x and found the following
bit-offset problem in nesc.xml:

typedef struct tTestArray
 {
   uint8_t j;
 } tTestArray;

typedef struct tTestRPCStruct_New
  {
   tTestArray x1;
   tTestArray x2;
  } tTestRPCStruct_New;
 implementation{

tTestRPCStruct_New testRPCStruct_New;
.....
 debug(DBG_SNMS,"x1 address = %x\n", &(testRPCStruct_New.x1));
 debug(DBG_SNMS,"x2 address = %x\n", &(testRPCStruct_New.x2));
 debug(DBG_SNMS,"size of tTestArray = %x\n", sizeof(tTestArray));
....
}

 This is the result from Printf_UART
 x1 address = 5c006fe0
x2 address = 5c006fe4
The address difference is 4 bytes, that is *32* bits.

 But in nesc.xml, it shows that:
 <struct alignment="I:1" defined=""
loc="58:/home/ma/oasis/lib/TestSNMS/TestSNMSM.nc" name="tTestRPCStruct_New"
ref="0x2aaaac3e9538" size="I:2">
     <field bit-offset="I:0" name="x1" ref="0x2aaaac3e99f0" size="I:1">
       <type-tag alignment="I:1" size="I:1">
         <struct-ref name="tTestArray" ref="0x2aaaac3eded0" />
         <typename>
           <typedef-ref name="tTestArray" ref="0x2aaaac3ec928" />
         </typename>
       </type-tag>
     </field>
     <field bit-offset="*I:8*" name="x2" ref="0x2aaaac3e9aa0" size="I:1">
       <type-tag alignment="I:1" size="I:1">
         <struct-ref name="tTestArray" ref="0x2aaaac3eded0" />
         <typename>
           <typedef-ref name="tTestArray" ref="0x2aaaac3ec928" />
         </typename>
       </type-tag>
     </field>
   </struct>

The bit-offset of x2 shall be "*I:32*".  Could someone tell me how to fix it
ot which program generates the nesc.xml file?

Thanks.

WenZhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20080205/52d06974/attachment.htm


More information about the Tinyos-devel mailing list