diff mbox

[U-Boot,RFC] ARM: mx31pdk: Use the new relocation scheme

Message ID 1294836544-24512-1-git-send-email-fabio.estevam@freescale.com
State Rejected
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Fabio Estevam Jan. 12, 2011, 12:49 p.m. UTC
Hi,

I am trying to make the new relocation scheme to work on the mx31pdk board.

With this patch applied the mx31pdk build works, but not able to get a U-boot prompt yet.

I copied the nand_spl/board/karo/tx25/u-boot.lds to the mx31pdk one.

I am not certain whether the CONFIG_SYS_TEXT_BASE should be changed or not:

ifdef CONFIG_NAND_SPL
CONFIG_SYS_TEXT_BASE = 0x87ec0000
else
CONFIG_SYS_TEXT_BASE = 0x87f00000
endif

If anyone has any comments/suggestions I will appreciate it.

Thanks,

Fabio Estevam

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/cpu/arm1136/start.S                |    4 +-
 board/freescale/mx31pdk/mx31pdk.c           |   10 ++++-
 include/configs/mx31pdk.h                   |    6 +++
 nand_spl/board/freescale/mx31pdk/u-boot.lds |   59 +++++++++++++++++++++++---
 4 files changed, 68 insertions(+), 11 deletions(-)

Comments

Stefano Babic Jan. 13, 2011, 1:38 p.m. UTC | #1
On 01/12/2011 01:49 PM, Fabio Estevam wrote:
> Hi,

Hi Fabio,

> 
> I am trying to make the new relocation scheme to work on the mx31pdk board.
> 
> With this patch applied the mx31pdk build works, but not able to get a U-boot prompt yet.

I have tried to imagine some issues, but I cannot find a clear reason.
Building with your patch I checked that nand_spl is still less than 2KB
code, and that matches the NAND page, as required by i.MX31 - so it is
not a problem.

Have you tried to disable the relocation, just to check if the
relocation is an issue with CONFIG_SKIP_RELOCATE_UBOOT ? This is not a
solution, but only to check what happens.

> 
> I copied the nand_spl/board/karo/tx25/u-boot.lds to the mx31pdk one.
> 
> I am not certain whether the CONFIG_SYS_TEXT_BASE should be changed or not:
> 
> ifdef CONFIG_NAND_SPL
> CONFIG_SYS_TEXT_BASE = 0x87ec0000
> else
> CONFIG_SYS_TEXT_BASE = 0x87f00000
> endif

I think they are ok - both addresses are valid RAM addresses. The
relocation will move then the code at the end of the RAM. And as I
understood from i.MX31 manual, the NFC controller does not use the IRAM
at all, so the area pointed by your starting stack pointer should not be
overwritten.

> 
> If anyone has any comments/suggestions I will appreciate it.

No great idea, really. Probably you need to attach a JTAG debugger and
see what happens.

Best regards,
Stefano Babic
Fabio Estevam Jan. 14, 2011, 6:33 p.m. UTC | #2
Hi Stefano,

On 1/13/2011 11:38 AM, Stefano Babic wrote:
> On 01/12/2011 01:49 PM, Fabio Estevam wrote:
>> Hi,
> 
> Hi Fabio,
> 
>>
>> I am trying to make the new relocation scheme to work on the mx31pdk board.
>>
>> With this patch applied the mx31pdk build works, but not able to get a U-boot prompt yet.
> 
> I have tried to imagine some issues, but I cannot find a clear reason.
> Building with your patch I checked that nand_spl is still less than 2KB
> code, and that matches the NAND page, as required by i.MX31 - so it is
> not a problem.
> 
> Have you tried to disable the relocation, just to check if the
> relocation is an issue with CONFIG_SKIP_RELOCATE_UBOOT ? This is not a
> solution, but only to check what happens.

Yes, I tried to disable relocation and U-boot still fails to boot.
 
>>
>> I copied the nand_spl/board/karo/tx25/u-boot.lds to the mx31pdk one.
>>
>> I am not certain whether the CONFIG_SYS_TEXT_BASE should be changed or not:
>>
>> ifdef CONFIG_NAND_SPL
>> CONFIG_SYS_TEXT_BASE = 0x87ec0000
>> else
>> CONFIG_SYS_TEXT_BASE = 0x87f00000
>> endif
> 
> I think they are ok - both addresses are valid RAM addresses. The
> relocation will move then the code at the end of the RAM. And as I
> understood from i.MX31 manual, the NFC controller does not use the IRAM
> at all, so the area pointed by your starting stack pointer should not be
> overwritten.
> 
>>
>> If anyone has any comments/suggestions I will appreciate it.
> 
> No great idea, really. Probably you need to attach a JTAG debugger and
> see what happens.

Yes, I am setting up a OpenOCD JTAG here to debug this.

Thanks,

Fabio Estevam
diff mbox

Patch

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 9a6f6cb..85b5e44 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -271,8 +271,8 @@  clbss_l:str	r2, [r0]		/* clear loop...		    */
 	ldr     r0, _nand_boot_ofs
 	adr	r1, _start
 	add	pc, r0, r1
-_nand_boot_ofs
-	: .word nand_boot - _start
+_nand_boot_ofs:	
+	.word nand_boot - _start
 #else
 jump_2_ram:
 	ldr	r0, _board_init_r_ofs
diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
index 9f47169..2756e5a 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -33,10 +33,16 @@  DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE,
+				PHYS_SDRAM_1_SIZE);
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
 	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
 	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
-
-	return 0;
 }
 
 int board_init(void)
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index 3b90a01..e3f8b9f 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -155,6 +155,12 @@ 
 #define PHYS_SDRAM_1		CSD0_BASE
 #define PHYS_SDRAM_1_SIZE	(128 * 1024 * 1024)
 
+#define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
+#define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
+#define CONFIG_SYS_GBL_DATA_OFFSET	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET)
+
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
  */
diff --git a/nand_spl/board/freescale/mx31pdk/u-boot.lds b/nand_spl/board/freescale/mx31pdk/u-boot.lds
index edd8430..ff289fb 100644
--- a/nand_spl/board/freescale/mx31pdk/u-boot.lds
+++ b/nand_spl/board/freescale/mx31pdk/u-boot.lds
@@ -1,3 +1,25 @@ 
+/*
+ * (C) Copyright 2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * 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-littlearm", "elf32-littlearm", "elf32-littlearm")
 OUTPUT_ARCH(arm)
 ENTRY(_start)
@@ -19,18 +41,41 @@  SECTIONS
 	.rodata : { *(.rodata) }
 
 	. = ALIGN(4);
-	.data : { *(.data) }
+	.data : {
+		*(.data)
+	}
 
 	. = ALIGN(4);
-	.got : { *(.got) }
-
-	. = .;
 	__u_boot_cmd_start = .;
 	.u_boot_cmd : { *(.u_boot_cmd) }
 	__u_boot_cmd_end = .;
 
 	. = ALIGN(4);
-	__bss_start = .;
-	.bss : { *(.bss) }
-	_end = .;
+
+	.rel.dyn : {
+		__rel_dyn_start = .;
+		*(.rel*)
+		__rel_dyn_end = .;
+	}
+
+	.dynsym : {
+		__dynsym_start = .;
+		*(.dynsym)
+	}
+
+	.bss __rel_dyn_start (OVERLAY) : {
+		__bss_start = .;
+		*(.bss)
+		 . = ALIGN(4);
+		_end = .;
+	}
+
+	/DISCARD/ : { *(.bss*) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynsym*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.hash*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
 }