Where is flash_init() after u-boot relocated to RAM?
Hi,
I'm trying to trace into flash_init(). The function is called after u-boot is relocated to RAM. So the System.map is no longer useful. How can I know the address of the function to set a breakpoint?
The following screenshot shows that u-boot locates at 0x07fd9000. I tried to get the address by adding the offset got from System.map to 0x07fd9000. But it seems not right because GDB didn't stop at that address.
Top of RAM usable for U-Boot at: 08000000
Reserving 152k for U-Boot at: 07fd9000
Reserving 192k for malloc() at: 07fa9000
Reserving 56 Bytes for Board Info at: 07fa8fc8
Reserving 48 Bytes for Global Data at: 07fa8f98
Stack Pointer at: 07fa8f78
New Stack Pointer is: 07fa8f78
Now running in RAM - U-Boot at: 07fd9000
FLASH: Flash bank # 0:
Manuf. ID @ 0xFF800000: 0xFFFFFFFF
Device ID @ 0xFF800008: 0xFFFFFFFF*** failed ***
Thanks,
-Shawn.
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
I read the debug chapter of DULG. The confusing thing is that gdb cannot stop even at an in-flash funciton, e.g., cpu_init_f(), which is supposed to be straight forward. Does it mean that I screw up the memory mapping? u-boot is linked at 0xffe00000.
Mine is an MPC8245 board in which an original bootloader locates at 0xfff00000.
Quoted 4 lines
I'm trying to trace into
flash_init(). The function is called after u-boot
is relocated to RAM. So the System.map is no longer useful. How can
I
Quoted 4 lines
know
the address of the function to set a breakpoint?The following screenshot shows that u-boot locates at
0x07fd9000. I
tried
Quoted 13 lines
to get the address by adding the offset got from System.map to
0x07fd9000.
But it seems not right because GDB didn't stop at that address.Top of RAM usable for U-Boot at: 08000000 Reserving 152k for U-Boot at:
07fd9000Reserving 192k formalloc()at:07fa9000Reserving 56 Bytes for Board Info at:07fa8fc8Reserving 48 Bytes for Global Data at:07fa8f98Stack Pointer at:07fa8f78
New Stack Pointer is:07fa8f78
Now running in RAM - U-Boot at:07fd9000
FLASH: Flash bank # 0:
Quoted 3 lines
Manuf. ID @ 0xFF800000: 0xFFFFFFFF Device ID @ 0xFF800008: 0xFFFFFFFF*** failed ***
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
Quoted 3 lines · In message <[email protected]> you wrote:
I'm trying to trace into
flash_init(). The function is called after u-boot is relocated to RAM. So the System.map is no longer useful. How can I know
Of course System.map (or the symbol table in the u-boot ELF file) is still usefiul; you just have to add the relocation offset.
Quoted 1 line
the address of the function to set a breakpoint?
RTFM: http://www.denx.de/twiki/bin/view/DULG/DebuggingUBoot#Section_10.1.2.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Windows95 = graphical user interface for a single-threaded interrupt handler (DOS)
Wolfgang,
Quoted 9 lines
Quoted 1 line
I'm trying to trace into
flash_init(). The function is calledafter u-boot
Quoted 1 line
is relocated to RAM. So the System.map is no longer useful. How
can I know
Of course System.map (or the symbol table in the u-boot ELF file) is
still usefiul; you just have to add the relocation offset.
I did read that chapter. I found that gdb even cannot stop at cpu_init_f(). At this time u-boot is still executed from flash. I linked u-boot at 0xffe00000. Isn't it strange, is it?
Thanks,
-Shawn.
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
Quoted 4 lines · In message <[email protected]> you wrote:
I did read that chapter. I found that gdb even cannot stop at
cpu_init_f(). At this time u-boot is still executed from flash. I linked u-boot at0xffe00000. Isn't it strange, is it?
No, it's not. You probably forgot to configure your BDI2000 to use hardware breakpoints; and software breakpoints won't work as GDB cannot write a trap instruction at the breakpoint address. Try:
gdb$ mon break hard
before setting the breakpoint.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de "Little prigs and three-quarter madmen may have the conceit that the laws of nature are constantly broken for their sakes." - Friedrich Nietzsche
Wolfgang,
My question about BDI2000 should go to Abtron. But their response usually takes one or more days. So I just ask you here. ;)
Yes. You're right. I set breakpoint mode to SOFT. But after I change the breakpoint to HARD, I have the following problem. There is only one hard breakpoint that can be set at a time.
(gdb) target remote rslab129:9124
Remote debugging using rslab129:91240xfff07550 in ?? ()
(gdb) mon ci
(gdb) b cpu_init_f
Breakpoint 1 at 0xffe093c0: file cpu_init.c, line 93. (gdb) c
Continuing.
warning: Cannot insert breakpoint 1:
Error accessing memory address 0xffe093c0: Unknown error 4294967295. (gdb)
My target setup is as follows.
[TARGET]
CPUTYPE 8240 ;the CPU type (603EV,750,8240,8260) JTAGCLOCK 0 ;use 16 MHz JTAG clock WORKSPACE 0x00000000 ;workspace in target RAM for fast download BDIMODE AGENT ;the BDI working mode (LOADONLY | AGENT | GATEWAY) BREAKMODE HARD ;SOFT or HARD, HARD uses PPC hardware breakpoint
;VECTOR CATCH ;catch unhandled exceptions
DCACHE NOFLUSH ;data cache flushing (FLUSH | NOFLUSH)
MMU XLAT ; translate effective to physical address
PTBASE 0x000000f0 ; Here is the pointer to the page table pointers
Thanks a lot,
-Shawn.
Quoted 9 lines
No, it's not. You probably forgot to configure your BDI2000 to use
hardware breakpoints; and software breakpoints won't work as GDB
cannot write a trap instruction at the breakpoint address. Try:gdb$ mon break hard
before setting the breakpoint.
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
Futher question on the relocation address.
Ch. 10 of DULG says that the relocation address is usually (RAM_SIZE - MONITOR_LEN). So in my case the relocation address should be 0x7fc0000 (0x8000000 - 0x40000). But from the debugging message I found u-boot is at 0x7fd9000 after relocation. Do they conflict?
Top of RAM usable for U-Boot at: 08000000
Reserving 152k for U-Boot at: 07fd9000
Reserving 192k for malloc() at: 07fa9000
Reserving 56 Bytes for Board Info at: 07fa8fc8
Reserving 48 Bytes for Global Data at: 07fa8f98
Stack Pointer at: 07fa8f78
New Stack Pointer is: 07fa8f78
Now running in RAM - U-Boot at: 07fd9000
Thanks,
-Shawn.
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
Quoted 3 lines · In message <[email protected]> you wrote:
My question about BDI2000 should go to Abtron. But their response usually takes one or more days. So I just ask you here. ;)
C'me on. Ruedi usually replies the very same day.
Quoted 3 lines
Yes. You're right. I set breakpoint mode to SOFT. But after I change the breakpoint to HARD, I have the following problem. There is only one hard breakpoint that can be set at a time.
Yes. So you must delete it before you can set a new one.
Quoted 6 lines
(gdb) target remote rslab129:9124
Remote debugging using rslab129:91240xfff07550in ?? ()
(gdb) mon ci
(gdb) bcpu_init_f
Breakpoint 1 at0xffe093c0: filecpu_init.c, line 93.
Try here:
(gdb) d
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Work 8 hours, sleep 8 hours; but not the same 8 hours.
Quoted 5 lines · In message <[email protected]> you wrote:
Ch. 10 of DULG says that the relocation address is usually (
RAM_SIZE-MONITOR_LEN). So in my case the relocation address should be0x7fc0000(0x8000000-0x40000). But from the debugging message I found u-boot is at0x7fd9000after relocation. Do they conflict?
This is a part where the DULG needs updating; the problem is that it's not easy to explain.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Leave bigotry in your quarters; there's no room for it on the bridge. -- Kirk, "Balance of Terror", stardate 1709.2
Quoted 5 lines
Quoted 2 lines
My question about BDI2000 should go to Abtron. But their response usually takes one or more days. So I just ask you here. ;)
C'me on. Ruedi usually replies the very same day.
Well, I take part of my words back. I kind of exaggerated the situation. Ruedi does usually reply the very same day after he receives the query. However due to the time difference I usually get his reply on the next day. ;)
Quoted 4 lines
Quoted 4 lines
(gdb) target remote rslab129:9124
Remote debugging using rslab129:91240xfff07550in ?? ()
(gdb) mon ci
That's why here I clear all the breakpoints in the BDI2000.
Quoted 6 lines
Quoted 2 lines
(gdb) b
cpu_init_f
Breakpoint 1 at0xffe093c0: filecpu_init.c, line 93.Try here:
(gdb) d
Hmmm...so it needs to be done in GDB.
Now I'm able to trace functions after relocation. One more point I found out is that the breakpoint mood has to change to SOFT after the relocation to RAM.
Thanks,
-Shawn.
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
Quoted 5 lines · In message <[email protected]> you wrote:
Well, I take part of my words back. I kind of exaggerated the situation. Ruedi does usually reply the very same day after he receives the query. However due to the time difference I usually get his reply on the next day. ;)
You just gotta get up earlier :-)
Quoted 3 lines
Quoted 1 line
Quoted 1 line
(gdb) mon ci
That's why here I clear all the breakpoints in the BDI2000.
But GDB does not know about this, or does it? It is definitely not a good idea to change the breakpoint state behind GDB's back...
Quoted 3 lines
Now I'm able to trace functions after relocation. One more point I found out is that the breakpoint mood has to change to SOFT after the relocation to RAM.
You can do that, but you don't have to. [It's more convenient, though.]
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de While most peoples' opinions change, the conviction of their correct- ness never does.