I am using keil uVision4 for compiling the code. I found in the compiled code that for the nested functions all the working registers and LR is pushed on stack and popped back just before the return is executed. For non-nested functions the registers are not stored on stack. But I want that at every function entry, whether it be nested or not, these registers and LR to be saved on stack. How do I do it? What settings I have to do?
Thanks, Bharat
It isn't as likely, in an embedded environment, that you need to call code compiled with a different compiler.
The ABI basically dictates the preferred calling convention anyway.
But have the advantage that an exception handler can perform a walk of the stack all the way back to main()
If you're requiring that facility, then you'd normally be better off using the facilities provided by the compiler for such a purpose; and not try to just force a stack frame.
Except that there are environments when the official ARM ABI isn't used. But true - Keil don't have any reason to cater for them.
Not sure what "compiler facility" you are talking about. The comppiler either have - or do not have - a switch to enforce a stack frame. If it doesn't, then it's way harder to have an exception handler dump the stack. And it's likely you wnat that stack dump on a production unit out in field - not a unit with a special debug bouild. And not a unit in laboratory with debugger connected.
Except that there are environments when the official ARM ABI isn't used.
Maybe I'm too new to the ARM, but I've not heard of any (apart from pure assembler or hobbyist work).
Not sure what "compiler facility" you are talking about.
I was thinking about exception handling. With that the facility is enabled/disabled in it's entirety, stack frame and all.
I didn't talk about exceptions as in C++ exceptions, but the hw traps for invalid instructions etc.
About the ARM ABI: infocenter.arm.com/.../index.jsp
For that I'd concur with what you say. It's not going help the OP in getting his desired answer though. I can't find any facility to force the stack frame.