# STM32F4 + GCC compilation problems

**URL:** <https://forums.freertos.org/t/stm32f4-gcc-compilation-problems/3457>\
**Category:** Kernel\
**Created:** [December 8, 2012, 12:29am UTC](https://forums.freertos.org/t/stm32f4-gcc-compilation-problems/3457 "2012-12-08T00:29:38Z")\
**Posts on this page:** 3\
**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:** [December 8, 2012, 12:29am UTC](https://forums.freertos.org/t/stm32f4-gcc-compilation-problems/3457/1 "2012-12-08T00:29:38Z")

</div>

**[blackswords](https://sourceforge.net/u/blackswords/)** wrote on [Saturday, December 08, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/9abf4160/#76b9):

Hi,

I just got the STM32F4 discovery board and I wanted to try it out. I started with some led blinking and everything was working fine so I tried to compile a FreeRTOS project and I have some errors about not allowed instructions…

I’m using Yagarto with Eclipse on OS X. These are the errors I get :

```
instruction not allowed in IT block -- `msr psp,r0'
instruction not allowed in IT block -- `stmdb r0!,{r4-r11,r14}'
selected processor does not support Thumb mode `vldmiaeq r0!,{s16-s31}'
selected processor does not support Thumb mode `vstmdbeq r0!,{s16-s31}'

```

my compiler flags : -c -mthumb -mcpu=cortex-m4  
my linker flags : -T “…/stm32\_flash.ld” -mthumb -mcpu=cortex-m4 -Wl,-Map=linker.map -Wl,-cref -Wl,-gc-sections  
my assembler flags : -mthumb -mcpu=cortex-m4 -g -Wa,-warn -x assembler-with-cpp

Does anyone have an idea to get rid of these errors?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 8, 2012, 7:33pm UTC](https://forums.freertos.org/t/stm32f4-gcc-compilation-problems/3457/2 "2012-12-08T19:33:55Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Saturday, December 08, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/9abf4160/#32c1):

These would be a typical set of options (assuming FPU is present and being used) for a new ARM GCC build. I don’t know which version Yagarto uses

-c -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -std=gnu90 -O0 -ffunction-sections -fdata-sections -g -Wall

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [December 9, 2012, 1:56pm UTC](https://forums.freertos.org/t/stm32f4-gcc-compilation-problems/3457/3 "2012-12-09T13:56:34Z")

</div>

**[blackswords](https://sourceforge.net/u/blackswords/)** wrote on [Sunday, December 09, 2012](https://sourceforge.net/p/freertos/discussion/382005/thread/9abf4160/#57e9):

Thanks, that’s working great with these flags!
