From Corrin.Meyer at dornerworks.com Fri Jun 27 16:53:42 2008 From: Corrin.Meyer at dornerworks.com (Corrin Meyer) Date: Fri, 27 Jun 2008 12:53:42 -0400 Subject: Code size for "Hello World" Message-ID: I am trying to compile the ubiquitous hello world application for a ColdFire M52235EVB board and I am running into issues. I issue the command... m68k-elf-gcc -T m52235evb-ram-hosted.ld -mcpu=m52235 hello.c -o hello And I get the following errors... c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/m68k-elf/4.2.3/../../../../m68k-elf/bin/ld.exe: hello section .text will not fit in region ram c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/m68k-elf/4.2.3/../../../../m68k-elf/bin/ld.exe: region ram overflowed by 7872 bytes collect2: ld returned 1 exit status 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? Corrin J. Meyer DornerWorks, Ltd. Embedded Systems Engineering T: 616.389.8336 F: 616.245.8372 E: corrin.meyer at dornerworks.com 3445 Lake Eastbrook Blvd. SE Grand Rapids, MI 49546 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at codesourcery.com Fri Jun 27 19:15:57 2008 From: mark at codesourcery.com (Mark Mitchell) Date: Fri, 27 Jun 2008 12:15:57 -0700 Subject: [coldfire-gnu-discuss] Code size for "Hello World" In-Reply-To: References: Message-ID: <48653C6D.305@codesourcery.com> 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 From Corrin.Meyer at dornerworks.com Fri Jun 27 19:39:51 2008 From: Corrin.Meyer at dornerworks.com (Corrin Meyer) Date: Fri, 27 Jun 2008 15:39:51 -0400 Subject: [coldfire-gnu-discuss] Code size for "Hello World" In-Reply-To: <48653C6D.305@codesourcery.com> References: <48653C6D.305@codesourcery.com> Message-ID: 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 From mark at codesourcery.com Fri Jun 27 20:12:33 2008 From: mark at codesourcery.com (Mark Mitchell) Date: Fri, 27 Jun 2008 13:12:33 -0700 Subject: [coldfire-gnu-discuss] Code size for "Hello World" In-Reply-To: References: <48653C6D.305@codesourcery.com> Message-ID: <486549B1.1020608@codesourcery.com> Corrin Meyer wrote: > 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? No, not really. We'd like to get it down, of course, and we are working on that, but printf is never going to be really small. The format-parsing code is necessarily complex; think about things "%.*g"... -- Mark Mitchell CodeSourcery mark at codesourcery.com (650) 331-3385 x713