[U-Boot] Size of external u-boot commands

Jon Smirl jonsmirl at gmail.com
Thu Mar 26 21:50:47 CET 2009


On Thu, Mar 26, 2009 at 4:27 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Jon Smirl,
>
> In message <9e4733910903260647w549a97acv7101ea9347a767bb at mail.gmail.com> you 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.
>
> I'm  not  sure  how  you  calculate  sizes,  or  how  you  link  your
> applications.  Note that classical standalone application do not link
> against any libraries, so they are really small:

The *.bin files are ending up at 60-75K.  Adding this to the linker
script fixes it.
  .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table))
*(.gcc_except_table.*) }

Approximately 60KB of zeros are getting inserted into the *.bin files.

Before:
jonsmirl at terra:/home/apps/u-boot/examples$ ls *.bin -l
-rwxr-xr-x 1 jonsmirl jonsmirl 66424 2009-03-26 15:59 hello_world.bin
-rwxr-xr-x 1 jonsmirl jonsmirl 66460 2009-03-26 15:59 interrupt.bin
-rwxr-xr-x 1 jonsmirl jonsmirl 68464 2009-03-26 15:59 sched.bin

After the linker script change:
jonsmirl at terra:/home/apps/u-boot/examples$ ls *.bin -l
-rwxr-xr-x 1 jonsmirl jonsmirl 4136 2009-03-26 16:49 hello_world.bin
-rwxr-xr-x 1 jonsmirl jonsmirl 4128 2009-03-26 16:49 interrupt.bin
-rwxr-xr-x 1 jonsmirl jonsmirl 4184 2009-03-26 16:49 sched.bin
jonsmirl at terra:/home/apps/u-boot/examples$



>
> -> size examples/{hello_world,timer}
>   text    data     bss     dec     hex filename
>    796      40       0     836     344 examples/hello_world
>   1556      56       0    1612     64c examples/timer
>
> As you can see, the "hello world" demo program just needs a few
> hundret bytes.
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> The computer can't tell you the emotional story. It can give you  the
> exact mathematical design, but what's missing is the eyebrows.
> - Frank Zappa
>



-- 
Jon Smirl
jonsmirl at gmail.com


More information about the U-Boot mailing list