From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Size of external u-boot commands
Date: Thu, 26 Mar 2009 10:37:17 -0400 [thread overview]
Message-ID: <49CB931D.9040002@ge.com> (raw)
In-Reply-To: <9e4733910903260721l40edac53l96b3a1d78015ad0b@mail.gmail.com>
Jon Smirl wrote:
> On Thu, Mar 26, 2009 at 9:52 AM, Jerry Van Baren <gerald.vanbaren@ge.com> wrote:
>> Jon Smirl wrote:
>>> My networking hardware needs microcode loaded into it before it will
>>> function. What's the best method to load this code? It's 70KB.
>>>
>>> My current u-boot image is 170KB. I started working with the code in
>>> examples and api_examples. But the "hello world" programs built using
>>> those APIs are 65-72KB in size. That's almost half the size of my
>>> u-boot image and these programs just print "hello world". Why are
>>> these programs so big? My goal was to put the loader program and my
>>> microcode into a single 128KB erase block.
>>>
>>> My code for loading the microcode into the hardware is 7KB. Now it
>>> looks like I will need to incorporate it into the main u-boot image
>>> instead of making it an external command.
>> Hi Jon,
>>
>> I suspect the example code is 98% C libraries and 2% nugget. In your
>> example, "hello world" probably uses the whole printf support tree (strings,
>> formatted printing, possibly floating point...).
>>
>> I would suggest you make a stand-alone application that simply returns and
>> see how big it ends up. Depending on whether that is small or not, check
>> what libraries get linked with it and see how to create your simple test app
>> such that it doesn't use any extraneous libraries.
>
> Libraries appear to be the problem. A program that just returns is 100
> bytes, add a puts("hello world") and it is 65KB.
>
> I had expected the u-boot app examples to be smart and use the copy of
> those libraries in the u-boot image. For example the demo program in
> api_examples uses printf (65K library) instead of building an api
> calling into u-boot for printf.
No, the u-boot interface is *much* more basic than a library interface,
it is on the level of "read character" / "write character". Making a
trap interface at a library level would be a lot of work and would be a
large source of problems for something that is a simple utility function
(supporting stand-alone apps, that is)... a shared library interface is
non-trivial for a full blown OS.
Library interface issues was the pain and screaming you (may have) heard
when the world changed from a.out to DWARF to ELF and changing from
glibc5 to glibc6, etc.
If you work a bit at it, you should not need to use libraries in your
network loading app. If you can get by with just returning error codes,
you can do error printing back in u-boot. If you need to print, use
static strings so you don't pull in the world of string handling. You
may need to make your own print function (a limited printf() is pretty
simple) that sends your strings out using the u-boot "putc" interface.
gvb
next prev parent reply other threads:[~2009-03-26 14:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 13:47 [U-Boot] Size of external u-boot commands Jon Smirl
2009-03-26 13:52 ` Jerry Van Baren
2009-03-26 14:21 ` Jon Smirl
2009-03-26 14:37 ` Jerry Van Baren [this message]
2009-03-26 14:43 ` Rafal Jaworowski
2009-03-26 15:06 ` Jon Smirl
2009-03-26 15:10 ` Jon Smirl
2009-03-26 16:40 ` Jon Smirl
2009-03-26 15:21 ` Mike Frysinger
2009-03-26 20:27 ` Wolfgang Denk
2009-03-26 20:50 ` Jon Smirl
2009-03-26 21:15 ` Wolfgang Denk
2009-03-26 21:35 ` Jon Smirl
2009-03-26 23:26 ` Wolfgang Denk
2009-03-27 1:34 ` Jon Smirl
2009-03-27 10:37 ` Detlev Zundel
2009-03-27 10:57 ` Wolfgang Denk
2009-03-27 11:17 ` Detlev Zundel
2009-03-27 12:47 ` Jon Smirl
2009-03-27 15:54 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49CB931D.9040002@ge.com \
--to=gerald.vanbaren@ge.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.