[En-Nut-Discussion] STM32: arm-gcc versus arm-none-eabi-gcc
Ulrich Prinz
uprinz2 at netscape.net
Wed Apr 27 22:19:25 CEST 2011
Hi again,
just to complete the things here, while knowing that you already managed
to compile the system:
> However: Is arm-gcc the right compiler for the STM32?
>
> Thinking longer, arm-gcc is probably for the ARM variant used in
> AT91SAM3 and I need arm-none-eabi-gcc for STM32/Cortex3. Can anybody
> confirm?
arm-none-eabi- or arm-elf- is the right toolchain. I think somewhere
around 4.3.x Cortex support has been added to arm-x-gcc. The right code
is generated with:
-mcpu=cortex-m3
for the right instruction set
-mthumb
as Cortex has a superset of ARM and thumb combined into one
thumb instruction set.
-mlittle-endian
is clear I hope
-mfix-cortex-m3-ldrd
to ship around a bug in the Cortex core
-D__CORTEX__
is needed by Nut/OS as the compiler does not give any other way to
distinguish between ARM and Cortex.
>
> This is probably what Ulrich tried to tell me with "You should try
> to compile with cm3-gcc"
>
Yes, it is. The problem was not your compiler, it was the fact, that
Make*.arm-gcc doesn't have the right compiler flags set for Cortex.
It's all in the Makefiles... I thought I get dump while figuring out how
these are chained into each other.
Another note on the compiler version:
If you read the errata sheet from STM, there is mentioned that the
Cortex Core sometimes doesn't survive the optimizations gcc and other
compilers generate. The result are unpredicted hardfaults or busfaults.
I stumbled across them myself. While STM urges you to use an older
version, I did lots of tests with the latest gcc-4.6.0. With the above
-mfix-cortex-m3-ldrd enabled now several hundreds of hours of test time
where survived by many different modules without problems.
Ulrich
More information about the En-Nut-Discussion
mailing list