Skip to contentSkip to conversation

Got u-boot-2012.10 running on at91sam9200 - but why does it work?

U-Boot Arvid Brodin 2 participants 4 messages Oct 9, 2013 – Oct 11, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

Hi,

I managed to get u-boot-2012.10 to boot from NOR flash on a custom at91rm9200 board by doing this:

---
 arch/arm/cpu/arm920t/start.S   | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/cpu/arm920t/start.S +3 -5
index 14c9156..efc4ea3 100644
@@ -294,9 +294,7 @@ clbss_e:
 _nand_boot_ofs:
 	.word nand_boot
 #else
-	ldr	r0, _board_init_r_ofs
-	adr	r1, _start
-	add	lr, r0, r1
+	ldr	lr, _board_init_r
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
 	mov	r0, r5		/* gd_t */
@@ -304,8 +302,8 @@ _nand_boot_ofs:
 	/* jump to it ... */
 	mov	pc, lr
 
-_board_init_r_ofs:
-	.word board_init_r - _start
+_board_init_r:
+	.word board_init_r
 #endif
 
 _rel_dyn_start_ofs:
Signature · 16 lines
1.8.1.5

(I also had to comment out the CONFIG_AT91RM9200EK define in my custom board
config file.)

Any idea why this is needed? I simply used a LED to see where the un-touched 
code failed, and noticed it reached the board_init_r call but never entered the
function. I thought it a bit strange to first subtract _start in the variable
definition and the add it again in the code, so I tried without it, and -- lo
and behold! -- it worked.



-- 
Arvid Brodin | Consultant (Linux)
XDIN AB | Knarrarn?sgatan 7 | SE-164 40 Kista | Sweden | xdin.com
#1 lore raw

Hello Arvid,
Am 2013-10-09 21:23, schrieb Arvid Brodin:

Quoted 28 lines

Hi,

I managed to get u-boot-2012.10 to boot from NOR flash on a custom at91rm9200 board by doing this:

---
 arch/arm/cpu/arm920t/start.S   | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/cpu/arm920t/start.S +1 -3
index 14c9156..efc4ea3 100644
@@ -294,9 +294,7 @@ clbss_e:
 _nand_boot_ofs:
 	.word nand_boot
 #else
-	ldr	r0, _board_init_r_ofs
-	adr	r1, _start
-	add	lr, r0, r1
+	ldr	lr, _board_init_r
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
 	mov	r0, r5		/* gd_t */

arch/arm/cpu/arm920t/start.S _nand_boot_ofs: · line 309

Quoted 10 lines
arch/arm/cpu/arm920t/start.S +2 -2
@@ -304,8 +302,8 @@ _nand_boot_ofs:
 	/* jump to it ... */
 	mov	pc, lr
 
-_board_init_r_ofs:
-	.word board_init_r - _start
+_board_init_r:
+	.word board_init_r
 #endif
 
 _rel_dyn_start_ofs:

you don't need change start.s to boot from NOR. If shold set the #define CONFIG_SYS_TEXT_BASE 0x00000000

Please see the configuration for eb_cpux9k2 board. This board does boot from NOR with u-boot 2012.10.

BTW
The release 2012.10 is out of date. You should upadte to the current one (2013.10-rc4)

Best regards

Jens

#2 lore raw

[U-Boot] Got u-boot-2012.10 running on at91rm9200 - but why does it work?

Quoted 38 lines · Jens Scharsig

Hello Arvid,
Am 2013-10-09 21:23, schrieb Arvid Brodin:

Quoted 36 lines

Hi,

I managed to get u-boot-2012.10 to boot from NOR flash on a custom at91rm9200 board by doing this:

---
 arch/arm/cpu/arm920t/start.S   | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/cpu/arm920t/start.S +3 -5
index 14c9156..efc4ea3 100644
@@ -294,9 +294,7 @@ clbss_e:
 _nand_boot_ofs:
 	.word nand_boot
 #else
-	ldr	r0, _board_init_r_ofs
-	adr	r1, _start
-	add	lr, r0, r1
+	ldr	lr, _board_init_r
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
 	mov	r0, r5		/* gd_t */
