arm linux kgdb调用参数
内核配置:略
uboot启动参数配置:setenv bootargs "consloe=tty1 console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.1.111:/home/fang/ti-sdk-am335x-evm-06.00.00.00/filesystem/rootfs,nolock rw ip=192.168.1.123:192.168.1.111:192.168.1.1:255.255.255.0::eth0:off kgdboc=ttyO0,115200 kgdbwait"
即:比正常的启动参数多加了kgdboc=ttyO0,115200 kgdbwait
板子上电启动后,会自动停到一个断点,等待主机上的gdb连接
[ 0.258331] Console: switching to colour frame buffer device 60x34
[ 0.264587] omap_uart.0: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
[ 1.286376] console [ttyO0] enabled
[ 1.290954] omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
[ 1.298980] omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
[ 1.306945] omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
[ 1.314880] omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
[ 1.322784] omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
[ 1.330902] kgdb: Registered I/O driver kgdboc.
[ 1.335693] kgdb: Waiting for connection from remote gdb...
这时,需要将串口连入linux主机,主机上将有与串口对应的设备节点/dev/ttyUSB0
下面在主机上操作,
$stty ispeed 115200 ospeed 115200 -F /dev/ttyUSB0
$cd /home/fang/ti-sdk-am335x-evm-06.00.00.00/board-support/linux-3.2.0-psp04.06.00.11/am335x_evm/
$/home/fang/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-gdb vmlinux
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
现在已经与目标板连上,接下来就可以打断点,单步调式等操作了
(2)另一种方式是,启动完成后进入debug
root@am335x-evm:~# echo ttyO0 > /sys/module/kgdboc/parameters/kgdboc
[ 1263.387695] kgdb: Registered I/O driver kgdboc.
root@am335x-evm:~# echo g > /proc/sysrq-trigger
[ 1283.267761] SysRq : DEBUG
[ 1283.270538] Entering KGDB