[coldfire-gnu-discuss] Code size for "Hello World"

Mark Mitchell mark at codesourcery.com
Fri Jun 27 19:15:57 UTC 2008


Corrin Meyer wrote:

> If I compile with the “m52235evb-rom-hosted.ld” script, it compiles but 
> the resultant load binary (created from the generated elf) is 40k.  I 
> have seen examples using the RAM hosted script which leads me to believe 
> that it should work (or has at least worked in the past).  I know that I 
> am using Newlib, but I didn’t expect it to add nearly 40k of code.  Is 
> there a way to shrink it?

We are looking at ways to make Newlib smaller.  However, "printf" (in 
all its glory) is a pretty complicated function; it needs to do handling 
floating point conversions and so forth.  You might try just using 
"write", instead.  Of course, if you don't actually need I/O, then 
things will get much smaller; I suspect that an empty "int main() {}" 
will be a lot smaller.

-- 
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713



More information about the coldfire-gnu-discuss mailing list