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