
In message 1034141BCEB1424784F14A38BD006D82165BB5@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