Archive for January, 2012

Symbol Table Manipulation in TinyOS

Monday, January 9th, 2012

I realized one of the hacks we had used in our testbed is of use to other researchers as well. When running an experiment using MEMSIC Motes, it is possible that you need a large number of images which only differ in some variable values. For example, only the variable indicating start time for each of them is different.

Instead of changing the variable and recompiling, you can do the following. Declare your desired variable(s) as

extern const uint8_t myVar;

After compiling the main image, take a look at your symbol table by typing

 tos-set-symbols --read /path/to/main.exe

This will show a table like following:

AMQueueImplP__0__current             :  01  [.]  (1)
AMQueueImplP__1__current             :  01  [.]  (1)
ActiveMessageAddressC__addr          :  01 00  [..]  (1)
ArbiterP__0__resId                   :  01  [.]  (1)
CC1000RssiP__currentOp               :  04  [.]  (4)
CC1000SendReceiveP__BIT_CORRECTION   :  1b 1c 1e 20 22 24 26 28  [... "$&(]
CC1000SendReceiveP__rxBufPtr         :  5c 02  [\.]  (604)
CC1000SquelchP__clearThreshold       :  20 01  [ .]  (288)
MyModule__myVar              :  00 00  [..]  (500)
SerialDispatcherP__0__messagePtrs    :  fb 02 2a 03  [..*.]  (53084923)
SerialDispatcherP__0__receiveBuffer  :  fb 02  [..]  (763)
SerialDispatcherP__0__recvType       :  ff  [.]  (255)
TOS_NODE_ID                          :  01 00  [..]  (1)
atm128_stdout                        :  00 00 00 02 00 00 00 00 fb
00 00 00 00  [..............]
Now you can set the value of corresponding variable in the symbol table using the following command:
tos-set-symbol /path/to/main.exe MyModule__myVar=1234

This allows you to directly set the value of your desired variable. Just be careful, as any programmer should be, about variable types.
tos-set-symbols is part of the avr-gcc environment, and uses avr-objdump.

Initially we used this method to generate new images with different node IDs (TOS_NODE_ID variable) from the same base image. Now our testbed’s web based interface allows the user to draw a topology visually and assign such variable values to each of the nodes. It can also automatically map your desired topology to available nodes in the testbed.

Recent Posts

  • what did you do in your Ph.D. again?

    May 7th, 2012 Recently I was asked to provide an overview of what I did through my Ph.D. in UTD. Although my research work is mostly
  • Quick note about Ubuntu

    February 10th, 2012 Five or six years ago LDAP had an issue in using SSL for NSS and pam.d authentication. As a result you had to use NSCD
  • Symbol Table Manipulation in TinyOS

    January 9th, 2012 I realized one of the hacks we had used in our testbed is of use to other researchers as well. When running an experime
  • Finals week in Austin

    December 11th, 2011 Nice view :) Thank goodness I don't have exams anymore
  • Google: Engineers vs. Brand Loyalty

    December 4th, 2011 Almost a month ago Google changed its Google Reader product by removing one of its core features: social sharing. This