[U-Boot-Users] Optimized U-boot : Optimization of UCC and TFTP codes of UBOOT

KUMAR GOPALPET-B05799 Sandeep.Kumar at freescale.com
Tue Nov 21 10:15:49 CET 2006


Hi Denk,

		Thank you for the immediate reply to my mail but in my
case I will not be using the entire U-boot and hence not bothered about
the total size of U-boot. We already have a "startup code" for our board
and this startup code runs from the I2CPROM. Once the start up code gets
executed, the next step is to initialize the Ethernet driver and then
run Tftp over this. The ipaddr, serverip, etc., will be hard coded.    

The startup code basically does some register initialization required to
up the board. Another point here is that the user will not be able to
access the serial console till the board downloads the images and boots
up. 

Now, the startup code contains a function call to the Ethernet driver
initialization which actually sets up the Ethernet driver and then over
this Tftp support is provided to download the kernel images to the RAM.

So, in this case I need not use the entire U-boot and I require only the
following files

ucc_geth.c, ucc_fast.c, ucc_geth_phy.c and the corresponding header
files for the Ethernet initialization and

tftp.c, eth.c and net.c and some other supportive functions. The size of
libucc.a is around 44KB and that of libnet.a is around 42KB and I need
to optimize these codes providing minimal features. The size of the
startup code is less than 1KB
and the rest of the code should fit in the rest of 17KB. 

So, any ideas on how to proceed with this feature of booting from PROM,
plz do share them with me.

Regards

Sandeep Gopalpet 



-----Original Message-----
From: wd at denx.de [mailto:wd at denx.de] 
Sent: Tuesday, November 21, 2006 2:02 PM
To: KUMAR GOPALPET-B05799
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] Optimized U-boot : Optimization of UCC and
TFTP codes of UBOOT 

In message
<1034141BCEB1424784F14A38BD006D82165BB5 at zin33exm22.fsl.freescale.net>
you wrote:
> 
>                 I am currently trying to optimize the Ethernet driver 
> initialization code and the Tftp code of the U-boot so that it can fit

> into the I2CPROM of the 8321 LCDB board whose PROM size is 32 KB, but 
> out of which only 18 KB is available for the code.

I recommend to check code and data sizes of  a  few  objects  in  the
U-Boot  tree,  and  to  re-consiser if it is worth to spent effort on
this.

...
> do bare initialization of the Ethernet and does not implement any 
> complex functionalities. The only functions that are required are the
> (1) TX event (2) RX event (3) Error Control and (4)CRC.

Yes, and you will need initialization of the CPU, the RAM (for stack and
I/O buffers, and you will need support for the environment and code to
read it (for things like MAC address), and you may want to be able to
see what's happening, so a minimal serial driver is needed, which in
turn asks for things like printf, and... and...

> The Tftp code (present in the net directory of the U-Boot) then should

> support a simple file transfer protocol implemented in a minimal 
> fashion.

Right. That's what the initiual 'T' stands for. I don;t think that the
current code is overly bloated.

> The Ethernet initialization code and the Tftp code size should not be 
> more than 18 KB.

Let's give it a quick check on a TQM834x system:

-> size cpu/mpc83xx/*.o net/*.o lib_generic/string.o 
-> lib_generic/vsprintf.o
   text    data     bss     dec     hex filename
    468      24       0     492     1ec cpu/mpc83xx/cpu.o
    304       0       0     304     130 cpu/mpc83xx/cpu_init.o
   1868       8       0    1876     754 cpu/mpc83xx/i2c.o
    104       0       0     104      68 cpu/mpc83xx/interrupts.o
      0       0       0       0       0 cpu/mpc83xx/resetvec.o
      0       0       0       0       0 cpu/mpc83xx/spd_sdram.o
   1260     248       0    1508     5e4 cpu/mpc83xx/speed.o
  14584      92       0   14676    3954 cpu/mpc83xx/start.o
   1804      76       0    1880     758 cpu/mpc83xx/traps.o
   2296     120       0    2416     970 net/bootp.o
   2588      76      12    2676     a74 net/eth.o
   6528     324     204    7056    1b90 net/net.o
   4784     208    2224    7216    1c30 net/nfs.o
    576      48       0     624     270 net/rarp.o
      0       0       0       0       0 net/sntp.o
   2220     196      52    2468     9a4 net/tftp.o
   1256       4       0    1260     4ec lib_generic/string.o
   3032      24       0    3056     bf0 lib_generic/vsprintf.o
==============================================================
  43467    1448

Just this fraction of the U-Boot code gives a total of more than 44 kB.
I doubt that you can optimize away 60% of this...

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The rule on staying alive as a program manager is to give 'em a  num-
ber or give 'em a date, but never give 'em both at once.




More information about the U-Boot mailing list