This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Making an Ecos Kernel suitable for Hello World(minimalist) situations.


On Tue, 2002-11-05 at 15:20, Warren Postma wrote:
> I built a default Nano target environment using the graphical build tools.
> When I build the usual hello world C program, I get a 3.2 megabyte
> monstrosity.
> 
> arm-elf-gcc \
>   -T/nano_install/lib/target.ld \
>   -Wl,--gc-sections -Wl,-static \
>   -g -O2 -nostdlib \
>   -L/nano_install/lib \
>   -I/nano_nstall/include \
>   hello.c -o hello.exe
> 
> Most of that is obviously ECOS.  Out of that, how do I find out how much
> space the EXE is actuall taking on the target, and could I estimate how much
> is HAL, TCPIP, PCI libs, and so on?
> 
> So I did a minimal build, and relinked with "nano_mini_install/lib", and I
> got a very respectable 108118 byte executable.  Now, how would I find out
> how much of that EXE is actually flat space?
> 
> Unfortunately, minimal is not enough for a working printf(), which I
> consider rather essential.  Attempts to debug the 110K hello.c crash, so I
> assume that the printf() call is not working, and yet no link errors were
> made.  However the nano_mini.ecc file doesn't appear to include the mini c
> libraries.
> 
> What do I have to type to add the C libraries into minimal?  And is minimal
> really minimal or can I remove something else?
> 
> Also, does anyone know how to build something Even More Minimal than the
> Minimal Template?  All I need is a working Nano Target (I assume the HAL is
> 100% necessary), and printf() support.
> 

If you build with the default template, you'll get a pretty
minimal version.

Note that the size of the actual program has very little to
do with the size of the executable file!  The file is in ELF
format, with *LOTS* of debugging information.  The actual
program is typically quite small.

For example, I just built a default kernel for ARM and then
built one of the tests.  The results are:

[gthomas@hermes t2]$ ls -l install/tests/kernel/current/tests/tm_basic 
-rwxr-xr-x    1 gthomas  wheel     1071775 Nov  5 16:37 install/tests/kernel/current/tests/tm_basic

[gthomas@hermes t2]$ arm-elf-size install/tests/kernel/current/tests/tm_basic 
   text    data     bss     dec     hex filename
  55776    1192 11695388        11752356         b353a4 install/tests/kernel/current/tests/tm_basic

Notice that the file (ELF) is well over 1MB, whereas the size 
of the TEXT+DATA is only 56KB.

-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]