When I give the Keil compiler the \"--callgraph\" option, it statically calculates the exact \"Maximum Stack Usage\" for me.
Alas, today it is giving me a \"Maximum
Use the --info=stack in the linker option. The map file will then include a stack usage for all functions with external linkage.
In a single tasking environment, the stack usage for main() will give you the total requirement. If you are using an RTOS such as RTX where each task has its own stack, then you need to look at the stack usage for all task entry points, and then add some more (64 bytes in the case of RTX) for the task context storage.
This and other techniques applicable to Keil and more generally are described here