[U-Boot] [RFC] ARM-optimized memcpy/memset on SPL build

Masahiro Yamada yamada.m at jp.panasonic.com
Thu Jul 18 06:26:28 CEST 2013


Hello exports,


I found we cannot enable ARM-optimized memset/memcpy in SPL build.


For example,

I added 

> #define CONFIG_USE_ARCH_MEMSET
> #define CONFIG_USE_ARCH_MEMCPY

into "include/configs/omap3_beagle.h" and ran
make omap3_beagle_config && make.

Then,

undefined reference to `memset'
undefined reference to `memcpy'

errors occurred.





If CONFIG_USE_ARCH_MEMCPY is defined,
__HAVE_ARCH_MEMCPY is also defined in  arch/arm/include/asm/string.h.

So, generic memcpy function in lib/string.c is not compiled.

If I see  arch/arm/lib/Makefile,
we cannot build  arch/arm/lib/memcpy.S either
on CONFIG_SPL_BUILD=y.

This seems to cause undefined reference to memcpy.


I found I can fix this problem
by modifying arch/arm/lib/Makefile as follows:


--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -48,12 +48,13 @@ COBJS-y += sections.o
 COBJS-y        += bootm.o
 COBJS-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
-SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
-SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 else
 COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
 endif
 
+SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
+SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
+
 COBJS-y        += interrupts.o
 COBJS-y        += reset.o
 



If this is the correct way of fixing,
I can post the patch.


But my question is, in the first place
if CONFIG_USE_ARCH_MEMSET/MEMCPY macro is necessary or not.

Can we always build arch-optimized memset.S/memcpy.S
like Linux Kernel ?
Although I am not sure how significant the code size is in SPL build,
I imagine the arch-optimized memcpy has an advantage
when copying a big image like OS Kernel.

Comments are welcome.


Best Regards,
Masahiro Yamada



More information about the U-Boot mailing list