Skip to contentSkip to conversation

arm: Fixed the offset for the no relocation.

PATCH Superseded Zhong Hongbo 3 participants 8 messages Sep 2, 2012 – Sep 6, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

---
Change for V3:
- Drop the change of arm720t, It has already merge the change.
Change for V2:
- Clean a line for arm1176.

---
 arch/arm/cpu/arm1136/start.S   |    1 +
 arch/arm/cpu/arm1176/start.S   |    1 +
 arch/arm/cpu/arm920t/start.S   |    1 +
 arch/arm/cpu/arm925t/start.S   |    1 +
 arch/arm/cpu/arm926ejs/start.S |    1 +
 arch/arm/cpu/arm946es/start.S  |    1 +
 arch/arm/cpu/arm_intcm/start.S |    1 +
 arch/arm/cpu/ixp/start.S       |    1 +
 arch/arm/cpu/lh7a40x/start.S   |    1 +
 arch/arm/cpu/pxa/start.S       |    1 +
 arch/arm/cpu/s3c44b0/start.S   |    1 +
 arch/arm/cpu/sa1100/start.S    |    1 +
 12 files changed, 12 insertions(+)
arch/arm/cpu/arm1136/start.S +1 -0
index 2483c63..3752af9 100644
@@ -190,6 +190,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm1176/start.S +1 -0
index d613641..667a0e0 100644
@@ -252,6 +252,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm920t/start.S +1 -0
index 9b8604e..14c9156 100644
@@ -210,6 +210,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm925t/start.S +1 -0
index 1a54416..3a483f6 100644
@@ -204,6 +204,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm926ejs/start.S +1 -0
index 6f05f1a..1b530dc 100644
@@ -235,6 +235,7 @@ stack_setup:
 	adr	r0, _start
 	sub	r9, r6, r0		/* r9 <- relocation offset */
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm946es/start.S +1 -0
index b4d1d2d..30e2183 100644
@@ -175,6 +175,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm_intcm/start.S +1 -0
index b85e7d4..a133d19 100644
@@ -171,6 +171,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/ixp/start.S +1 -0
index 59c359a..c12f1a7 100644
@@ -273,6 +273,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/lh7a40x/start.S +1 -0
index bd68cd4..33b9269 100644
@@ -184,6 +184,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/pxa/start.S +1 -0
index 33c73f6..536cf5c 100644
@@ -197,6 +197,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/s3c44b0/start.S +1 -0
index 8daf26c..323b923 100644
@@ -156,6 +156,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/sa1100/start.S +1 -0
index bcea2a8..1ea92d1 100644
@@ -160,6 +160,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Sorry, Add Albert to the thread.

Thanks,
hongbo

Quoted 171 lines · Zhong Hongbo

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

---
Change for V3:
- Drop the change of arm720t, It has already merge the change.
Change for V2:
- Clean a line for arm1176.

---
 arch/arm/cpu/arm1136/start.S   |    1 +
 arch/arm/cpu/arm1176/start.S   |    1 +
 arch/arm/cpu/arm920t/start.S   |    1 +
 arch/arm/cpu/arm925t/start.S   |    1 +
 arch/arm/cpu/arm926ejs/start.S |    1 +
 arch/arm/cpu/arm946es/start.S  |    1 +
 arch/arm/cpu/arm_intcm/start.S |    1 +
 arch/arm/cpu/ixp/start.S       |    1 +
 arch/arm/cpu/lh7a40x/start.S   |    1 +
 arch/arm/cpu/pxa/start.S       |    1 +
 arch/arm/cpu/s3c44b0/start.S   |    1 +
 arch/arm/cpu/sa1100/start.S    |    1 +
 12 files changed, 12 insertions(+)
arch/arm/cpu/arm1136/start.S +1 -0
index 2483c63..3752af9 100644
@@ -190,6 +190,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm1176/start.S +1 -0
index d613641..667a0e0 100644
@@ -252,6 +252,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm920t/start.S +1 -0
index 9b8604e..14c9156 100644
@@ -210,6 +210,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm925t/start.S +1 -0
index 1a54416..3a483f6 100644
@@ -204,6 +204,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm926ejs/start.S +1 -0
index 6f05f1a..1b530dc 100644
@@ -235,6 +235,7 @@ stack_setup:
 	adr	r0, _start
 	sub	r9, r6, r0		/* r9 <- relocation offset */
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm946es/start.S +1 -0
index b4d1d2d..30e2183 100644
@@ -175,6 +175,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/arm_intcm/start.S +1 -0
index b85e7d4..a133d19 100644
@@ -171,6 +171,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/ixp/start.S +1 -0
index 59c359a..c12f1a7 100644
@@ -273,6 +273,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/lh7a40x/start.S +1 -0
index bd68cd4..33b9269 100644
@@ -184,6 +184,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/pxa/start.S +1 -0
index 33c73f6..536cf5c 100644
@@ -197,6 +197,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/s3c44b0/start.S +1 -0
index 8daf26c..323b923 100644
@@ -156,6 +156,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
arch/arm/cpu/sa1100/start.S +1 -0
index bcea2a8..1ea92d1 100644
@@ -160,6 +160,7 @@ stack_setup:
 
 	adr	r0, _start
 	cmp	r0, r6
+	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
 	beq	clear_bss		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
#2 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

In reply to Zhong Hongbo

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Quoted 6 lines

---
Change for V3:
- Drop the change of arm720t, It has already merge the change.
Change for V2:
- Clean a line for arm1176.

[...]

Best regards,
Marek Vasut

