How much stack?

robert
2008-12-19
2013-03-12
  • robert
    robert
    2008-12-19

    Is there any way to get more information about how much resources my program is using?  E.g. I would like to know how much stack I am using.  I want to be able to manage my stack usage rather than just find out the hard way that  ran out.

     
    • egyptfireman
      egyptfireman
      2008-12-20

      Try putting a routine at the beginning of your program that does a ram memory dump where the new stack area will occupy. Then clear out that area. After that do your normal code. When you run your program the second time you will see how far the stack went assuming no power down etc. Kind of crude but it works.

       
    • robert
      robert
      2008-12-20

      yeah I basically did that, padded it with 0x55 - I was thinking there was a better way though.  Especially if you have high priority interrupts, it will be difficult to get to the deepest possible stack.  If there was some data collected during build about how much each procedure uses, then it would be easy to add that to the worst case interrupt combination.