
I can fix this problem not but I really don't understand how the problem happens in the first place. I found gp got changed in relocate_code in file start.S.
In relocate_code "function", the $gp is adjusted to point to the new location, but somehow before program jumps to the relocated place, $gp was changed. But I don't know where it is changed. So I used t8 register to save the adjusted gp, and put it back before it jump to DRAM. But I don't know why $gp was changed in the between. Can someone give me some idea? I did not touch any thing else in this file.
/* * Fix $gp: * * New $gp = (Old $gp - CONFIG_SYS_MONITOR_BASE) + Destination Address */ move t6, gp sub gp, CONFIG_SYS_MONITOR_BASE add gp, a2 /* gp now adjusted */ move t8, gp /* add here <=== save gp */
...
/* Jump to where we've relocated ourselves. */ move gp, t8 /* add here <=== copy gp back */ addi t0, s2, in_ram - _start jr t0 nop
On Thu, 01 Oct 2009 18:25 -0500, wpa@fastmail.fm wrote:
I just found something interesting -
In my previous email I thought the CFI detection was running from DRAM, but that assumption seems to be wrong. Previously I though it was running from DRAM because I traced the execution using BDI into mips/start">cpu/mips/start.S relocate_code, it runs to the place where it relocates itself. To be exact, here -
addi t0, s2, in_ram - start jr t0 nop
I checked and found the pc register changed to pointing to a SDRAM location, so relocation seems to be fine. I also load the symbol-file to the DRAM location at that point. But afterwards if I set breakpoint to board_init_r, the breakpoint is not triggered.
Then I realized if I keep using the same symbol-file, the breakpoint at board_init_r can be triggered, and at that point, I can see the PC is still pointing to the flash.
I don't understand how can the code, which has been relocated to SDRAM at one point, suddenly going back to run in the flash when it calls board_init_r. Can someone help me?
Thanks.
On Thu, 01 Oct 2009 16:47 -0500, wpa@fastmail.fm wrote:
I have a working u-boot 2008.10 on a mips 32 board and am trying to port it over to u-boot 2009.06. So I used buildroot 2009.08 to build the tool chain for my mips32 board as well as u-boot2009.06. I also copied the previous u-boot initialization code to initialize timer, serial port, ram and etc from u-boot 2008.10 to 2009.06.
Right now the problem is the new u-boot 2009.06 does not detect cfi of the flash. I am pretty sure u-boot is running from SDRAM when the problem happens because the address is in the range of SDRAM. Please let me know if you have any suggestion - I am running out of ideas. I am attaching the printout from both the working u-boot 2008.10 and u-boot 2009.06 below.
Thanks a lot.
U-Boot 2009.06 (Sep 30 2009 - 18:41:26)
Reset Cause: Hardware Reset DRAM: 64 MB Top of RAM usable for U- Boot at: 98000000 Reserving 139k for U-Boot at: 97fdc000 Reserving 4352k for malloc() at: 97b9c000 Reserving 36 Bytes for Board Info at: 97b9bfdc Reserving 36 Bytes for Global Data at: 97b9bfb8 Reserving 128k for boot params() at: 97b7bfb8 Stack Pointer at: 97b7bf98 Now running in RAM - U-Boot at: 97fdc000 flash detect cfi not found flash detect cfi not found
U-Boot 2008.10 (Sep 30 2009 - 11:37:03)
Reset Cause: Hardware Reset DRAM: 64 MB Top of RAM usable for U- Boot at: 98000000 Reserving 736k for U-Boot at: 97f44000 Reserving 4352k for malloc() at: 97b04000 Reserving 44 Bytes for Board Info at: 97b03fd4 Reserving 36 Bytes for Global Data at: 97b03fb0 Reserving 128k for boot params() at: 97ae3fb0 Stack Pointer at: 97ae3f98 Now running in RAM - U-Boot at: 97f44000 flash detect cfi fwc addr b0000000 cmd f0 f0 8bit x 8 bit fwc addr b0000000 cmd ff ff 8bit x 8 bit fwc addr b0000055 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr b0000010 is= 4f 51 fwc addr b0000555 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr b0000010 is= 4f 51 fwc addr b0000000 cmd f0 f0f0 16bit x 8 bit fwc addr b0000000 cmd ff ffff 16bit x 8 bit fwc addr b00000aa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr b0000020 is= 5151 5151 is= cmd 52(R) addr b0000022 is= 5252 5252 is= cmd 59(Y) addr b0000024 is= 5959 5959 device interface is 2 found port 2 chip 1 port 16 bits chip 8 bits _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot