[U-Boot] [PATCH v2] Fix board init code to use a valid C runtime environment

Thomas Chou thomas at wytron.com.tw
Thu Nov 12 09:28:38 CET 2015


Hi Albert,

On 2015年11月12日 15:17, Albert ARIBAUD wrote:
>> ------------------------------------------------------------------------
>> diff --git a/common/init/board_init.c b/common/init/board_init.c
>> index 8839a4a..703e6d8 100644
>> --- a/common/init/board_init.c
>> +++ b/common/init/board_init.c
>> @@ -46,6 +46,7 @@ void board_init_f_gd(struct global_data *gd_ptr)
>>    	for (ptr = (int *)gd_ptr; ptr < (int *)(gd_ptr + 1); )
>>    		*ptr++ = 0;
>>    #endif
>> +	arch_setup_gd(gd_ptr);
>
> Correct -- in ARM (Thumb-1 at least) we cannot use arch_setup_gd() so
> we set GD (in r9) from within arch/arm/lib/crt0.S, but for NIOS2 it
> might (and apparently does) work. Where is GD stored in NIOS2?
>

It is a register, r26 "gp".

I have another question. Will it be simpler to have two calls instead of 
four?

1. get size of gd plus malloc.

2. init gd and malloc.

Best regards,
Thomas


More information about the U-Boot mailing list