NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. 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.
GSG:CCSv5.0 Debugging projects
IMPORTANT! This Getting Started Guide was designed to be used only with Code Composer Studio 5.0.x and pre-releases of 5.1.x.
Debugging projects
Introduction[edit]
This section describes the general steps required to create a target configuration and debug the project in CCSv5.
In addition, this short video clip Tutorial video shows an example of creating a target configuration and debugging a project in CCSv5.
Before starting the debugger[edit]
Before the debugger can be started it is necessary to select and configure the target to where the code will execute. The target can be a software simulator or an emulator connected to a board.
- Software simulators do not require external hardware and are very useful to perform benchmark and algorithm validation. Additional information about simulation technologies can be found at the link below:
- Emulators are hardware devices used to debug directly into hardware and can be either included in a development board (DSK, eZdsp, EVM, etc.) or standalone (XDS100v2, XDS510 USB, XDS560, etc.). Additional information about emulation technologies can be found at the link below:
Note: If you are familiar with CCSv3.3 the configuration of the targets was done with the external program CCSetup. In CCSv5 this is done inside the IDE allowing not only a system-wide configuration, but also individual configurations per project. This also has the benefit of completely eliminating the need to restart CCS after each target configuration changes.
Creating a Target Configuration File[edit]
CCSv5 provides a handy graphical target configuration editor that has several pre-configured devices and boards, and allows adapting it to a custom hardware.
Each project can have one or multiple target configurations but only one active.
- Optional. CCSv5 also allows creating a system-wide target configuration that can be shared among projects.
1. Create the target configuration file:
- For version 5.0.x: Right-click on the project name and select New --> Target Configuration File
- For version 5.1.x: Right-click on the project name and select New --> Other, Click on Code Composer Studio and Select Target Configuration File.
2. Give a name to the configuration file - the extension .ccxml will be added. A good idea is to give a meaningful name depending on the target and the emulator used, for example F28335_XDS510USB if you are using an F28335 device and an XDS510USB emulator.
- Optional. If the option Use shared location is selected the new target configuration will be shared among all projects and stored in the default CCSv5 directory. This is recommended if you intend to connect to the target without a project or need to debug a SoC device as described in GSG:Connecting to slave cores in SoC devices.
3. Click Finish. The target configuration editor will open.
4. Two elements of the target must be configured:
- The Connection drop-down menu allows selecting either a software simulator or several types of built-in or standalone emulators. Refer to the GSG:Common target configurations section for instructions on how to configure common targets.
- The Device section contains all devices compatible with the connection selected. (See this Beagle Board set-up for an example) The upper box is a filter that helps selecting the correct device in the lower browse table.
5. After selecting the device, click on the Save button. The configuration will be automatically set to Active.
- A project can have multiple target configurations but only one active that will be launched automatically.
- Note: To see all existing Target Configurations on your system, simply go to menu View --> Target Configurations.
Launching the debugger[edit]
Once a configuration is created the debugger can be launched by going to menu Target --> Debug Active Project. This will open the Debug Perspective, a different set of windows and menus tailored for debugging.
- Note: Launching the debugger may cause CCSv4 to build the active project if any modifications to the source code or the build options are made.
- Note: The debugger can also be launched by right-clicking on the newly created target configuration file and selecting Debug As... --> Debug Session. This method does not load the code automatically to the target but is useful if you do not have a project or need to debug SoC devices as in GSG:CCSv5.0_Connecting_to_slave_cores_in_SoC_devices.
Loading the code[edit]
Once the debugger completes the target initialization, the project's output file .OUT will be automatically loaded to the active target and by default the code will be halted at the main() function.
- Note: The code will be automatically written to the flash memory of the MSP430, F28x and Stellaris devices. To configure the flash loader properties, launch the debugger and go to menu Tools --> On-chip Flash.
- Note: If the debugger was launched by right-clicking on the target configuration file as mentioned in the previous section, it is necessary to first connect to the target (right-click on the core and select Connect Target) and then load the code to it (menu Target --> Load Program...).
- The Debug view contains the target configuration and the call stack for each core.
- The source code view shows the program halted at main().
- Basic debugging functionality (Run, halt, step in/out, reset) is located in the bar at the top of the Debug view. The menu Target has several additional debug functions.
- Note: If the target configuration requires a script to run before the code is loaded, the Console view will open. The scripts are written in GEL (General Extension Language) and are particularly needed to configure devices with complex external memory timings and power configurations.
Watching variables and registers[edit]
The Local and Watch views are also opened at program load and show local and global variables.
Register view is not opened by default but can be viewed by going to menu View --> Registers.
Disassembly and mixed source and assembly mode[edit]
The disassembly view is not opened by default but can be viewed by going to menu View --> Disassembly.
A particularly useful feature of the disassembly window is the mixed source and assembly code viewer - it is enabled by default.
Memory viewer[edit]
The memory view is not opened by default but can be viewed by going to menu View --> Memory.
Managing breakpoints[edit]
Being the most basic feature in any debugger, breakpoints in CCSv5 add a range of options to help add flexibility to the debugging process.
- Hardware breakpoints can be set directly from the IDE.
- Software breakpoints are limited only by the memory available on the device.
- Software breakpoints can be set to halt inconditionally or conditionally.
- Software breakpoints can perform additional functions other than halt the target: file I/O transfers, screen updating, etc.
To set a breakpoint, simply double-click on the line of code in the source or disassembly views. The icon for either hardware or software breakpoint will indicate its status and placement.
- Note: In optimized code sometimes the breakpoint cannot be set to the exact line in the C source code. This is because the optimizer may condense code and impact the correlation between the assembly instruction and the C source.
All breakpoints (software, hardware, enabled, disabled) can be seen in the breakpoint viewer. To configure the breakpoint, simply right-click on the blue dot or in the breakpoint view, and select Breakpoint Properties....
- Action sets the behavior of the breakpoint to simply remain halted, update one or all debugger views, read or write data to files, activate or deactivate groups of breakpoints, etc.
- Skip Count sets the number of passes before the breakpoint action is executed.
- Group allows grouping breakpoints for advanced control.
Advanced Data Visualization Tools[edit]
An advanced graph and image visualization tool is available in CCSv4. It can display arrays of data in a graphical form and with several formats.
Displaying graphs[edit]
To add a graph, simply go to menu Tools --> Graph and select among one of the various display options.
- Time-based graphs: Single Time and Dual Time
- Frequency-based graphs: all FFT options
The top toolbar in the graph window controls several features such as update rate (freeze, continuous, at target halt or manual), zoom in and out, configuration properties, etc. By default, graph windows are updated whenever the target is halted, using autoscale and display X axis in number of samples and Y axis in integer values. All these options can be set.
- Note: Keep in mind the amount of data transferred for graph updates may impact the real-time operation of the target hardware.
Several additional debugger functions and views are available. It is strongly suggested to explore these options thoroughly to uncover all functionality of the debugger.
Tutorial video[edit]
Below there is a short video clip that shows the entire process described above.
- Format: SWF
- Resolution: 1024x768
- Color depth: 24 bit
- Size: 13.820.100 bytes
What's next?[edit]
Now that you have learned about basic debugging using Code Composer Studio v5, you can continue to the Advanced Topics section of the CCSv5 Getting Started Guide.