Hi,
I am trying to simulate some applications using TOSSIM. I have followed all
the steps of TOSSIM tutorial on tinyos website. I have successfully compiled
the codes for Tossim and it is working fine. I can extract all the
information I like using the debug commands. But I had a problem with
Variable Inspection in Tossim.
for non generic components the values are easily extracted by the command
t.getNode(i).getVariable("C.V") but the issue is with the generic
components. I am aware that on tinyos website it has been mentioned that for
the generic components the instance number of the component should be
mentioned as C.N.V
I have one timer in my application and I would like to get the value of one
of its variables by Tossim, I also know that the instance number for this
timer is 0. So I used the following commands:
m=t.getNode(10)
l=m.getVariable("VirtualizeTimerC.0.m_timers")
the result I got:
Could not find variable VirtualizeTimerC$0$m_timers
Allocated variable VirtualizeTimerC$0$m_timers
I spent couple of hours digging into TOSSIM library. Also I tried to look at
the app.c file to see what variables have been defined for my application,
this part of the code is interesting in app.c:
/* Module VirtualizeTimerC$0 */
if (!strcmp(varname,
"/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers"))
{
*addr =
(uintptr_t)&/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[__nesc_mote];
*size =
sizeof(/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[__nesc_mote]);
return 0;
}
The problem is that the name of the variable is mentioned as
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers instead of
VirtualizeTimerC$0$m_timers and the point is that all the dots in
getVariable("C.N.V") will be converted into $, so the name of the variable
is not allowed to have "."
To solve the issue, I changed the Tossim.c file in /tos/lib/tossim and I
converted this part into comments:
for (int i = 0; i < sLen; i++) {
if (realName[i] == '.') {
realName[i] = '$';
}
}
After doing so The variable is allocated successfully in Tossim but the
value is wrong (it shows "\x00\x00" as the result), even after this change
it doesn't work properly for non-generic components (they also give
"\x00\x00").
I tried to understand exactly where the name of the variables are extracted
by the compiler and where this term " /*HilTimerMilliC.VirtualizeTimerC*/ "
is created in app.c but I was not successful in troubleshooting the problem,
I wonder if anyone has successfully inspected a variable in a generic
component by Tossim? The version of the Tossim.c I am using is v1.7 and I
have got the source codes from
http://tinyos.cvs.sourceforge.net/viewvc/tinyos/, is there any newer version
available somewhere?
I guess "Nido variable resolver function" in app.c is created by the make
process using ncc command, I guess if we were able to prevent
/*HilTimerMilliC.VirtualizeTimerC*/ and similar terms from being written in
app.c and also probably sim.o, the problem will be solved ?
Sorry for the long email,
I am looking forward for your help
Regards,
Hamid Rafiei Karkvandi
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help