[U-Boot] [PATCH] ARM: crt0: Pass malloc base address

Fabio Estevam festevam at gmail.com
Wed Nov 11 21:41:05 CET 2015


Hi Simon,

On Wed, Nov 11, 2015 at 6:26 PM, Simon Glass <sjg at chromium.org> wrote:

> Thanks for digging into this. But this should be set up in board_init_f_mem():
>
> #if defined(CONFIG_SYS_MALLOC_F) && \
>    (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
>    top -= CONFIG_SYS_MALLOC_F_LEN;
>    gd->malloc_base = top;
> #endif
>
> Is it possible that the #ifdef logic is wrong for your board?

Good point. Looks like this is the problem indeed.

I have manually removed the #ifdef logic just for testing:

--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -50,11 +50,8 @@ ulong board_init_f_mem(ulong top)
 #endif
        arch_setup_gd(gd_ptr);

-#if defined(CONFIG_SYS_MALLOC_F) && \
-       (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
        top -= CONFIG_SYS_MALLOC_F_LEN;
        gd->malloc_base = top;
-#endif

        return top;
 }

,and then malloc() works fine in SPL.

Doing a make mx6sabresd_spl_defconfig I get:
CONFIG_SYS_MALLOC_F=y

For SPL_BUILD I get in menuconfig:

 Symbol: SPL_BUILD [=SPL_BUILD]
 Type  : unknown

and CONFIG_SYS_SPL_MALLOC_START does not exist.

Regards,

Fabio Estevam


More information about the U-Boot mailing list