[Tinyos-help] about nescc

Kevin Klues klueska at gmail.com
Sat Dec 15 17:32:37 PST 2007


I'm confused as to what you are trying to do exactly.  Nesc wil remove
anycode that it see s as not really doing much of anything.  If you wre to
put some useful code in the body of your Clock.fire() event, then it should
not get optimized away....

To answer your question though, turning off nesc's dead code elimination on
a function by function basis can be done using the @spontaneous nesc
attribute.

See chapter 9 of the tinyos programming manual for details on using
attributes.
http://csl.stanford.edu/~pal/pubs/tinyos-programming.pdf

Kevin

On Dec 12, 2007 2:42 PM, Kecheng <kecheng at cecs.pdx.edu> wrote:

>  Hi
>
> I wrote a simple pragrom, I modify the blink example,
> I define the clock interrupt function SIG_OUTPUT_COMPARE0(); then in the
> Realmain I will want to call this function.  I suppose that when I call this
> function in the RealMain, then the Clock.fire will be signaled.
> Then I use nescc to convert the nesc file into c file, but I found the
> code
>   SIG_OUTPUT_COMPARE0() {
>     signal Clock.fire();
>   }
> was deleted by the compiler for optimization. Can anybody give me some
> help? or how can I close the nescc's optimization. Thanks
>
> HPLClock:
>
> module HPLClock {
>   provides interface Clock;
> }
> implementation
> {
>  ........
> **************************************************************
>   default event result_t Clock.fire() { return SUCCESS; }
>   SIG_OUTPUT_COMPARE0() {
>     signal Clock.fire();
>   }
> **************************************************************
> }
>
> RealMain:
> module RealMain {
> }
> implementation
> {
>  int main() __attribute__ ((C, spontaneous)) {
>   SIG_OUTPUT_COMPARE0();
>   }
>  }
> }
>
>  ------------------------------
>  Kecheng
> 2007-12-12
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
~Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20071215/533c91af/attachment.htm


More information about the Tinyos-help mailing list