Skip to contentSkip to conversation

arm920t RAM relocation broken?

U-Boot-Users Cory T. Tusar 2 participants 3 messages Mar 6, 2008 – Mar 7, 2008

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Commit d4fc6012 added an #ifdef CONFIG_AT91RM9200 construct around the RAM relocation bits in cpu/arm920t/start.S. More directly, it added an entire secondary relocation snippet surrounded by an
#ifdef CONFIG_BOOTBINFUNC construct.

It appears that this second implementation was later removed in commit 80767a6c, but the #ifdef CONFIG_AT91RM9200 logic was not removed also.

Is RAM relocation only intended to function on at91rm9200 boards, or shall I submit a patch fixing the above?

- -Cory

- --
Cory T. Tusar
Embedded Systems Engineer
Videon Central, Inc.
2171 Sandy Drive
State College, PA 16803
(814) 235-1111 x316
(814) 235-1118 fax

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." --Sir Charles Anthony Richard Hoare

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFH0FyBHT1tsfGwHJ8RAvOfAJ9y75jQiJih+IJrbD2beYyVpYYpVwCfQQyz /eeY22e7RSWYFbH0iLFcGEM=
=yCLN
-----END PGP SIGNATURE-----

#1 lore raw

----- Original Message -----
From: "Cory T. Tusar" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, March 06, 2008 10:05 PM
Subject: [U-Boot-Users] arm920t RAM relocation broken?

Quoted 8 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Commit d4fc6012 added an #ifdef CONFIG_AT91RM9200 construct around the RAM relocation bits in cpu/arm920t/start.S. More directly, it added an entire secondary relocation snippet surrounded by an
#ifdef CONFIG_BOOTBINFUNC construct.

Quoted 8 lines

It appears that this second implementation was later removed in commit 80767a6c, but the #ifdef CONFIG_AT91RM9200 logic was not removed also.

Is RAM relocation only intended to function on at91rm9200 boards, or shall I submit a patch fixing the above?

- -Cory

Does this mean that the AT91RM9200 always relocates? Then the code is simply wrong.

If you run from a serial flash, then the code is already relocated and is executing from SDRAM at this point, so the code will crash.

Best Regards
Ulf Samuelsson

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 19 lines · Ulf Samuelsson

----- Original Message -----
From: "Cory T. Tusar" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, March 06, 2008 10:05 PM
Subject: [U-Boot-Users] arm920t RAM relocation broken?

Quoted 11 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Commit d4fc6012 added an #ifdef CONFIG_AT91RM9200 construct around the RAM relocation bits in cpu/arm920t/start.S. More directly, it added an entire secondary relocation snippet surrounded by an
#ifdef CONFIG_BOOTBINFUNC construct.

It appears that this second implementation was later removed in commit 80767a6c, but the #ifdef CONFIG_AT91RM9200 logic was not removed also.

Quoted 7 lines
Quoted 4 lines

Is RAM relocation only intended to function on at91rm9200 boards, or shall I submit a patch fixing the above?

- -Cory

Does this mean that the AT91RM9200 always relocates? Then the code is simply wrong.

No, there's an additional #ifndef CONFIG_SKIP_RELOCATE_UBOOT construct around the relocation code. The issue is that nothing /but/ AT91RM9200 /ever/ relocates the way it's currently coded.

The relevant chunk (lines 181-201) from cpu/arm920t/start.S:

#ifdef CONFIG_AT91RM9200

#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
beq stack_setup

ldr r2, _armboot_start
ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */

copy_loop:

	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */
	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
	cmp	r0, r2			/* until source end addreee [r2]    */
	ble	copy_loop

#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
#endif

Quoted 2 lines

If you run from a serial flash, then the code is already relocated and is executing from SDRAM at this point, so the code will crash.

Yes. This should be handled by CONFIG_SKIP_RELOCATE_UBOOT in the board's configuration, shouldn't it?

- -Cory

- --
Cory T. Tusar
Embedded Systems Engineer
Videon Central, Inc.
2171 Sandy Drive
State College, PA 16803
(814) 235-1111 x316
(814) 235-1118 fax

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." --Sir Charles Anthony Richard Hoare

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFH0ZEyHT1tsfGwHJ8RAg4jAJ9wF95+3lyL2o0szFVJOjDDm57TlgCgmI1D hM9rLWmlYeguSzKmaEJ88jI=
=6+iX
-----END PGP SIGNATURE-----