[U-Boot] [PATCH 0/4] sunxi: SPL size reduction patches

Hans de Goede hdegoede at redhat.com
Wed Feb 4 13:05:47 CET 2015


Hi All,

Inspired by Simon's work to make the FEL SPL and regular SPL builds more
similar I've been looking into reducing the size of the SPL, resulting in
the following patch series. This all seems quite safe, but we are past rc1,
so may be best to keep this on a branch for now, or not ...

Simon, I think the malloc_simple changes should go through your tree, once
those are merged I'll add the sunxi patch enabling malloc_simple usage in
the SPL.

With this series we're already quite close to getting a full-blown SPL to
fit in 16K, I've looked at removing CONFIG_SPL_LIBCOMMON_SUPPORT but that
won't fly well I think. We could however add a CONFIG_SPL_NO_PRINTF, which
automatically gets set when CONFIG_SPL_LIBCOMMON_SUPPORT is not set, and
use that on sunxi, assuming that you (Simon) are ok with not being able to
use printf in the device-model code which gets used in the SPL.

Things already almost built when not setting CONFIG_SPL_LIBCOMMON_SUPPORT
since there are already a lot of places checking for that before calling
printf. We could change all the CONFIG_SPL_LIBCOMMON_SUPPORT to
CONFIG_SPL_NO_PRINTF checks and define CONFIG_SPL_NO_PRINTF on sunxi to win
another "large" chunk of RAM.

Something else to look at is at the memory map of the first 32k of SRAM when
in FEL mode. The only documentation we've is:
https://github.com/hno/Allwinner-Info/blob/master/FEL-usb/USB-protocol.txt

Which is reverse engineered and not 100% clear on the memory map. We could
add a memset to 0xaa for 0x6000 - 0x8000 to the fel spl as a test, as I've
the feeling that what hno has found there are just scratch buffers and that
using that in the SPL will be save, if that is the case we could use
0x2000 - 0x0000 (growing downwards) as stack, and always use a text-base of
0x2000 for the SPL, with the SPL code / data segments living at
0x2000 - 0x8000 and then everything should fit as is, and we can have one
unified SPL binary for both FEL and sdcard booting.

I don't have the time to look into this further atm, so I hope that one of
you (Simon or Siarhei) has time to look into this further.

I see that we also never merged this related fix:
http://lists.denx.de/pipermail/u-boot/2014-July/183986.html

We should probably merge a version of that when Simon's patches for fixing
FEL have landed. I think it may be best to just always set the L2EN bit on
sun4i/sun5i, without detecting whether we're in fel mode or not, setting it
when it is already said should be a nop, and thus harmless.

Regards,

Hans


More information about the U-Boot mailing list