From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Thu, 12 Nov 2015 16:28:38 +0800 Subject: [U-Boot] [PATCH v2] Fix board init code to use a valid C runtime environment In-Reply-To: <20151112081703.66022f2d@lilith> References: <1447180247-29704-1-git-send-email-albert.u.boot@aribaud.net> <56442AC0.2030306@wytron.com.tw> <20151112081703.66022f2d@lilith> Message-ID: <56444DB6.3020108@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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