# FreeRTOS under GCC with -O0 option

**URL:** <https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879>\
**Category:** Kernel\
**Created:** [September 4, 2006, 10:35pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879 "2006-09-04T22:35:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 4, 2006, 10:35pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/1 "2006-09-04T22:35:05Z")

</div>

**nobody** wrote on [Monday, September 04, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8):

has anybody compiled for arm7tdmi with -O0 option using gcc 4.1.1? My OS under at91sam7s256 still crashes without optimalization ☹

Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 4, 2006, 10:36pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/2 "2006-09-04T22:36:08Z")

</div>

**nobody** wrote on [Monday, September 04, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/ceed):

interesting links for trace/debug:  
[http://www.embedded.com/showArticle.jhtml?articleID=192202641](http://www.embedded.com/showArticle.jhtml?articleID=192202641)  
[http://www.l8night.co.uk/mwynn/gbadev/asmdocs/gba-arm-asm.html](http://www.l8night.co.uk/mwynn/gbadev/asmdocs/gba-arm-asm.html)

Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 5, 2006, 7:17am UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/3 "2006-09-05T07:17:04Z")

</div>

**nobody** wrote on [Tuesday, September 05, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/b248):

The makefiles for the LPC2000, AT91FR40008 and AT91SAM7X256 ARM7/GCC projects in the download use -O0, so it must be possible.

Using -O0 will make the code and stack useage greater.&nbsp; Is this the problem rather than the code gen?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 5, 2006, 12:08pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/4 "2006-09-05T12:08:20Z")

</div>

**[acehigh1971](https://sourceforge.net/u/acehigh1971/)** wrote on [Tuesday, September 05, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/7721):

I added the -fomit-frame-pointer option so the frame was not used when calling a function (indeed is not needed) and I can change the optim level without worrying.  
Can you test it?

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 6, 2006, 6:32pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/5 "2006-09-06T18:32:28Z")

</div>

**nobody** wrote on [Wednesday, September 06, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/3462):

You are my master!!! I have added and OS work with everthing with -O0 flag!!!

Thanks a lot!!!  
Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 6, 2006, 7:53pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/6 "2006-09-06T19:53:26Z")

</div>

**nobody** wrote on [Wednesday, September 06, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/728d):

with -O0 works fine  
with -O1 crashes (but it is no this reason -\> then gcc uses a lot of stack)  
with -O2 works fine

best regards  
Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 6, 2006, 8:16pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/7 "2006-09-06T20:16:39Z")

</div>

**nobody** wrote on [Wednesday, September 06, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/d4cb):

I was wrong, with -O2 can crash also bu -O0 is great:)

thanks again  
Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 6, 2006, 9:42pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/8 "2006-09-06T21:42:36Z")

</div>

**nobody** wrote on [Wednesday, September 06, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/4d13):

reason: -O2 causes more stack usage!

Janusz

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 21, 2006, 11:06pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/9 "2006-09-21T23:06:56Z")

</div>

**nobody** wrote on [Thursday, September 21, 2006](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/7721/bc05):

I was having issues with FreeRTOS 4.1.0, GNUARM 4.11 and the LWIP SAM7 demo package until the -fomit-frame-pointer was put into the makefile.&nbsp; The AT91SAM7X256 is running now.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 13, 2007, 9:15am UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/10 "2007-02-13T09:15:02Z")

</div>

**[tcwden](https://sourceforge.net/u/tcwden/)** wrote on [Tuesday, February 13, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/7721/d582):

I experienced the same problem with dsPic.

Does anybody know why Frame Pointer crashes with FreeRTOS? Is it because somehow both are pushing and popping the stack?

Cheers.

Dennis

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 13, 2007, 10:01am UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/11 "2007-02-13T10:01:17Z")

</div>

**nobody** wrote on [Tuesday, February 13, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/56cf):

Don’t suppose you’ve tried the webserver side of it have you?.. cos it’s not working here.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 13, 2007, 11:49am UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/12 "2007-02-13T11:49:37Z")

</div>

**nobody** wrote on [Tuesday, February 13, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/56cf/de9d):

Scratch that, my switch locked up. Sorry 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 13, 2007, 7:04pm UTC](https://forums.freertos.org/t/freertos-under-gcc-with-o0-option/4879/13 "2007-02-13T19:04:18Z")

</div>

**nobody** wrote on [Tuesday, February 13, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/d67ccb29/#47c8/7721/d582/8f61):

I think there is a bug in ARM7 GCC that holds the pointer in an invalid place for a few cycles.&nbsp; Search the forum for "-fomit-frame-pointer" and there is an explanation.&nbsp; It may even be in this thread.