#3 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Quoted 8 lines · Marek Vasut

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Hi Marek

When you adopt CONFIG_SPL_BUILD framework, no CONFIG_NAND_SPL, if the addr of destination is equal to _start, we should skip u-boot relocation.

In the last, u-boot will count the dest addr, see the below:

        adr     r1, _start
        add     lr, r0, r1
        add     lr, lr, r9

Here, lr = lr + r9, r9 is the offset of u-boot, So when it do not neet to reolocat, we need to set the zero value for r9 register.

/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr

Thanks,
hongbo

Quoted 13 lines
Quoted 7 lines

---
Change for V3:
- Drop the change of arm720t, It has already merge the change.
Change for V2:
- Clean a line for arm1176.

[...]

Best regards,
Marek Vasut

#4 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Quoted 21 lines · Zhong Hongbo
Quoted 8 lines · Marek Vasut

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Hi Marek

When you adopt CONFIG_SPL_BUILD framework, no CONFIG_NAND_SPL, if the addr of destination is equal to _start, we should skip u-boot relocation.

In the last, u-boot will count the dest addr, see the below:

        adr     r1, _start
        add     lr, r0, r1
        add     lr, lr, r9
Quoted 8 lines

Here, lr = lr + r9, r9 is the offset of u-boot, So when it do not neet to reolocat, we need to set the zero value for r9 register.

/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr

I can confirm this issue - I see this when I ported SPL to a MX35 board. However, clearing r9 was not enough. I had to fix also _rel_dyn_* to make SPL working, and I did changing the start.S in the same way start.S for arv7 is built.

Do you not have these issues ?

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Quoted 31 lines · Stefano Babic
Quoted 21 lines · Zhong Hongbo
Quoted 8 lines · Marek Vasut

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Hi Marek

When you adopt CONFIG_SPL_BUILD framework, no CONFIG_NAND_SPL, if the addr of destination is equal to _start, we should skip u-boot relocation.

In the last, u-boot will count the dest addr, see the below:

        adr     r1, _start
        add     lr, r0, r1
        add     lr, lr, r9
Quoted 8 lines

Here, lr = lr + r9, r9 is the offset of u-boot, So when it do not neet to reolocat, we need to set the zero value for r9 register.

/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr

Quoted 6 lines

I can confirm this issue - I see this when I ported SPL to a MX35 board. However, clearing r9 was not enough. I had to fix also _rel_dyn_* to make SPL working, and I did changing the start.S in the same way start.S for arv7 is built.

Do you not have these issues ?

Hi Stefano,

That is enough for my smdk6400 board.

Thanks,
hongbo

Quoted 4 lines

Regards,
Stefano

#6 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Quoted 37 lines · Zhong Hongbo
Quoted 36 lines · Stefano Babic
Quoted 21 lines · Zhong Hongbo
Quoted 8 lines · Marek Vasut

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Hi Marek

When you adopt CONFIG_SPL_BUILD framework, no CONFIG_NAND_SPL, if the addr of destination is equal to _start, we should skip u-boot relocation.

In the last, u-boot will count the dest addr, see the below:

        adr     r1, _start
        add     lr, r0, r1
        add     lr, lr, r9
Quoted 8 lines

Here, lr = lr + r9, r9 is the offset of u-boot, So when it do not neet to reolocat, we need to set the zero value for r9 register.

/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr

I can confirm this issue - I see this when I ported SPL to a MX35 board. However, clearing r9 was not enough. I had to fix also _rel_dyn_* to make SPL working, and I did changing the start.S in the same way start.S for arv7 is built.

Quoted 4 lines
Quoted 1 line

Do you not have these issues ?

Hi Stefano,

That is enough for my smdk6400 board.

Ok, thanks. Then I will post a patch on top of yours, but here my:

Tested on a i.MX35 board (ARM1136) with SPL.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#7 lore raw

PATCH v3 1/1 arm: Fixed the offset for the no relocation.

Quoted 38 lines · Stefano Babic
Quoted 37 lines · Zhong Hongbo
Quoted 36 lines · Stefano Babic
Quoted 21 lines · Zhong Hongbo
Quoted 8 lines · Marek Vasut

Dear Zhong Hongbo,

Quoted 4 lines

From: Zhong Hongbo <[email protected]>

When the u-boot address of destination equal to __start, no relocation. relocation offset(r9) = 0.

Good, now what kind of issue does this patch fix?

Hi Marek

When you adopt CONFIG_SPL_BUILD framework, no CONFIG_NAND_SPL, if the addr of destination is equal to _start, we should skip u-boot relocation.

In the last, u-boot will count the dest addr, see the below:

        adr     r1, _start
        add     lr, r0, r1
        add     lr, lr, r9
Quoted 8 lines

Here, lr = lr + r9, r9 is the offset of u-boot, So when it do not neet to reolocat, we need to set the zero value for r9 register.

/* setup parameters for board_init_r */
mov r0, r5 /* gd_t */
mov r1, r6 /* dest_addr */
/* jump to it ... */
mov pc, lr

I can confirm this issue - I see this when I ported SPL to a MX35 board. However, clearing r9 was not enough. I had to fix also _rel_dyn_* to make SPL working, and I did changing the start.S in the same way start.S for arv7 is built.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Do you not have these issues ?

Hi Stefano,

That is enough for my smdk6400 board.

Hi Stefano,

Quoted 5 lines

Ok, thanks. Then I will post a patch on top of yours, but here my:

Tested on a i.MX35 board (ARM1136) with SPL.

Ok, Thanks,

BR,
hongbo

Quoted 5 lines

Regards,
Stefano