Skip to contentSkip to conversation

arm: vf610: fix boot from SD-card

PATCH In review Stefan Agner 5 participants 7 messages Jan 8, 2015 – Jan 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: vf610: fix boot from SD-card

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr"). It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM. However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all). This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

---
We use U-Boot from gfxRAM on Vybrid since quite a while for the Colibri VF50/VF61 modules in our downstream U-Boot branch. Hence this is quite well tested.

Just today I discovered that this is broken on the Tower module. Back then, when I made the offending change, I only tested on the Tower board using the serial loader, since I thought the behaviour should be exactly the same. But now, I know better... :-)

If still possible, it would be great to get this into v2015.01...

 include/configs/vf610twr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/vf610twr.h +4 -1
index 6fd0b17..bd79e81 100644
@@ -125,7 +125,10 @@
 #define CONFIG_BOOTDELAY		3
 
 #define CONFIG_LOADADDR			0x82000000
-#define CONFIG_SYS_TEXT_BASE		0x3f008000
+
+/* We boot from the gfxRAM area of the OCRAM. */
+#define CONFIG_SYS_TEXT_BASE		0x3f408000
+#define CONFIG_BOARD_SIZE_LIMIT		524288
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
Signature · 1 line
2.2.1
#1 lore raw

PATCH 1/1 arm: vf610: fix boot from SD-card

Quoted 33 lines · stefan at agner.ch

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr"). It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM. However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all). This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

---
We use U-Boot from gfxRAM on Vybrid since quite a while for the Colibri VF50/VF61 modules in our downstream U-Boot branch. Hence this is quite well tested.

Just today I discovered that this is broken on the Tower module. Back then, when I made the offending change, I only tested on the Tower board using the serial loader, since I thought the behaviour should be exactly the same. But now, I know better... :-)

If still possible, it would be great to get this into v2015.01...

include/configs/vf610twr.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/vf610twr.h +0 -0
index 6fd0b17..bd79e81 100644
@@ -125,7 +125,10 @@
 #define CONFIG_BOOTDELAY		3

include/configs/vf610twr.h line 134

Quoted 10 lines
include/configs/vf610twr.h +4 -1
 
 #define CONFIG_LOADADDR			0x82000000
-#define CONFIG_SYS_TEXT_BASE		0x3f008000
+
+/* We boot from the gfxRAM area of the OCRAM. */
+#define CONFIG_SYS_TEXT_BASE		0x3f408000
+#define CONFIG_BOARD_SIZE_LIMIT		524288
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \

See also:
http://lists.denx.de/pipermail/u-boot/2014-December/197641.html

It seems since v2014.04 u-boot on the Vybrid Tower SD card has not booted. Most users will probably boot this way.

https://community.freescale.com/docs/DOC-95248

Thanks,
Bill Pringlemeir.

#2 lore raw

PATCH 1/1 arm: vf610: fix boot from SD-card

Hi Bill,

Quoted 43 lines · Bill Pringlemeir
Quoted 41 lines · stefan at agner.ch

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr"). It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM. However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all). This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

---
We use U-Boot from gfxRAM on Vybrid since quite a while for the Colibri VF50/VF61 modules in our downstream U-Boot branch. Hence this is quite well tested.

Just today I discovered that this is broken on the Tower module. Back then, when I made the offending change, I only tested on the Tower board using the serial loader, since I thought the behaviour should be exactly the same. But now, I know better... :-)

If still possible, it would be great to get this into v2015.01...

include/configs/vf610twr.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/vf610twr.h +4 -1
index 6fd0b17..bd79e81 100644
@@ -125,7 +125,10 @@
 #define CONFIG_BOOTDELAY		3
 
 #define CONFIG_LOADADDR			0x82000000
-#define CONFIG_SYS_TEXT_BASE		0x3f008000
+
+/* We boot from the gfxRAM area of the OCRAM. */
+#define CONFIG_SYS_TEXT_BASE		0x3f408000
+#define CONFIG_BOARD_SIZE_LIMIT		524288
 
Quoted 4 lines

include/configs/vf610twr.h line 134

Quoted 2 lines
include/configs/vf610twr.h +0 -0
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \

Thx!

Quoted 3 lines

See also:
http://lists.denx.de/pipermail/u-boot/2014-December/197641.html

Oh, I even gave my Ack for that, but I did not remember it! Oh dear!

Quoted 4 lines

It seems since v2014.04 u-boot on the Vybrid Tower SD card has not booted. Most users will probably boot this way.

https://community.freescale.com/docs/DOC-95248

Yes I agree, hence it would be nice to have that working again in 2015.1...

I also think that meta-fsl-arm creates a SD-card boot-able image by default, but not sure whether mainline U-boot is in use there or not. Added Otavio for that matter...

