Re: [arm-gnu] Huge Code Size CodeSourcery G++ Lite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] Huge Code Size CodeSourcery G++ Lite
- To: arm-gnu@xxxxxxxxxxxxxxxx
- Subject: Re: [arm-gnu] Huge Code Size CodeSourcery G++ Lite
- From: David Brown <david@xxxxxxxxxxxxxxx>
- Date: Fri, 01 Jul 2011 09:16:56 +0200
On 01/07/2011 03:42, Senel Murat (CR/RTC4.1-NA) wrote:
Hi;
Recently, I tried building a project on Cortex-M3 using the CodeSourcery
G++ Lite. However, the size of the binary becomes huge.
As a comparison to a commercial toolchain, here is the difference of the
.bin for a simple "blink" application:
Commercial IDE: 4.6KB
Eclipse IDE with CodeSourcery G++ Lite: 14.3KB
Any ideas? Is this normal, or are we making some stupid mistakes?
Thanks,
-Murat
Without more information, it's only possible to make vague guesses. My
guess here is that you are using C++, with exceptions and RTTI enabled,
and have ended up linking in substantial parts of the library to deal
with unhandled exceptions, etc. If that's the case, have a look at the
recent "Tons of seemly extraneous code linked in c++ program" thread in
this list.
Alternative likely causes are using printf or related functions, and
ending up with a lot of the maths library.
Have a look at a detailed map file to see what's being included, and why.
Note that if these library functions are actually useful somewhere in
your real program, then they will be linked in anyway. It's a on-off
code cost - the extra 10K library space will use 10K whether your
program is 4K or 400K, and the same (roughly) applies to other
toolchains. Code size comparisons are only really relevant if you look
at an entire real-world program, or if you consider just the size of the
object file for a particular code file you are interested in.