Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.
Debugging on DaVinci using kgdb
Debugging DaVinci Linux Kernel using kgdb
The purpose of this page is to give users the minimum amount they need to know to get their debug session up and running, given specific setups.
(1) Note: For availability of kgdb see section below, the links and versions in that article are outdated.
Availability of kgdb patches
- Montavista did the job for including them in their kernel
- For recent git kernel you have to patch kernel with kgdb patches on your own.
Rebuilding Kernel with kgdb support
Launch kernel configuration menu using the following command
make ARCH=arm CROSS_COMPILE=arm_v5t_le- menuconfig
Enable the following options in kernel configuration menu
a) CONFIG_NETCONSOLE (Networking support -> Network console logging support)
b) CONFIG_DEBUG_KERNEL (Kernel hacking -> Kernel Debugging)
c) CONFIG_KGDB (Kernel hacking -> KGDB)
d) CONFIG_KGDB_ETH (Kernel hacking -> KGDB -> Method of KGDB communication -> Ethernet)
Target is configured by additional Linux kernel arguments passed e.g. via U-Boot. Add kgdboe option in bootargs environment variable on U-Boot prompt.
- target-port (optional): GDB port (default 6443)
- target-ip: target ip address (i.e DVEVM ip address)
- dev (optional): network interface (default eth0)
- host-port (optional): Host port use to send/recieve UDP packets (default 6442)
- host-ip: Host IP address
Example for U-Boot configuration:
DVEVM# setenv bootargs ... firstname.lastname@example.org/,@192.168.1.3/
Note that in this example host IP address is 192.168.1.3 and DVEVM IP address is 192.168.1.4 (same as you normally set in U-Boot parameters serverip and ipaddr).
Go to Linux kernel main directory (where you executed make uImage and where the main Linux kernel executable vmlinux is located) and there create a file .gdbinit:
Edit this with your preferred editor and add
target remote udp:192.168.2.4:6443
(with IP address of the target the host should connect to, same as used above in target configuration).
Connecting from Host
1. Boot DVEVM with the kgdb kernel. In boot messages you should get anything like
... TI DaVinci EMAC: MAC address is deadbeaf TI DaVinci EMAC Linux version updated 4.0 TI DaVinci EMAC: Installed 1 instances. netconsole: not configured, aborting kgdboe: local port 6443 kgdboe: local IP 192.168.1.4 kgdboe: interface eth0 kgdboe: remote port 6442 kgdboe: remote IP 192.168.1.3 kgdboe: remote ethernet address ff:ff:ff:ff:ff:ff kgdboe: device eth0 not up yet, forcing it kgdboe: debugging over ethernet enabled ...
2. Start cross debugging on Host machine
$ arm_v5t_le-gdb vmlinux GNU gdb 6.3 (MontaVista 6.3-20.0.22.0501131 2005-07-23) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=armv5tl-montavista-linuxeabi". warning: The remote protocol may be unreliable over UDP warning: some events may be lost, rendering further debugging impossible 0xc00533dc in breakpoint () at kernel/kgdb.c:1620 1620 atomic_set(&kgdb_setting_breakpoint,1); (gdb)
Included in the kgdb kernel patch is documentation. To get this, in Linux main directory on host (where you executed make uImage) e.g. call
After some time, redirect your web browser to file index.html in Linux kernel documentation subdirectory
There you should find now an entry kgdb with further infos.
As seen above, using "raw" gdb is debugging on command line. If you like graphical kernel debugging, you can use e.g. ddd. See How to use the DDD on the top of the GNU Cross Debugger for how to do this (this uses m68k-elf-gdb, but it applies the same way for DaVinci using e.g. arm_v5t_le-gdb instead of m68k-elf-gdb). Instead of $ arm_v5t_le-gdb vmlinux like above do
$ ddd --debugger arm_v5t_le-gdb vmlinux
which then looks like