0

How can one determine the size of a stack frame for a function call at run time?

I could use CMSIS __get_MSP before and after the call and get the difference, but I would prefer to not require the caller to do anything before the call.

Knowing the frame sizes would allow deconstructing the stack which would be beneficial for analysing on a fault.

Kay
  • 123
  • 8
  • So, you want to use CMSIS functions? With gcc, you can use [these frame built-ins](https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html) are they in scope of an answer or will you change the question because of some unexpressed requirement? Ie, for 99% of functions, the compiler knows the answer and can supply it. – artless noise Jun 01 '23 at 14:40
  • This depends on which compiler you use and how it is tuned. – Johan Jun 01 '23 at 16:40

0 Answers0