From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Thu, 15 Nov 2012 23:41:07 +0100 Subject: [U-Boot] [PATCH v3 1/2] arm: move C runtime setup code in crt0.S In-Reply-To: References: <1352028725-26683-1-git-send-email-albert.u.boot@aribaud.net> <1352566813-30386-1-git-send-email-albert.u.boot@aribaud.net> <1352566813-30386-2-git-send-email-albert.u.boot@aribaud.net> Message-ID: <20121115234107.54c1409d@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On Thu, 15 Nov 2012 11:35:27 -0800, Simon Glass wrote: > Hi Albert, > > On Sat, Nov 10, 2012 at 9:00 AM, Albert ARIBAUD > wrote: > > Move all the C runtime setup code from every start.S > > in arch/arm into arch/arm/lib/crt0.S. This covers > > the code sequence from isetting up the initial stack > > to calling into board_init_r(). > > > > Also, rewrite the C runtime setup and make functions > > board_init_*() and relocate_code() behave according to > > normal C semantics (no jumping across the C stack any > > more, etc). > > > > Some SPL targets had to be touched because they use > > start.S exolicitly or for some reason; the relevant > > maintainers and custodians are cc:ed. > > > > Signed-off-by: Albert ARIBAUD > > I am very pleased to see this. My generic relocation series from some > time ago is still hanging around. Your series tidies up some things > which would make that series easier to do. I'm happy to take another > look at it. I do remember your series -- it is part of what gave me the incentive toput this patch series together. :) > I have tested your series on a Tegra seaboard, and got it running with > a few changes. Please see comments below. > > + ldr r0, =__bss_start /* this is auto-relocated! */ > > + ldr r1, =__bss_end__ /* this is auto-relocated! */ > > I noticed this last time around - really we should have __bss_end__, > not __bss_end. Something to look at in future work, perhaps. Noted. > > + bhs clbss_l > > I think this should be blo, not bhs. Otherwise the BSS does not get > cleared and my seaboard doesn't boot properly. Thanks -- not the first time I see these... I'll have a go at checking all loops. > > + /* call board_init_r */ > > + ldr pc, _board_init_r /* this is auto-relocated! */ > > For my toolchain I need: > > ldr pc, =board_init_r > > otherwise I get: > > crt0.S: Assembler messages: > crt0.S:176: Error: internal_relocation (type: OFFSET_IMM) not fixed up Thanks -- this could well cure errors that Tom Warren reported to me for various toolchains. > Also _board_init_r seems to be the wrong symbol name for me: > > arch/arm/lib/libarm.o: In function `clbss_l': > /home/sjg/trunk/src/third_party/u-boot/files/arch/arm/lib/crt0.S:176: > undefined reference to `_board_init_r' Thanks a lot for the feedback and analysis! This should make V4 work on a much wider range of ARM boards. > Regards, > Simon Amicalement, -- Albert.