README.qemu_mips 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Notes for the Qemu MIPS port
  2. I) Example usage:
  3. # ln -s u-boot.bin mips_bios.bin
  4. start it:
  5. qemu-system-mips -L . /dev/null -nographic
  6. or
  7. if you use a qemu version after commit 4224
  8. create image:
  9. # dd of=flash bs=1k count=4k if=/dev/zero
  10. # dd of=flash bs=1k conv=notrunc if=u-boot.bin
  11. start it:
  12. # qemu-system-mips -M mips -pflash flash -monitor null -nographic
  13. II) How to debug U-Boot
  14. In order to debug U-Boot you need to start qemu with gdb server support (-s)
  15. and waiting the connection to start the CPU (-S)
  16. # qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic
  17. in an other console you start gdb
  18. 1) Debugging of U-Boot Before Relocation
  19. Before relocation, the addresses in the ELF file can be used without any problems
  20. buy connecting to the gdb server localhost:1234
  21. # mipsel-unknown-linux-gnu-gdb u-boot
  22. GNU gdb 6.6
  23. Copyright (C) 2006 Free Software Foundation, Inc.
  24. GDB is free software, covered by the GNU General Public License, and you are
  25. welcome to change it and/or distribute copies of it under certain conditions.
  26. Type "show copying" to see the conditions.
  27. There is absolutely no warranty for GDB. Type "show warranty" for details.
  28. This GDB was configured as "--host=i486-linux-gnu --target=mipsel-unknown-linux-gnu"...
  29. (gdb) target remote localhost:1234
  30. Remote debugging using localhost:1234
  31. _start () at start.S:64
  32. 64 RVECENT(reset,0) /* U-boot entry point */
  33. Current language: auto; currently asm
  34. (gdb) b board.c:289
  35. Breakpoint 1 at 0xbfc00cc8: file board.c, line 289.
  36. (gdb) c
  37. Continuing.
  38. Breakpoint 1, board_init_f (bootflag=<value optimized out>) at board.c:290
  39. 290 relocate_code (addr_sp, id, addr);
  40. Current language: auto; currently c
  41. (gdb) p/x addr
  42. $1 = 0x87fa0000
  43. 2) Debugging of U-Boot After Relocation
  44. For debugging U-Boot after relocation we need to know the address to which
  45. U-Boot relocates itself to 0x87fa0000 by default.
  46. And replace the symbol table to this offset.
  47. (gdb) symbol-file
  48. Discard symbol table from `/private/u-boot-arm/u-boot'? (y or n) y
  49. Error in re-setting breakpoint 1:
  50. No symbol table is loaded. Use the "file" command.
  51. No symbol file now.
  52. (gdb) add-symbol-file u-boot 0x87fa0000
  53. add symbol table from file "u-boot" at
  54. .text_addr = 0x87fa0000
  55. (y or n) y
  56. Reading symbols from /private/u-boot-arm/u-boot...done.
  57. Breakpoint 1 at 0x87fa0cc8: file board.c, line 289.
  58. (gdb) c
  59. Continuing.
  60. Program received signal SIGINT, Interrupt.
  61. 0xffffffff87fa0de4 in udelay (usec=<value optimized out>) at time.c:78
  62. 78 while ((tmo - read_c0_count()) < 0x7fffffff)