I have a large number of methods written in C spread across multiple files and all of them create local variables (mostly structure instances). After compiling these with ARM EABI GCC compiler on Windows, I try to examine the .o object files using objdump.
arm-none-eabi-objdump.exe -f -p -h -x -d -s -t test.o > test.txt
My question is: How do I calculate/retrieve the peak stack memory used by a method?
None of the methods allocate any dynamically allocated memory using malloc. So, I hoped that this would be easier.
I need this because I need to compare the amount of memory used by each method when compiled with various optimization options. This is to check if any local memory optimization has been carried out. I also understand that for some local variables, the compiler may use registers. However, I just need to know whatever is the maximum stack memory required by a method or if there is a way to calculate it.