# PIC24/dsPIC port: frame pointer ?

**URL:** <https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608>\
**Category:** Kernel\
**Created:** [October 6, 2012, 8:07pm UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608 "2012-10-06T20:07:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnadler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/dnadler/32/35_2.png) [@dnadler](https://forums.freertos.org/u/dnadler)\
**Post date:** [October 6, 2012, 8:07pm UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/1 "2012-10-06T20:07:25Z")

</div>

**[dnadler](https://sourceforge.net/u/dnadler/)** wrote on [Saturday, October 06, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#14ff):

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](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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [October 6, 2012, 8:12pm UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/2 "2012-10-06T20:12:00Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Saturday, October 06, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#01d7):

Sorry not to be of more help - but I can’t remember the details.&nbsp; 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.&nbsp; I know this is true of old ARM7 GCC versions where the frame pointer caused problems, whereas the latest ARM7 GCC versions are fine.&nbsp; As the PIC24 compiler is based on GCC, it might be true there too.

Reagrds.

---

<div class="post-metadata">

**Author:** ![dnadler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/dnadler/32/35_2.png) [@dnadler](https://forums.freertos.org/u/dnadler)\
**Post date:** [October 7, 2012, 12:40am UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/3 "2012-10-07T00:40:41Z")

</div>

**[dnadler](https://sourceforge.net/u/dnadler/)** wrote on [Sunday, October 07, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#77e2):

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

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [October 7, 2012, 12:53am UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/4 "2012-10-07T00:53:48Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Sunday, October 07, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#ed52):

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.

---

<div class="post-metadata">

**Author:** ![dnadler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/dnadler/32/35_2.png) [@dnadler](https://forums.freertos.org/u/dnadler)\
**Post date:** [October 9, 2012, 9:52pm UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/5 "2012-10-09T21:52:15Z")

</div>

**[dnadler](https://sourceforge.net/u/dnadler/)** wrote on [Tuesday, October 09, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#6060):

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

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [October 10, 2012, 2:45am UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/6 "2012-10-10T02:45:29Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Wednesday, October 10, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#eb21):

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.

---

<div class="post-metadata">

**Author:** ![dnadler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/dnadler/32/35_2.png) [@dnadler](https://forums.freertos.org/u/dnadler)\
**Post date:** [October 10, 2012, 11:57am UTC](https://forums.freertos.org/t/pic24-dspic-port-frame-pointer/5608/7 "2012-10-10T11:57:09Z")

</div>

**[dnadler](https://sourceforge.net/u/dnadler/)** wrote on [Wednesday, October 10, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/f9243550/#50c7):

Thanks for the clarification !  
Best Regards, Dave
