PIC24/dsPIC port: frame pointer ?

dnadler wrote on Saturday, October 06, 2012:

Hi - Richard’s instructions for this port say the ‘Omit Frame Pointer’ option within the MPLAB C30 optimisation dialogue must be checked:
http://www.freertos.org/portpic24_dspic.html
Unfortunately this option causes the debugger not to function sensibly (can’t see local variables or function arguments).
I did a test and leaving this unchecked - all seems to work OK.
Before I dig deeper, any quick hint as to why this option might really be necessary ?
Thanks as always,
Best Regards, Dave

rtel wrote on Saturday, October 06, 2012:

Sorry not to be of more help - but I can’t remember the details.  The port was written a long time ago, and it might be that the version of the compiler used now no longer requires the frame pointer to be omitted.  I know this is true of old ARM7 GCC versions where the frame pointer caused problems, whereas the latest ARM7 GCC versions are fine.  As the PIC24 compiler is based on GCC, it might be true there too.

Reagrds.

dnadler wrote on Sunday, October 07, 2012:

OK, I’ll dig further and report back.
Thanks Richard !
Best Regards, Dave

richard_damon wrote on Sunday, October 07, 2012:

I believe the problem went away when the vPortYeid function was changed from C with inline assembly to pure ASM. I think that the problem was that the way the optimization worked, not using it created wrong code here. I seem to remember that from a few years ago.

dnadler wrote on Tuesday, October 09, 2012:

Hi Richard - I read port.c and can’t find any reason the frame-pointer should cause problems. Testing with the frame-pointer in place shows no issues that I can find anyway (on PIC24F). As omitting the frame pointer makes debug impossible, I suggest removing this recommendation - your thoughts ?
Thanks,
Best Regards, Dave

richard_damon wrote on Wednesday, October 10, 2012:

When I first started using the PIC24/dsPic port about 5 years ago, port.c had the code for portYield using inline assembly. As I remember it was really only port.c that needed to have the option set for, the rest of the code could use the frame pointers.
Shortly after that, a new version came out that put portYield as assembly, and I thought that got around the problem. I forget exactly what was the real source of the issue, I think it was a GCC bug with frame pointers (since mplab was based on GCC), and with that routine converted to assembly, the bug couldn’t bite.

dnadler wrote on Wednesday, October 10, 2012:

Thanks for the clarification !
Best Regards, Dave