This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compute Stack Size require for application

dear all,

How to compute maximum Stack Size require for specific application?

Is Keil compiler specify Stack Size require for application after linking operation?

Regards...

Yogesh

Parents
  • I'd dearly love for a compiler to give me a stack size, and identify the critical path through the call tree. It is not possible always to give a complete answer (consider recursion), but a compiler can certainly do most of the work and provide total usage for the main call tree, each interrupt, and so on. C51 is already most of the way there thanks to its overlay analysis. It just needs to output the results.

    But I've never used a tool that does this.

    You can either go through the code and add up stack sizes by hand. Or, another common method is to fill the stack area with a known pattern, run the code, and see how much got overwritten. This latter method assumes your test suite actually puts the code through its worst-case stack usage, which may not be true.

    If you're making good use of the overlay feature, then much of the "stack" is determined at compile time. You can find this memory usage in the map file, and it is reflected in the total size of data / xdata reported by the compiler.

Reply
  • I'd dearly love for a compiler to give me a stack size, and identify the critical path through the call tree. It is not possible always to give a complete answer (consider recursion), but a compiler can certainly do most of the work and provide total usage for the main call tree, each interrupt, and so on. C51 is already most of the way there thanks to its overlay analysis. It just needs to output the results.

    But I've never used a tool that does this.

    You can either go through the code and add up stack sizes by hand. Or, another common method is to fill the stack area with a known pattern, run the code, and see how much got overwritten. This latter method assumes your test suite actually puts the code through its worst-case stack usage, which may not be true.

    If you're making good use of the overlay feature, then much of the "stack" is determined at compile time. You can find this memory usage in the map file, and it is reflected in the total size of data / xdata reported by the compiler.

Children
No data