EmbeddedRelated.com
Forums

ARM Cortex M3 compilers - gcc vs arm-cc ?

Started by Mike June 27, 2012
Hi,

Can anyone tell me the pros and cons of gcc vs the arm-cc compiler for
ARM Cortex M3 development?  I understand that the ARM compiler always
used to be said to give smaller code size with the downside that it
cost a bit more but can anyone tell me whether that is still true in
2012 ?

How do they compare on execution speed ?  My application is power
sensitive and increased execution speed might pay for a clock speed
reduction which could save power so that would be an issue.

Issues like debugger and IDE support are bigger with me than code size
and things like standards compliance are also important,  also whether
there are other snags / advantages of one against the other would be
of interest.

Many thanks,

Mike
> Can anyone tell me the pros and cons of gcc vs the arm-cc compiler for > ARM Cortex M3 development? I understand that the ARM compiler always > used to be said to give smaller code size with the downside that it > cost a bit more but can anyone tell me whether that is still true in > 2012 ?
Don't know about arm-cc, but it is definitely true for gcc vs IAR. IAR has a free download (limited to 32 kbytes codesize), so you could just try both. Leo Havm�ller.
On Wed, 27 Jun 2012 12:53:36 +0200, Leo Havmøller wrote:

>> Can anyone tell me the pros and cons of gcc vs the arm-cc compiler for >> ARM Cortex M3 development? I understand that the ARM compiler always >> used to be said to give smaller code size with the downside that it >> cost a bit more but can anyone tell me whether that is still true in >> 2012 ? > > Don't know about arm-cc, but it is definitely true for gcc vs IAR. IAR > has a free download (limited to 32 kbytes codesize), so you could just > try both.
So, which do you feel is better? -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
> Don't know about arm-cc, but it is definitely true for gcc vs IAR. IAR > has a free download (limited to 32 kbytes codesize), so you could just > try both. > So, which do you feel is better?
IAR produces 10-20% smaller code than gcc (Sourcey CodeBench Lite). We use both. Leo Havmøller.
On Thu, 28 Jun 2012 05:33:59 +0200, Leo Havmøller wrote:

>> Don't know about arm-cc, but it is definitely true for gcc vs IAR. IAR >> has a free download (limited to 32 kbytes codesize), so you could just >> try both. >> So, which do you feel is better? > > IAR produces 10-20% smaller code than gcc (Sourcey CodeBench Lite). We > use both.
I wonder how much is the compiler and how much is the library. Newlib has some amazing fluff-bombs that you can set off quite unexpectedly (just one example: pow, in the math library, is huge). -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
If you appreciate a good IDE, the ARM stinks!
Also I'm a little bit surprised about their QA department. Last version 
V-4.53 came up with some peculiar error-messages regarding temporary 
files. The file failing was changing from compile to compile (without 
any source changes). When asking Keil about it, they had to admit that 
it was a known bug in projects which consists of sub-projects. This is 
several weeks ago, and no new version has appeared. I don't think I 
would buy a Keil again.....

-- 
Regards
Ole Asbjorn Fadum
> I wonder how much is the compiler and how much is the library.
It's the compiler and linker. Newlib would make the code size explode. Leo Havmøller.
On Thu, 28 Jun 2012 09:11:56 +0200, Leo Havmøller wrote:

>> I wonder how much is the compiler and how much is the library. > > It's the compiler and linker. Newlib would make the code size explode.
Is that with -O2, or whatever the "optimize for size" switch is? -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On 29.6.12 6:12 , Tim Wescott wrote:
> On Thu, 28 Jun 2012 09:11:56 +0200, Leo Havmøller wrote: > >>> I wonder how much is the compiler and how much is the library. >> >> It's the compiler and linker. Newlib would make the code size explode. > > Is that with -O2, or whatever the "optimize for size" switch is? >
Compiling the library with -Os makes small wonders here. -- Tauno Voipio
> Is that with -O2, or whatever the "optimize for size" switch is?
gcc optimize for size is -Os. For dead code elimination you would also use -ffunction-sections and -fdata-sections, and link with -gc-sections. I use this to compile (defines and includes removed): C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe -x c -fpack-struct=1 -c -gdwarf-3 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -Os -fshort-enums -ffunction-sections -fdata-sections -fconserve-stack -fverbose-asm -fno-common -fno-merge-constants -fno-defer-pop -Wall -Wformat -Wimplicit -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wno-strict-aliasing -Wtype-limits And this to link: C:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gcc.exe -mcpu=cortex-m3 -mthumb -Wl,-static -Wl,--cref -Wl,--gc-sections -Wl,-Map=CoreTest.map Obj\\*.o -T CoreTest.def -L"C:\Program Files\CodeSourcery\Sourcery G++ Lite\arm-none-eabi\lib\thumb2" -o CoreTest.elf Leo Havmøller.