[U-Boot] CFG_64BIT_xxx and friends

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Tue Sep 9 09:11:09 CEST 2008


Jerry Van Baren <gvb.uboot at gmail.com> wrote:
> Haavard Skinnemoen wrote:
> > Haavard Skinnemoen <haavard.skinnemoen at atmel.com> wrote:
> >> That's a bit more than expected. Is this with or without --gc-sections?
> >> Linking with --gc-sections should make simple_strtoull() go away unless
> >> it's actually used.
> > 
> > That's assuming the fdt and image code doesn't interpret
> > CFG_64BIT_VSPRINTF as CFG_BLOAT_ME_HARDER, which it does. So enabling
> > CFG_64BIT_VSPRINTF does increase the code size even with --gc-sections.
> > 
> > I think fdt and common/image.c should stop abusing CFG_64BIT_VSPRINTF
> > and get its own symbol instead, e.g. CFG_64BIT_PHYS_ADDR, and perhaps a
> > nice str_to_addr() wrapper which selects between strtoul and strtoull
> > based on this symbol.
> 
> Hi Haavard,
> 
> fdt and common.image.c don't use CFG_64BIT_VSPRINTF:
> 
> $ find . -name "*.c" | xargs grep CFG_64BIT_VSPRINTF
> ./disk/part.c:#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
> ./common/cmd_ide.c:#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
> ./common/cmd_ide.c:#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
> ./lib_generic/vsprintf.c:#ifdef CFG_64BIT_VSPRINTF
> ./lib_generic/vsprintf.c:#ifdef CFG_64BIT_VSPRINTF
> ./lib_generic/vsprintf.c:#ifdef CFG_64BIT_VSPRINTF
> ./lib_generic/vsprintf.c:#ifdef CFG_64BIT_VSPRINTF
> 
> ...they use CFG_64BIT_STRTOUL.

Ah, sorry. I meant CFG_64BIT_STRTOUL.

> If a config defines CFG_64BIT_STRTOUL, 
> it is reasonable that the code uses it. I don't see any disadvantage of 
> this vs. creating a new CFG_64BIT_PHYS_ADDR (although I would not object 
> to that being created).

Just because a 64-bit strtoul exists doesn't mean you _have_ to use it.

> Only a select set of PowerPC targets actually define CFG_64BIT_STRTOUL:
> 
> $ find . -name "*.[ch]" | xargs grep CFG_64BIT_STRTOUL
> ./cpu/mpc85xx/mp.c:#ifdef CFG_64BIT_STRTOUL
> ./include/configs/MPC8540ADS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8572DS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8536DS.h:#define CFG_64BIT_STRTOUL		1
> ./include/configs/MPC8548CDS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8568MDS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8541CDS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8610HPCD.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8641HPCN.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/sbc8641d.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8555CDS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8560ADS.h:#define CFG_64BIT_STRTOUL	1
> ./include/configs/MPC8544DS.h:#define CFG_64BIT_STRTOUL		1
> ./include/ppc4xx.h:#define CFG_64BIT_STRTOUL
> ./common/cmd_fdt.c:#ifdef CFG_64BIT_STRTOUL
> ./common/cmd_fdt.c:#ifdef CFG_64BIT_STRTOUL
> ./common/image.c:#ifdef CFG_64BIT_STRTOUL
> ./lib_generic/vsprintf.c:#ifdef CFG_64BIT_STRTOUL
> ./lib_generic/vsprintf.c:#endif /* CFG_64BIT_STRTOUL */

Ok, so CFG_64BIT_STRTOUL effectively means "I want 64-bit physical
addresses" today. It's a bit unintuitive, but I guess we have bigger
problems than that.

I must say it was a bit surprising that my u-boot image instantly grew
by 200 bytes when I thought I just made a new function available, and
--gc-sections was being used.

Haavard


More information about the U-Boot mailing list