public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thomas Sailer <sailer@scs.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] MIPS build environment
Date: Sat, 29 Jan 2005 11:36:30 +0100	[thread overview]
Message-ID: <1106994990.5393.8.camel@gamecube.scs.ch> (raw)
In-Reply-To: <e7af2eca2d0ca4432255ff965eb51330@embeddededge.com>

On Fri, 2005-01-28 at 18:13 -0800, Dan Malek wrote:

> to assist with the alternative :-)  I'd like it if
> we can just find a way to invoke 'mipseb-*'
> or 'mipsel-*' based upon the configuration
> chosen and let it go at that.

That would be great!

> Unless I'm doing something wrong, I also have
> to use binutils with the 'allow_branch_to_undefined'
> patch.

It looks to me that the code uses bal in an attempt to be position
independent. It also uses a rather complicated got loading sequence.
This is IMO futile, as the rest of u-boot (especially the copy to RAM
routine) isn't position independent. So you can as well just load the
full address of the called routines into a temporary register and jump
through the register. See the patch below.

Tom


--- start.S.jnx	2005-01-20 21:51:00.000000000 +0100
+++ start.S	2005-01-20 22:01:39.000000000 +0100
@@ -28,6 +28,35 @@
 #include <asm/regdef.h>
 #include <asm/mipsregs.h>
 
+#define NEWASM
+
+#ifdef NEWASM
+
+#define BAL(x) \
+	lui	t0, %hi(x) ;		\
+	ori	t0, t0, %lo(x) ;	\
+	jalr	t0
+
+#define LOADGOT \
+	lui	gp, %hi(_GLOBAL_OFFSET_TABLE_) ;	\
+	ori	gp, gp, %lo(_GLOBAL_OFFSET_TABLE_)
+
+#else
+
+#define BAL(x) \
+	bal	x
+	
+#define LOADGOT \
+	bal	1f ;					\
+	nop ;						\
+	.word	_GLOBAL_OFFSET_TABLE_ - 1f + 4 ;	\
+1: ;							\
+	move	gp, ra ;				\
+	lw	t1, 0(ra) ;				\
+	add	gp, t1	
+	
+#endif
+
 
 #define RVECENT(f,n) \
    b f; nop
@@ -237,18 +266,18 @@
 #ifdef CONFIG_INCA_IP
 	/* Disable INCA-IP Watchdog.
 	 */
-	bal	disable_incaip_wdt
+	BAL(disable_incaip_wdt)
 	nop
 #endif
 
 	/* Initialize any external memory.
 	 */
-	bal	memsetup
+	BAL(memsetup)
 	nop
 
 	/* Initialize caches...
 	 */
-	bal	mips_cache_reset
+	BAL(mips_cache_reset)
 	nop
 
 	/* ... and enable them.
@@ -260,7 +289,7 @@
 	/* Set up temporary stack.
 	 */
 	li	a0, CFG_INIT_SP_OFFSET
-	bal	mips_cache_lock
+	BAL(mips_cache_lock)
 	nop
 
 	li	t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET
@@ -268,13 +297,8 @@
 
 	/* Initialize GOT pointer.
 	 */
-	bal	1f
-	nop
-	.word	_GLOBAL_OFFSET_TABLE_ - 1f + 4
-1:
-	move	gp, ra
-	lw	t1, 0(ra)
-	add	gp, t1
+	LOADGOT
+
 	la	t9, board_init_f
 	j	t9
 	nop

  reply	other threads:[~2005-01-29 10:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-29  2:13 [U-Boot-Users] MIPS build environment Dan Malek
2005-01-29 10:36 ` Thomas Sailer [this message]
2005-01-29 17:08   ` Wolfgang Denk
2005-01-29 23:54     ` Thomas Sailer
2005-01-30  1:22       ` Wolfgang Denk
2005-01-29 17:03 ` Wolfgang Denk
2005-01-30  0:20 ` Eugene Surovegin
2005-01-30  1:24   ` Wolfgang Denk
2005-01-30  1:43     ` Eugene Surovegin
2005-01-30  4:40       ` Dan Malek
2005-01-30  9:18         ` Wolfgang Denk
2005-01-30 10:33           ` Eugene Surovegin
2005-01-30  9:13       ` Wolfgang Denk
2005-01-30 10:26         ` Eugene Surovegin
2005-09-24 23:16           ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1106994990.5393.8.camel@gamecube.scs.ch \
    --to=sailer@scs.ch \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox