Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Copying AT91Bootstrap to NAND Flash
PostPosted: Sat Aug 21, 2010 3:07 am 
Offline
User avatar

Joined: Mon Jul 19, 2010 8:47 pm
Posts: 59
Hi all,

With the help of the wisdom of blue_z, I have managed to load AT91Bootstrap and U-boot into the SRAM and SDRAM of the custom 9G20 board I'm working on. I've also been able to load a second copy of U-boot into SDRAM, and then copy that to NAND Flash. At present, I can load AT91Bootstrap via JTAG, and it will pull U-boot out of NAND Flash and execute it. This is great progress.

Here's where I'm stuck: AT91Bootstrap is in SRAM, which means I need to reload it after every reset. Strangely, the method I used to copy U-boot to Flash does not appear to work for AT91Bootstrap.

Here's what worked for U-boot.

GDB session
Code:
(gdb) load AT91Bootstrap.elf
Loading section .text, size 0xfb8 lma 0x200000
Loading section .data, size 0xc4 lma 0x200fb8
Start address 0x200000, load size 4220
Transfer rate: 29 KB/sec, 2110 bytes/write.
(gdb) load u-boot
Loading section .text, size 0x221d0 lma 0x23f00000
Loading section .rodata, size 0x7dc2 lma 0x23f221d0
Loading section .data, size 0x1983 lma 0x23f29f94
Loading section .u_boot_cmd, size 0x450 lma 0x23f2b918
Start address 0x23f00000, load size 179557
Transfer rate: 77 KB/sec, 13812 bytes/write.
(gdb) load u-boot 0x200000
Loading section .text, size 0x221d0 lma 0x24100000
Loading section .rodata, size 0x7dc2 lma 0x241221d0
Loading section .data, size 0x1983 lma 0x24129f94
Loading section .u_boot_cmd, size 0x450 lma 0x2412b918
Start address 0x23f00000, load size 179557
Transfer rate: 77 KB/sec, 13812 bytes/write.
(gdb) quit


U-boot session over DBGU serial connection
Code:
U-Boot> nand device 0
Device 0: NAND 256MiB 3,3V 8-bit... is now current device

U-Boot> nand write 0x24100000 0x20000 0xB0000
NAND write: device 0 offset 0x20000, size 0xb0000
720896 bytes written: OK


When I try the same trick with AT91Bootstrap, the board does not boot from Flash.
Code:
(gdb) load AT91Bootstrap.elf 0x24100000
Loading section .text, size 0xfcc lma 0x24300000
Loading section .data, size 0xc4 lma 0x24300fcc
Start address 0x200000, load size 4240
Transfer rate: 29 KB/sec, 2120 bytes/write.
(gdb) continue


Code:
U-Boot> nand device 0
Device 0: NAND 256MiB 3,3V 8-bit... is now current device
U-Boot> nand write 0x24300000 0x0000 0x2000

NAND write: device 0 offset 0x0, size 0x2000
8192 bytes written: OK


I have considered the possibility that maybe the copying to Flash is working, but that the booting is not. However, I don't think this is the problem-- if I read out the first few bytes of Flash into SDRAM using U-boot's nand read function, I don't get see the interrupt vector table that I can see at the start of the AT91Bootstrap binary. Here's the evidence:

Code:
U-Boot> md 0x20200000 16
20200000: 000800d7 000800d8 000800c9 000800d8    ................
20200010: 000800db 000800dc 000800dd 000800de    ................
20200020: 000800df 000800e0 000800c1 000800e2    ................
20200030: 000800e3 000802e4 000800e5 000800e6    ................
20200040: 000800e7 000800e8 000800e9 000800ea    ................
20200050: 000800eb 000800ec    ........

U-Boot> nand read 0x20200000 0x0000 16

NAND read: device 0 offset 0x0, size 0x16
22 bytes read: OK

U-Boot> md 0x20200000 16             
20200000: 00000005 00000000 00000001 00000000    ................
20200010: 00000001 00080090 000800dd 000800de    ................
20200020: 000800df 000800e0 000800c1 000800e2    ................
20200030: 000800e3 000802e4 000800e5 000800e6    ................
20200040: 000800e7 000800e8 000800e9 000800ea    ................
20200050: 000800eb 000800ec    ........


You can see that the first few bytes have changed, which suggests that the nand read command is working. But those bytes don't match the starting bytes of AT91Bootstrap.

Any ideas as to what I'm doing wrong? Should I expect the nand write command to work the way I'm using it? Perhaps it's an issue of loading an ELF file rather than a .bin?

Thanks,
Brandon

_________________
Brandon Stafford
Rascal Micro


Top
 Profile  
 
 Post subject: Re: Copying AT91Bootstrap to NAND Flash
PostPosted: Sat Aug 21, 2010 5:08 am 
Offline

Joined: Thu Jul 08, 2010 9:36 pm
Posts: 28
Yes, you must program the binary variant into NAND, check before writing to flash whether the image has the vectors at the beginning, including the proper size entry.

Since you are initially going to boot from NAND you should be aware of the following errata:

44.3.5.1 RSTC: Reset During SDRAM Accesses
When a User Reset occurs during SDRAM read access, the SDRAM clock is turned off while
data are ready to be read on the data bus. The SDRAM maintains the data until the clock
restarts.
If the user Reset is programmed to assert a general reset, the data maintained by the SDRAM
leads to a data bus conflict and adversely affects the boot memories connected on the EBI:
• NAND Flash boot functionality, if the system boots out of internal ROM.
• NOR Flash boot, if the system boots on an external memory connected on the EBI CS0.

I think that errata that seems to be shared by (all?) AT91SAM9 devices makes them unreliable to boot from any EBI connected storage.

Reinhard


Top
 Profile  
 
 Post subject: Re: Copying AT91Bootstrap to NAND Flash
PostPosted: Thu Feb 02, 2012 5:29 pm 
Offline

Joined: Wed Jul 07, 2010 7:10 am
Posts: 8
is it resolved? thanks.


Top
 Profile  
 
 Post subject: Re: Copying AT91Bootstrap to NAND Flash
PostPosted: Thu Feb 02, 2012 10:52 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Quote:
is it resolved? thanks.


Most of you failing here are not correctly formatting the image to pass the RomBOOT sanity checks.

Reinhard basically states the issue here:

reinhardm wrote:
Yes, you must program the binary variant into NAND, check before writing to flash whether the image has the vectors at the beginning, including the proper size entry.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: