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 sessionCode:
(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 connectionCode:
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