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.

GDB with MSP430 and CCSv6

From Texas Instruments Wiki
Jump to: navigation, search

Requirements

  • CCSv6.0.0 or later
  • CDT GDB Hardware Debug Package
  • MSP430 emupack 6.0.1 or later
  • MSP430 Redhat GCC

In order to be able to use the CCS GUI for things like setting/removing breakpoints, the project should be an Eclipse C/C++ project rather than a CCS project. The steps to create a C/C++ project using MSP GCC toolchain is documented in this wiki page.

Installation

MSP Device Support

Check for updates and install the latest version of the MSP430 emupack.

GCC

You can install the GCC package from the App Center.

GDB Agent

Obtain the GDB Agent Installation package and copy the GDB agent console and msp430.dat into your /ccsv6/ccs_base/DebugServer/drivers folder

GDB Support for CCS

Add the CDT update site to your list of update sites. Go to Help -> Install New Software. Click on the Add button and setup the site as shown below.
CDTUpdateSite.png

You will now see the new features that are available on this site. Select the one for GDB hardware debugging.
CDTGDBhwdebugfeatureselect.png

Select next and click through the installation steps as shown below. When finished it will prompt you to restart CCS, please do this.
CDTGDBhwdebugfeaturedescriptioninstall.png
CDTGDBhwdebugfeaturelicense.png
RestarttoInstallPrompt.png

Configuration

Debug Configuration

Click the down arrow beside the debug button and select Debug Configurations. This will open the debug configurations dialog.
BugButtonDropDownDebugConfig.png

On the left you will see the different types of debug sessions available. Select the one for GDB hardware debugging and then click the new configuration button at the top.
NewLaunchConfigGDB.png

You need to specify the location of the target program that will be loaded. You can also specify the project to associate this configuration with. This is useful as it helps the debugger find source files. In the case below I have specified the program as relative to the project by clicking the Search Project button after specifying the project being used.
GDBprogramfilesettings.png

Next click on the Debugger tab. Go down to the button and click on the "select other" link.
Changelaunchertolegacy.png

Check the box to Use configuration specific settings and select to use Legacy GDB Hardware Debugging Launcher.
Legacylauncherselect.png

Now specify the path to GDB and the other options shown.
DebuggerSettingsGDB.png

GDB Agent Configuration

GDB talks to a GDB agent or proxy. This agent needs to be started inorder for GDB to be able get access to the target device. In this section we show how to setup an "external tool" in CCS so that you can easily launch the agent using the GUI.

Go to Window -> Customize Perspective
Customizeperspectivemenu.png

Select the "Command Groups Availability" tab. Then uncheck and check the "Launch" command group. Then click OK.
Launchcommandgroup.png

You should now see the external tools menu group on the toolbar. Click the down arrow beside the external tools button and select "External Tools Configurations".
Externaltoolsmenu.png

Now lets create a configuration for the GDB agent console. Select "Program" in the tree on the left and then click the New button.
Newlaunchconfigdialog.png

Fill in the Name, full path of the GDB agent console (where you installed it), working directory (same path) and specify msp430.dat as the argument (this file should be in the same folder). Then click Apply.
Externaltoolgdbagentconsolesettings.png

Now if you go back to the down arrow beside the external tools button you should be able to launch the GDB Agent Console. If you prefer to use the Agent GUI you can set it up in the same way.

Launching a debug session

  1. Go to the external tools drop down in CCS and select your entry for the GDB Agent Console (if it is not already running). This should start up the GDB Agent and it should be "waiting" or "listening" at a specific port.
  2. Then go to the Debug drop down in CCS and select the Debug Configuration that you created for GDB.
  3. This will start the debug session, load the program to the target and, depending on the settings, be halted at main.
  4. At this point you can perform debug operations such as setting breakpoints, and stepping through code.