Albert, any chance that can make it into 2015.1 too?

--
Stefan

#3 lore raw

PATCH 1/1 arm: vf610: fix boot from SD-card

On Fri, Jan 9, 2015 at 12:13 PM, Stefan Agner <[email protected]> wrote:
...

Quoted 3 lines

I also think that meta-fsl-arm creates a SD-card boot-able image by default, but not sure whether mainline U-boot is in use there or not. Added Otavio for that matter...

Yes we generate and use U-Boot mainline. So I think we ought to backport this fix for 2014.10 there as well.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#4 lore raw

PATCH 1/1 arm: vf610: fix boot from SD-card

In reply to Stefan Agner

Hi Tom, hi Stefan,

Quoted 64 lines · Stefan Agner

Hi Bill,

Quoted 43 lines · Bill Pringlemeir
Quoted 41 lines · stefan at agner.ch

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr"). It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM. However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all). This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

---
We use U-Boot from gfxRAM on Vybrid since quite a while for the Colibri VF50/VF61 modules in our downstream U-Boot branch. Hence this is quite well tested.

Just today I discovered that this is broken on the Tower module. Back then, when I made the offending change, I only tested on the Tower board using the serial loader, since I thought the behaviour should be exactly the same. But now, I know better... :-)

If still possible, it would be great to get this into v2015.01...

include/configs/vf610twr.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/vf610twr.h +4 -1
index 6fd0b17..bd79e81 100644
@@ -125,7 +125,10 @@
 #define CONFIG_BOOTDELAY		3
 
 #define CONFIG_LOADADDR			0x82000000
-#define CONFIG_SYS_TEXT_BASE		0x3f008000
+
+/* We boot from the gfxRAM area of the OCRAM. */
+#define CONFIG_SYS_TEXT_BASE		0x3f408000
+#define CONFIG_BOARD_SIZE_LIMIT		524288
 
Quoted 4 lines

include/configs/vf610twr.h line 134

Quoted 2 lines
include/configs/vf610twr.h +0 -0
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \

Thx!

Quoted 3 lines

See also:
http://lists.denx.de/pipermail/u-boot/2014-December/197641.html

Oh, I even gave my Ack for that, but I did not remember it! Oh dear!

Quoted 4 lines

It seems since v2014.04 u-boot on the Vybrid Tower SD card has not booted. Most users will probably boot this way.

https://community.freescale.com/docs/DOC-95248

Quoted 9 lines

Yes I agree, hence it would be nice to have that working again in 2015.1...

I also think that meta-fsl-arm creates a SD-card boot-able image by default, but not sure whether mainline U-boot is in use there or not. Added Otavio for that matter...

Albert, any chance that can make it into 2015.1 too?

Maybe it is better if Tom can pick it up directly into his tree, avoiding to go through custodian's tree. Release is coming soon :-).

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 1/1 arm: vf610: fix boot from SD-card

In reply to Stefan Agner
Quoted 2 lines · stefan at agner.ch

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr").

It was broke before that when fsl_qspi was added? Or at least that also added a lot of code. It maybe dependant on the compiler (and hence binary size).

Quoted 3 lines

It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM.

I didn't think of this. That is a possibility.

Quoted 4 lines

However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all).

I have tried various u-boot images with git-bisect. For instance when the QSPI was added, I had issues. It seems that an image near 220k was a threshold. The offset in the On-chip SRAM is 0x8000 (from the 'ld' file) and the imximage prints '3f008000'. So, I think that the offset takes the breaking point to where we cross from OC-SRAM0 to OC-SRAM1; I guess a stack maybe located here but it must be fairly small. I thought that maybe the HAB has a mapping of device memory start/size and didn't like it when we crossed the boundary.

Quoted 2 lines

This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

Whatever the issue is, this fixes it for me as well. I would guess that NAND boot is also not possible or probably anything but serial-download modes.

Thanks,
Bill Pringlemeir.

#6 lore raw
In reply to Stefan Agner
Quoted 11 lines · Stefan Agner

Boot from SD-card (and probably also from NAND) was broken since commit d6d07a9bec ("arm: vf610: add NAND support for vf610twr"). It looks like the increased size of U-Boot lead to a situation where the boot ROM overwrote its own stack/heap while loading U-Boot from the SD-card to the SRAM. However, U-Boot worked fine when loaded through USB serial loader directly into SRAM. It looks like loading from SD-card uses other stack/heap location then the serial loader (or maybe no stack or heap at all). This fix moves U-Boot to gfxRAM, which is 512kB in size and is not used by the boot ROM nor the SD-card loader of it.

Quoted 2 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150109/901c1d5e/attachment.pgp>