[En-Nut-Discussion] arm-none-eabi-gcc, mtpcs-leaf-frame and cortex_debug.c

Ole Reinhardt ole.reinhardt at embedded-it.de
Thu Jul 23 01:56:21 CEST 2015

Hi Uwe,

this question is yet quite old, but let me answer anyway.

Am 30.03.2015 11:19, schrieb Uwe Bonnes:
> your patch:
>    Added experimental stack backtrace code, which can be enabled for
>     easier debugging exceptions.
> introduces -mtpcs-leaf-frame as compiler option.
> On Cortex-M0, this caused a compiler error. So I opened
> https://bugs.launchpad.net/gcc-arm-embedded/+bug/1390053
> This bug was pending for some time and asking again these days the response
> was a status change to: 	Confirmed → Won't Fix
>> We are going to deprecate all TPCS related options
>> https://gcc.gnu.org/gcc-5/changes.html. So please try not using them.
> Any ideas how to get around that?

Unfortunately not. As Cortex Mx CPUs do not have a dedicated frame
pointer which gets stacked on a function call, we are not able to do a
real stack backtrace. The problem is, that you do not know at which
position your last stack frame starts.

So my code tries to analyze the code to calculate back how many bytes
have been pushed to the stack since the start of the stack frame. But to
make this at least somewhat reliable, the code needs to have a very
clear structure (it has to create the needed stack layout, which is
forced when enabling -mtpcs-leaf-frame).

So if these options get depricated or removed, the backtrace code won't
work any more and I do not have an idea how to workaround this.

Best regards,


kernel concepts GmbH            Tel: +49-271-771091-14
Sieghuetter Hauptweg 48         Mob: +49-177-7420433
D-57072 Siegen

More information about the En-Nut-Discussion mailing list