@@ -304,8 +302,8 @@ _nand_boot_ofs:
 	/* jump to it ... */
 	mov	pc, lr
 
-_board_init_r_ofs:
-	.word board_init_r - _start
+_board_init_r:
+	.word board_init_r
 #endif
 
Quoted 5 lines

arch/arm/cpu/arm920t/start.S _nand_boot_ofs: · line 309

Quoted 2 lines
arch/arm/cpu/arm920t/start.S +0 -0
 _rel_dyn_start_ofs:

you don't need change start.s to boot from NOR. If shold set the #define CONFIG_SYS_TEXT_BASE 0x00000000

But that's just the thing, I *do* need this change for the board to boot. CONFIG_SYS_TEXT_BASE is 0x10000000 (this is the base address for the flash memory).

Without my patch above, I only get this:

----------
U-Boot 2012.10 (Oct 09 2013 - 02:28:44)

DRAM: 64 MiB
----------

I thought this was a known problem with at91rm9200 booting from NOR flash? There's at least one other board that I know of with the same problem (the Artila Matrix-500).

Quoted 2 lines

Please see the configuration for eb_cpux9k2 board. This board does boot from NOR with u-boot 2012.10.

Hmm, you are right. This config does boot my card (after I modify it to suit, of course). Besides the different CONFIG_SYS_TEXT_BASE, I think the main differences to the at91rm9200ek config that I based my earlier config on are these things:

#define CONFIG_SYS_BOOT_SIZE 0x00 /* 0 KBytes */
#define CONFIG_SYS_U_BOOT_BASE PHYS_FLASH_1
#define CONFIG_SYS_U_BOOT_SIZE 0x60000 /* 384 KBytes */

None of these are declared in the at91rm9200ek config.

Unfortunately, I don't have an AT91RM9200EK card, so I can't test if the problem I ran in to exists for that card as well using the at91rm9200ek config.

Signature · 2 lines
Arvid Brodin | Consultant (Linux)
XDIN AB | Knarrarn?sgatan 7 | SE-164 40 Kista | Sweden | xdin.com
#3 lore raw

[U-Boot] Got u-boot-2012.10 running on at91rm9200 - but why does it work?

Hello Arvid,

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

you don't need change start.s to boot from NOR. If shold set the #define CONFIG_SYS_TEXT_BASE 0x00000000

But that's just the thing, I *do* need this change for the board to boot. CONFIG_SYS_TEXT_BASE is 0x10000000 (this is the base address for the flash memory).

YES and NO:
The nor is physical mapped to 0x1000000 that's right.
But during boot from nor the Memory is also mapped to address 0x0. U-Boot is relocate to ram after ram init. The calculations of the reclocation process are based on "delta between PC and CONFIG_SYS_TEXT_BASE".

Quoted 9 lines

Without my patch above, I only get this:

----------
U-Boot 2012.10 (Oct 09 2013 - 02:28:44)

DRAM: 64 MiB
----------

So at this position u-boot try to jump to a wrong address or code in ram.

Quoted 13 lines

I thought this was a known problem with at91rm9200 booting from NOR flash? There's at least one other board that I know of with the same problem (the Artila Matrix-500).

Quoted 2 lines

Please see the configuration for eb_cpux9k2 board. This board does boot from NOR with u-boot 2012.10.

Hmm, you are right. This config does boot my card (after I modify it to suit, of course). Besides the different CONFIG_SYS_TEXT_BASE, I think the main differences to the at91rm9200ek config that I based my earlier config on are these things:

Quoted 5 lines

#define CONFIG_SYS_BOOT_SIZE 0x00 /* 0 KBytes */
#define CONFIG_SYS_U_BOOT_BASE PHYS_FLASH_1
#define CONFIG_SYS_U_BOOT_SIZE 0x60000 /* 384 KBytes */

None of these are declared in the at91rm9200ek config.

This are old items, which needs a clean up.

Quoted 1 line

Regards Jens