Skip to contentSkip to conversation

sh: make lds more generic

RFC PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 7 messages May 13, 2009 – Jun 1, 2009

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 sh: make lds more generic

currently the sh lds need to sync the lds enty and TEXT_BASE manualy and the reloc_dst is based on it

instead provide it now from the ldflags

tested on r2dplus

---
 board/mpr2/u-boot.lds              |   13 +++----------
 board/ms7720se/u-boot.lds          |   15 +++------------
 board/ms7722se/u-boot.lds          |   15 +++------------
 board/ms7750se/u-boot.lds          |   15 +++------------
 board/renesas/MigoR/u-boot.lds     |   15 +++------------
 board/renesas/ap325rxa/u-boot.lds  |   15 +++------------
 board/renesas/r2dplus/u-boot.lds   |   15 +++------------
 board/renesas/r7780mp/u-boot.lds   |   15 +++------------
 board/renesas/rsk7203/u-boot.lds   |   10 ++--------
 board/renesas/sh7763rdp/u-boot.lds |   15 +++------------
 board/renesas/sh7785lcr/u-boot.lds |    7 ++++---
 sh_config.mk                       |    1 +
 12 files changed, 34 insertions(+), 117 deletions(-)
board/mpr2/u-boot.lds +3 -10
index deae344..4180522 100644
@@ -34,16 +34,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x8C000000.
-	   U-Boot resides in the last 256 kB of the 64 MB.
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/ms7720se/u-boot.lds +3 -12
index 1f9b792..7aaaaf8 100644
@@ -31,18 +31,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/ms7722se/u-boot.lds +3 -12
index 7b0fb67..db3741c 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/ms7750se/u-boot.lds +3 -12
index 7b0fb67..db3741c 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/MigoR/u-boot.lds +3 -12
index c004b83..9b83cad 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/ap325rxa/u-boot.lds +3 -12
index 94bacca..9b83cad 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x88000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x88000000 + (128*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/r2dplus/u-boot.lds +3 -12
index e1c15b0..93a7d31 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x0C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/r7780mp/u-boot.lds +3 -12
index f32d0b8..93a7d31 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x08000000 + (128*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/rsk7203/u-boot.lds +2 -8
index bd4a550..7f3cfbd 100644
@@ -28,15 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	 * Base address of internal SDRAM is 0x0C000000.
-	 *
-	 * NOTE: This address must match with the definition of
-	 *TEXT_BASE in config.mk (in this directory).
+	 * entry and reloct_dst will be provide by command line
 	 */
-
-	. = 0x0C000000 + (8*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/sh7763rdp/u-boot.lds +3 -12
index b1a967d..93a7d31 100644
@@ -28,18 +28,9 @@ ENTRY(_start)
 SECTIONS
 {
 	/*
-	   Base address of internal SDRAM is 0x0C000000.
-	   Although size of SDRAM can be either 16 or 32 MBytes,
-	   we assume 16 MBytes (ie ignore upper half if the full
-	   32 MBytes is present).
-
-	   NOTE: This address must match with the definition of
-	   TEXT_BASE in config.mk (in this directory).
-
-	*/
-	. = 0x8C000000 + (64*1024*1024) - (256*1024);
-
-	PROVIDE (reloc_dst = .);
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
board/renesas/sh7785lcr/u-boot.lds +4 -3
index 255ab37..777ab92 100644
@@ -28,9 +28,10 @@ ENTRY(_start)
 
 SECTIONS
 {
-	. = 0x88000000 + (128 * 1024 * 1024) - (512 * 1024);
-
-	PROVIDE (reloc_dst = .);
+	/*
+	 * entry and reloct_dst will be provide by command line
+	 */
+	. = .;
 
 	PROVIDE (_ftext = .);
 	PROVIDE (_fcode = .);
sh_config.mk +1 -0
index 49d50f7..c19db53 100644
@@ -22,3 +22,4 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+PLATFORM_LDFLAGS += -e $(TEXT_BASE) --defsym reloc_dst=$(TEXT_BASE)
Signature · 1 line
1.6.1.3
#2 lore raw

RFC PATCH 1/2 sh: make lds more generic

2009/5/23 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines

currently the sh lds need to sync the lds enty and TEXT_BASE manualy and the reloc_dst is based on it

instead provide it now from the ldflags

tested on r2dplus

---

Ping

Sorry, answer is late.
I will test this patch, and rend report for you. If no problem, I will apply this patch to testing branch.

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu
#3 lore raw

RFC PATCH 2/2 sh: unify lds

In reply to Jean-Christophe PLAGNIOL-VILLARD

all sh boards use the same cpu lds so move it to cpu/$(CPU)

that could be overwrite in following order
SOC
BOARD
via the corresponding config.mk

tested on r2dplus

---
 board/ms7722se/u-boot.lds                     |   96 ------------------------
 board/ms7750se/u-boot.lds                     |   96 ------------------------
 board/renesas/MigoR/u-boot.lds                |   96 ------------------------
 board/renesas/ap325rxa/u-boot.lds             |   96 ------------------------
 board/renesas/r2dplus/u-boot.lds              |   96 ------------------------
 board/renesas/r7780mp/u-boot.lds              |   96 ------------------------
 board/renesas/sh7763rdp/u-boot.lds            |   96 ------------------------
 board/renesas/sh7785lcr/u-boot.lds            |   97 -------------------------
 {board/renesas/rsk7203 => cpu/sh2}/u-boot.lds |    0
 {board/mpr2 => cpu/sh3}/u-boot.lds            |    0
 {board/ms7720se => cpu/sh4}/u-boot.lds        |   12 ++--
 sh_config.mk                                  |    2 +
 12 files changed, 8 insertions(+), 775 deletions(-)
 delete mode 100644 board/ms7722se/u-boot.lds
 delete mode 100644 board/ms7750se/u-boot.lds
 delete mode 100644 board/renesas/MigoR/u-boot.lds
 delete mode 100644 board/renesas/ap325rxa/u-boot.lds
 delete mode 100644 board/renesas/r2dplus/u-boot.lds
 delete mode 100644 board/renesas/r7780mp/u-boot.lds
 delete mode 100644 board/renesas/sh7763rdp/u-boot.lds
 delete mode 100644 board/renesas/sh7785lcr/u-boot.lds
 rename {board/renesas/rsk7203 => cpu/sh2}/u-boot.lds (100%)
 rename {board/mpr2 => cpu/sh3}/u-boot.lds (100%)
 rename {board/ms7720se => cpu/sh4}/u-boot.lds (95%)
board/ms7722se/u-boot.lds deleted +0 -96
deleted file mode 100644
index db3741c..0000000
@@ -1,96 +0,0 @@
-/*
- * Copyrigth (c) 2007
- * Nobuhiro Iwamatsu <[email protected]>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
-OUTPUT_ARCH(sh)
-ENTRY(_start)
-
-SECTIONS
-{
-	/*
-	 * entry and reloct_dst will be provide by command line
-	 */
-	. = .;
-
-	PROVIDE (_ftext = .);
-	PROVIDE (_fcode = .);
-	PROVIDE (_start = .);
-
-	.text :
-	{
-		cpu/sh4/start.o		(.text)
-		. = ALIGN(8192);
-		common/env_embedded.o	(.ppcenv)
-		. = ALIGN(8192);
-		common/env_embedded.o	(.ppcenvr)
-		. = ALIGN(8192);
-		*(.text)
-		. = ALIGN(4);
-	} =0xFF
-	PROVIDE (_ecode = .);
-	.rodata :
-	{
-		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
-		. = ALIGN(4);
-	}
-	PROVIDE (_etext = .);
-
-
-	PROVIDE (_fdata = .);
-	.data :
-	{
-		*(.data)
-		. = ALIGN(4);
-	}
-	PROVIDE (_edata = .);
-
-	PROVIDE (_fgot = .);
-	.got :
-	{
-		*(.got)
-		. = ALIGN(4);
-	}
-	PROVIDE (_egot = .);
-
-	PROVIDE (__u_boot_cmd_start = .);
-	.u_boot_cmd :
-	{
-		*(.u_boot_cmd)
-		. = ALIGN(4);
-	}
-	PROVIDE (__u_boot_cmd_end = .);
-
-	PROVIDE (reloc_dst_end = .);
-	/* _reloc_dst_end = .; */
-
-	PROVIDE (bss_start = .);
-	PROVIDE (__bss_start = .);
-	.bss (NOLOAD) :
-	{
-		*(.bss)
-		. = ALIGN(4);
-	}
-	PROVIDE (bss_end = .);
-
-	PROVIDE (_end = .);
-}
board/ms7750se/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/MigoR/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/ap325rxa/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/r2dplus/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/r7780mp/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/sh7763rdp/u-boot.lds deleted +0 -96

96 lines not on this page · raw message

board/renesas/sh7785lcr/u-boot.lds deleted +0 -97

97 lines not on this page · raw message

cpu/sh2/u-boot.lds renamed from board/renesas/rsk7203/u-boot.lds +0 -0
similarity index 100%
rename from board/renesas/rsk7203/u-boot.lds
rename to cpu/sh2/u-boot.lds
cpu/sh3/u-boot.lds renamed from board/mpr2/u-boot.lds +0 -0
similarity index 100%
rename from board/mpr2/u-boot.lds
rename to cpu/sh3/u-boot.lds
cpu/sh4/u-boot.lds renamed from board/ms7720se/u-boot.lds +6 -6
similarity index 95%
rename from board/ms7720se/u-boot.lds
rename to cpu/sh4/u-boot.lds
index 7aaaaf8..80fb8f0 100644
@@ -1,10 +1,10 @@
 /*
- * Copyrigth (c) 2007
- * Yoshihiro Shimoda <[email protected]>
- *
- * Copyrigth (c) 2007
+ * Copyright (C) 2007
  * Nobuhiro Iwamatsu <[email protected]>
  *
+ * Copyright (C) 2008-2009
+ * Yoshihiro Shimoda <[email protected]>
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -41,7 +41,7 @@ SECTIONS
 
 	.text :
 	{
-		cpu/sh3/start.o		(.text)
+		cpu/sh4/start.o		(.text)
 		. = ALIGN(8192);
 		common/env_embedded.o	(.ppcenv)
 		. = ALIGN(8192);
@@ -88,7 +88,7 @@ SECTIONS
 
 	PROVIDE (bss_start = .);
 	PROVIDE (__bss_start = .);
-	.bss :
+	.bss (NOLOAD) :
 	{
 		*(.bss)
 		. = ALIGN(4);
sh_config.mk +2 -0
index c19db53..407e076 100644
@@ -23,3 +23,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
 PLATFORM_LDFLAGS += -e $(TEXT_BASE) --defsym reloc_dst=$(TEXT_BASE)
+
+LDSCRIPT := $(SRCTREE)/cpu/$(CPU)/u-boot.lds
Signature · 1 line
1.6.1.3
#4 lore raw

RFC PATCH 1/2 sh: make lds more generic

In reply to Jean-Christophe PLAGNIOL-VILLARD

2009/5/14 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 9 lines

currently the sh lds need to sync the lds enty and TEXT_BASE manualy and the reloc_dst is based on it

instead provide it now from the ldflags

tested on r2dplus

Appilied these patch collection.
Thank you!

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu
#5 lore raw

RFC PATCH 1/2 sh: make lds more generic

Dear Nobuhiro Iwamatsu,

Quoted 6 lines · In message <[email protected]> you…

2009/5/14 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 5 lines

currently the sh lds need to sync the lds enty and TEXT_BASE manualy and the reloc_dst is based on it

instead provide it now from the ldflags

Quoted 7 lines
Quoted 4 lines

tested on r2dplus

Appilied these patch collection.
Thank you!

Sorry, but I don't agree. The commit message is terrible. "sh lds need to sync the lds enty" - what is that suppoosed to mean?

I insist on readable and understandable commit messages.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I perceive a possibility of an immediate  chronological  sequence  of
events which includes a violence.
                        - Terry Pratchett, _The Dark Side of the Sun_
#6 lore raw

RFC PATCH 1/2 sh: make lds more generic

Hi, Wolfgang.

2009/5/27 Wolfgang Denk <[email protected]>:

Quoted 14 lines

Dear Nobuhiro Iwamatsu,

Quoted 11 lines · In message <[email protected]> you…

2009/5/14 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 9 lines

currently the sh lds need to sync the lds enty and TEXT_BASE manualy and the reloc_dst is based on it

instead provide it now from the ldflags

tested on r2dplus

Quoted 8 lines
Quoted 2 lines

Appilied these patch collection.
Thank you!

Sorry, but I don't agree. The commit message is terrible. "sh lds need to sync the lds enty" - what is that suppoosed to mean?

I insist on readable and understandable commit messages.

OK , you are right.

Jean-Christophe, please update commit message and resend.

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu