[U-Boot] [PATCH] ARM: crt0: Pass malloc base address
Fabio Estevam
festevam at gmail.com
Wed Nov 11 22:00:41 CET 2015
Hi Simon and Albert,
On Wed, Nov 11, 2015 at 6:41 PM, Fabio Estevam <festevam at gmail.com> wrote:
> 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.
If I change the logic like this then malloc() works:
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -51,7 +51,7 @@ ulong board_init_f_mem(ulong top)
arch_setup_gd(gd_ptr);
#if defined(CONFIG_SYS_MALLOC_F) && \
- (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
+ (defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
top -= CONFIG_SYS_MALLOC_F_LEN;
gd->malloc_base = top;
#endif
Shouldn't we test for defined(CONFIG_SPL_BUILD) instead of
!defined(CONFIG_SPL_BUILD)?
Thanks
More information about the U-Boot
mailing list