NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Debugging on DaVinci using kgdb

From Texas Instruments Wiki
Jump to: navigation, search
{{#switchcategory:MSP430=<McuHitboxHeader/>|C2000=<McuHitboxHeader/>|Stellaris=<McuHitboxHeader/>|TMS570=<McuHitboxHeader/>|MCU=<McuHitboxHeader/>|MAVRK=<MAVRKHitboxHeader/>|<HitboxHeader/>}}

Debugging DaVinci Linux Kernel using kgdb[edit]

This topic discusses the main ways of using kgdb (1) for debugging Linux kernel. For debugging Linux user space programs see debugging remotely on DaVinci using gdb article.

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[edit]

Linux kernel kgdb patches are currently (~2.6.23 time) not part of the official Linux git Kernel and therefore are not included in DaVinci git kernel as well.

  • 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[edit]

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)

After enabling the options in menuconfig rebuild the kernel and any other modules in your system (e.g. CMEM, DSP Link, etc).

Target configuration[edit]

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.

kgdboe=[target-port]@<target-ip>/[dev][target-macaddr],[host-port]@<host-ip>/[dev]
  • 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 ... kgdboe=@192.168.1.4/,@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).

Host configuration[edit]

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:

touch .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[edit]

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)

Further reading[edit]

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

make htmldocs

After some time, redirect your web browser to file index.html in Linux kernel documentation subdirectory

Documentation/DocBook/index.html

There you should find now an entry kgdb with further infos.

Graphical debugging[edit]

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

Ddd davinci.jpg

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Debugging on DaVinci using kgdb here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Debugging on DaVinci using kgdb here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Debugging on DaVinci using kgdb here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Debugging on DaVinci using kgdb here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity

{{#switchcategory:MSP430=<McuHitboxFooter/>|C2000=<McuHitboxFooter/>|Stellaris=<McuHitboxFooter/>|TMS570=<McuHitboxFooter/>|MCU=<McuHitboxFooter/>|MAVRK=<MAVRKHitboxFooter/>|<HitboxFooter/>}}