I was trying to run PowerTOSSIM cpu cycle counting code on Cygwin, but It did not worked. I searched TinyOS help archieves but, could not
find any solutions. Here is what I did to get it working on Cygwin on my computer. It worked for me, I hope it works for you....
When I first tried to use PowerTOSSIM on cygwin, I was getting the following error.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/5.8/cygwin/C
wd.pm line 544, <> line 1.
: No such file or directory at /opt/tinyos-1.x/tos/../tools/scripts/PowerTOSSIM/
fixnames.pl line 26
fixnames.pl error
The contents of bb_line_tmp( in build/pc), the output of cilly.asm.exe, was
not what it supposed to be.. Here is what I had:
$ cat bb_line_tmp
Program too big to fit in memory
Then I tested cilly.asm.exe but it was giving the same output no matter how I executed it. The Same error---Program too big to fit in memory---
I checked out the latest snapshot of the TinyOS at www.tinyos.net, and downloaded the latest cilly.asm.exe from there and tried again, but I was still getting the same problem. So I decided to compile my own version of CIL and get my own version of cilly.asm.exe.
To compile my own version of CIL:
1- I downloaded the source of CIL from the link given at
http://www.eecs.harvard.edu/~shnayder/ptossim/install.html
I also modified the src/frontc/clexer.mll as described in there.
2-After making those changes, in order to add counter.ml module to CIL I followed the steps given on the following web page:
http://manju.cs.berkeley.edu/cil/cil006.html
After those steps, finally I got cilly.asm.exe working on cygwin. And the contents of the bb_line_temp made sense this time, here is the new contents of bb_line_temp:
1 C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/platform/pc/events.c:58
2 C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc:67
.....
....
But this did not solve my problem. I was still getting the same error.
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/5.8/cygwin/C
wd.pm line 544, <> line 1.
: No such file or directory at /opt/tinyos-1.x/tos/../tools/scripts/PowerTOSSIM/
fixnames.pl line 26
fixnames.pl error
it turns out that the problem was the regex in fixnames.pl "/^(\d+)\t([^:]*):(\d+)$/"
After I added print "$1 $2 $3\n" just after the ($bb, $file, $line) = ($1, $2, $3) statement, I did not got what I should have gotten.
In order to fix regex I added "." before "*" and this, finally, solved my problems....
"/^(\d+)\t([^:]*):(\d+)$/" => "/^(\d+)\t([^:].*):(\d+)$/"
Now, one more step needed to to make it run correctly.
Goto your mica2 directory and type the following command
avr-objdump -d -l make.exe
This one of the command PowerTOSSIM script bb2asm.pl is using.
If you see path starting with C: you need to modify bb2asm.pl. In my machine one of such path name was like
C:/PROGRA~1/UCB/cygwin/opt/tinyos-1.x/tos/interfaces/StdControl.nc:70
You need to strip C:/PROGRA~1/UCB/cygwin part. To do that I added:
the following lines:
elsif (/^C\:\/PROGRA~1\/UCB\/cygwin/){
$temp=$_;
$temp=~s!C\:/PROGRA~1/UCB/cygwin!!;
($cur_file, $cur_line) = split /:/, $temp;
}
To the part starting with "while(<OBJDUMP>) { "
Home