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

Corrin Meyer Corrin.Meyer at dornerworks.com
Fri Jun 27 19:39:51 UTC 2008


Indeed, removing the printf() does make it much smaller. It was just
since I had seen examples using it and building it to run for the exact
board that I had, I was hoping that it would work for. I suppose
something must of changed in the interim.

So, 40k when using printf() doesn't sound out of line?

Corrin Meyer

-----Original Message-----
From: Mark Mitchell [mailto:mark at codesourcery.com] 
Sent: Friday, June 27, 2008 3:16 PM
To: Corrin Meyer
Cc: coldfire-gnu-discuss at codesourcery.com
Subject: Re: [coldfire-gnu-discuss] Code size for "Hello World"

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