This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex M3 compilers and benchmarks

Note: This was originally posted on 20th January 2009 at http://forums.arm.com

Please help me identify the best compiler for CortexM3.
I currently use armcc from ARM, but curious if that is the best option on the market. So far, I found a couple of options for Cortex M3 compilers: GCC, armcc (RVCT 3.1) and IAR. What I cannot find is the benchmarking results or comparison between those compilers. Are there any other notable compilers/linkers for Cortex M3 that I missed?
I am mainly interested in code density and run time efficiency of the compiled image.

Thank you in advance!

Andrey
  • Note: This was originally posted on 22nd January 2009 at http://forums.arm.com

    What exactly do you mean by "run time efficiency"? Do you mean speed? In any compiler, there is a trade-off between code density and speed. Indeed, you can use "-Otime" and "-Osize" in RVCT to tell it what is important to you.


    You are correct. Speed of the produced executable is what I meant by the run time efficiency. And you right again: I did not mention what I am trying to measure.
    Well, speed is probably more important for me then size, but I would not want to have my image blow up in size either. As most engineers, I am looking for a perfect balance that would fit my needs.
    "GCC is free - and you get what you paid for" - I heard from some people.
    But this was just one opinion I got.
    Is that a common opinion that commercial compilers are generally better then
    GCC for ARM CPU's?
    I will take your advice and will measure the performance of compilers on my code samples myself. However, I was hoping to see generic benchmarking data and hear expert's opinions, to get a better understanding of the differences.
  • Note: This was originally posted on 28th January 2009 at http://forums.arm.com

    Common, maybe. Whether or not it's justified, I don't know. GCC for ARM has improved dramatically over the last few years and its output now is pretty good.

    The other issue is the technical support side of things. For example, the technical support for commercial compilers tends to be quite good, and the documentation is usually very complete. When trying to use GCC in similar ways I tend to find myself scouring Google for a few hints that might point me at some obscure command line switch which isn't really explained anywhere. That is the problem with GCC (and most other open source projects, come to think of it).

    It is hard to give anything other than a vague answer, so I apologize for that. If you're really interested in getting the best out of your compiler, then write some benchmarks and actually test it with the kind of code and configurations that you will need to use.

    To be honest though, I doubt you'll see any significant improvement and you're probably best off just sticking with what you've got. RVCT is certainly a very good compiler suite, and it is certainly much easier to use than GCC just for its documentation. The biggest influence on a program's size and speed is the design of the software and the algorithms that you're using.

    I hope that's helpful,
    Jacob


    Thank you for your reply and opinion.
    Documentation and support are important, but code size and speed are the driving factors.
    So far, I could not  find any good public compiler comparisons and there are probably reasons for that. One hope was the EEMBC, but they are still catching up on CortexM3.
    You are right. The best way to go it to download trial versions and run write benchmarks myself.

    Thanks!

    Andrey
  • Note: This was originally posted on 22nd January 2009 at http://forums.arm.com

    I don't know of any public benchmarks, and if any benchmarks do exist it is unlikely that they would be representative of your code. Compilers tend to do well at different tasks, so generic benchmarks are often not very useful unless there is a very notable difference in output.

    The best thing I can suggest is that you try them. You already have RVCT, so you know how that handles your code. GCC is free, so there's no harm in trying that (aside from the engineering time spent in porting Makefiles and the like). I haven't used IAR's compiler, but they probably have an evaluation version you could try.

    I am mainly interested in code density and run time efficiency of the compiled image.

    What exactly do you mean by "run time efficiency"? Do you mean speed? In any compiler, there is a trade-off between code density and speed. Indeed, you can use "-Otime" and "-Osize" in RVCT to tell it what is important to you.

    Yes, there are bad compilers around, but RVCT and GCC certainly don't fit into that category. (I don't know about IAR, but I'd guess that it's also fairly reasonable.)

    I would recommend that you decide exactly what you're trying to achieve and then benchmark your code based on those targets. There is no point looking at benchmarks "" or even running your own "" unless you know what you want to measure.
  • Note: This was originally posted on 22nd January 2009 at http://forums.arm.com

    "GCC is free - and you get what you paid for" - I heard from some people.
    But this was just one opinion I got.
    Is that a common opinion that commercial compilers are generally better then
    GCC for ARM CPU's?

    Common, maybe. Whether or not it's justified, I don't know. GCC for ARM has improved dramatically over the last few years and its output now is pretty good.

    The other issue is the technical support side of things. For example, the technical support for commercial compilers tends to be quite good, and the documentation is usually very complete. When trying to use GCC in similar ways I tend to find myself scouring Google for a few hints that might point me at some obscure command line switch which isn't really explained anywhere. That is the problem with GCC (and most other open source projects, come to think of it).

    It is hard to give anything other than a vague answer, so I apologize for that. If you're really interested in getting the best out of your compiler, then write some benchmarks and actually test it with the kind of code and configurations that you will need to use.

    To be honest though, I doubt you'll see any significant improvement and you're probably best off just sticking with what you've got. RVCT is certainly a very good compiler suite, and it is certainly much easier to use than GCC just for its documentation. The biggest influence on a program's size and speed is the design of the software and the algorithms that you're using.

    I hope that's helpful,
    Jacob