Linux Debug in CCSv5 0

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents


Note: For CCS 5.1 and higher please see this page.

Background

Linux Debug Overview

CCSv5 supports run mode debug (a.k.a. remote GDB debug, agent-based debug), stop mode debug (a.k.a. JTAG debug, OCD) and Linux aware debug (an extension of the stop mode debug).


Run Mode Debug

Dependencies

The following dependencies apply to Run Mode Debug:



The run mode debug requires two connections to the target system.

The CCSv5 terminal view can be used to connect to the target console.
The host system needs to have an installation of a cross platform gdb debugger and the target system needs to have a compatible version of gdb server.
We are going to show how to use CCSv5 to set up the debug in a "hello world" project.
Here are the steps:
Gdb debug config 1.JPG

IMPORTANT! By default CCS does not enable "C/C++ Application" configurations. You need to enable them from the Capabilities tab Pref Add GDB Debug.JPG
in the Preference dialog (select Window -> Preferences -> Capabilities)


Gdb debug config 2.JPG

Gdb debug config 3.JPG

Gdb debug config 4.JPG

Gdb debug config 5.JPG

Gdb debug shot.JPG



Stop Mode Debug

Dependencies

The following dependencies apply to Stop Mode Debug:

  • CCSv5.1. A short video clip that shows the procedure below is located here.

IMPORTANT! The linux kernel must be built with debugging information. Check the details below in the menuconfig step of the linux kernel build procedures.

Enable Kernel hacking --> Compile the kernel with debug info
Also, if the kernel is in experimental mode, you should enable the option below:
Kernel hacking ---> Enable stack unwinding support
To check if the kernel is in this mode, check if the option below is enabled.
General Setup ---> Prompt for development and/or incomplete code/drivers
The stop mode debug requires a JTAG connection to the target system. An additional connection to the target console may be helpful. A typical set-up may be illustrated by the following picture of an XDS100v2 JTAG emulator connected to a devkit8000 board (which is a Beagle Board clone); the JTAG emulator is connected vertically onto the board:
TargetBoard-devkit8000 JTAGEmulator-XDS100v2.jpg


We are going to show how to use CCSv5 to debug the Linux kernel running on the target.
In this example, the host system needs to have access to the Linux kernel source tree used to build the kernel image and the ELF symbol file (vmlinux) that is generated from the same kernel build.
We are going to do this in two parts:


Creating A Source-code Project for the Kernel

Here are the steps to create a Linux kernel project:

Create kernel proj 1.JPG

Create kernel proj 2.JPG

Create kernel proj 3.JPG


Associating the Kernel Project with the Target

At this point, you need to have created a Target Configuration, already. That defines what your target board and JTAG emulator are. Having done so, you can proceed to associate the above Project with your Target, as follows:

Device Debug Config 1.JPG

Device Debug Config 2.JPG

Device Debug Config 3.JPG


We are ready to launch the debugging session. At this point, you ought to have powered up, and paused, the target, similar to these Beagle Board instructions. Now click the Debug button:

Loading kernel sym.JPG

StopMode FullScreen.JPG



Mixed Mode Debug

The stop mode debug can be used concurrently with the run mode debug.
The user can set breakpoints in the user process using the run mode debug and breakpoints in the kernel using the stop mode debug.
Using the Hello World and the Linux kernel projects, we can launch both debug one after the other.

CCSv5 Stop Run Mode Mix 1.JPG

CCSv5 Stop Run Mode Mix 2.JPG



Linux Aware Debug

Dependencies

The following dependencies apply to Linux Aware Debug:


Linux Aware Debug extends Stop Mode Kernel Debug to provide the capabilities of the process or thread level debug and module debug similar to the Linux Aware Debug feature available in CCSv4.
This feature will not be available in the initial CCSv5 beta release.


Limitations and Known Issues

1. When performing Run Mode debug, by default Eclipse looks in the host PC root directory for runtime shared libraries, thus failing to load these when debugging the application in the target hardware. The error messages are something like:

warning: .dynamic section for "/usr/lib/libstdc++.so.6" is not at the expected address (wrong library or version mismatch?)
warning: .dynamic section for "/lib/libm.so.6" is not at the expected address (wrong library or version mismatch?)
warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)
warning: .dynamic section for "/lib/libc.so.6" is not at the expected address (wrong library or version mismatch?)

[New Thread 1701]

To correct this you must create a gdb command file (.gdbinit) in a text editor (gedit, vim, etc.) and add the following line to it:

set solib-absolute-prefix /home/user/targetfs (or wherever the target filesystem is located)

Close any GDB debugging sessions. Open the Debug Configurations as shown in the Run Time debugging and then browse to this file in the Debugger tab --> box GDB command file.

Source: http://www.eclipse.org/forums/index.php/m/503935/

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox