I'm writing a bare metal application in ARMv7 using the AAPCS ABI with GCC 6.2 and I having some issue debugging processor faults in leaf functions.
The debugger (gdb) cannot display a proper stack trace because LR is not saved to the stack when the function is a leaf function.
Is it possible to force GCC to add LR to the stack for all functions, and not optimize this away in leaf functions?