
Hi,
On 05/06/17 16:01, Tom Rini wrote:
On Fri, Jan 20, 2017 at 10:33:28PM +0000, Andre Przywara wrote:
The ctype implementation (isdigit() & friends) works with an array of 256 Bytes - one for each character. This is pretty big in SPL terms, so let's replace this "bloated" implementation with a tiny version using C statements. This only implements the functions that the SPL requires and confines this change only to an actual SPL build. Saves about 200 Bytes from the SPL code size.
Signed-off-by: Andre Przywara andre.przywara@arm.com Acked-by: Andrew F. Davis afd@ti.com
Hi,
some people voiced concerns about running out of SPL code space when adding new features. In this particular case this was an issue when looking at the SPL FIT extension series[1]. This patch here on top of this series saves more space than the SPL FIT series consumed, so I trade this as a bait to people wrestling with this problem ;-)
Cheers, Andre.
[1] http://lists.denx.de/pipermail/u-boot/2017-January/278772.html
include/linux/tiny_ctype.h | 12 ++++++++++++ lib/Makefile | 2 ++ lib/strto.c | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 include/linux/tiny_ctype.h
So, cycling back. I think this is a good idea, but breaks on say socfpga_de0_nano_soc currently: arm: + socfpga_de0_nano_soc +(socfpga_de0_nano_soc) lib/built-in.o: In function `_vprintf': +(socfpga_de0_nano_soc) lib/tiny-printf.c:315: undefined reference to `_ctype' +(socfpga_de0_nano_soc) make[2]: *** [spl/u-boot-spl] Error 1 +(socfpga_de0_nano_soc) make[1]: *** [spl/u-boot-spl] Error 2 +(socfpga_de0_nano_soc) make: *** [sub-make] Error 2
Yeah, I found this version broken too for some buildman targets. So I came up with some fixes, and IIRC at least this compiled cleanly. Unfortunately some boards *regressed* in terms of size, apparently because the ctype functions are now inlined and if a board calls them several times we end up with multiple copies, offsetting the code size savings, which were quite substantial for many boards, otherwise. I tried one more fix, which improved the situation, but still left boards with bigger code sizes. At this point I gave up, but I can post what I had so far for others to pick up.
Cheers, Andre.