> There is an AVR tool called stacktool by John Regher that computes the 
> maximum stack depth by analyzing the binary code: 
> http://www.cs.utah.edu/~regehr/stacktool/
> 
> I haven't used it myself, but it is a very cool approach. (It isn't 
> ported to the MSP430.)

Hi-

Also my stack tool hasn't been maintained for a while!  I recommend that 
you check out Bill McCartney's stack estimator:

  http://selab.csuohio.edu/dsnrg/stack-estimator/

This one is far simpler than mine and (I think -- I haven't tested it) 
already supports MSP430.  I am working to get Bill's tool, not mine, 
integrated into TinyOS -- simplicity is good.

Additionally, years ago I implemented a very simple AVR stack tool in Perl 
that could be ported to MSP430 in a matter of hours:

  http://www.cs.utah.edu/~regehr/stacktool/stlite.txt

The difference between this tool and Bill's is that his is flow 
insensitive and mine is flow sensitive.  The practical implication is that 
Bill's tool may be be wrong if gcc generates stack manipulation code 
outside of the function prologue/epilogue; alloca() would do this... not 
sure if it can happen otherwise.  My tool, on the other hand, fails to 
cope with jump tables.  Pick your poison :).

John Regehr

Reply via email to