Using gcc eabi 8.2.1 for armv8-m (Cortex M33). Compiling with -fno-omit-frame-pointer does not seem to store the frame pointer in any register. Is this not supported for the armv8-m architecture? I don't see an explicit FP defined for that architecture, but could a register still be reserved and used as FP?
It depends on what instruction set the compiler is set to. For thumb instruction codes, it is R7. For ARM instruction codes it is R11. I am working with an Atmel Cortex M7 that is compiling into thumb instructions. Do a disassembly and see what register interacts with the SP register at the beginning of the function.
Thanks for the information, I will try to figure it out for more. Keep sharing such informative post keep suggesting such post.
BenefitWallet Login
There are some other compiler options you need to look for. -mapcs-frame or -mtpcs-frame. I used -mtpcs-frame for my Atmel Cortex M7 project compiled with thumb instructions.
I found in my project settings I also added -mtpcs-leaf-frame. I did not finish investigating all the effects that has. A leaf function is a function that does not call other functions. In that case, the compiler normally does not push the LR onto the stack frame. I made a disassembly of my code and the LR is still not pushed even with -mtpcs-leaf-frame with the GCC compiler used by Atmel Studio.
You need to be careful about pay attention to what compiler you are using compared does compared to other sources of information you read about the frame pointer. You could get different results.
Here are some tutorials I looked at when studying the frame pointer. Do try to dissasemble the C code in your development environment and see if you get the same or something different.
https://lloydrochester.com/post/c/stack-of-frames-arm/
https://azeria-labs.com/functions-and-the-stack-part-7/