Overview

This workshop provides an introduction to the Code Composer Studio integrated development environment. It will cover how to get started using the environment on a C2000 LaunchPad.

Requirements

Software:

Hardware:

Connect the LaunchPad to the Computer via mini-USB cable

Note

This workshop is designed to work with different C2000 devices and LaunchPads. Thus in the instructions when you see a reference to a specific device or Launchpad, you can replace it with the specific device or LaunchPad that you are using.

LAB 1 - Getting Started

Key Objectives

  • Import an example program that blinks the LED
  • Start a debug session and load/flash the program to the target
  • Run the program

Tools and Concepts Covered

  • Eclipse Concepts (Workspace, Workbench, Perspectives, Views, Projects)
  • Resource Explorer
  • Importing/Building/Running an example project/program

Launch Code Composer Studio (CCS) and Open Resource Explorer Classic

  1. Launch CCS with the Code Composer Studio desktop icon

  2. Specify a location for your workspace when prompted. This is where your projects will be located. Use a path that does NOT use spaces or any non-alphanumeric characters, with the exception of the underscore character

  3. Go to menu View->Resource Explorer Classic

Resource Explorer Classic: Examples

Displays all packages and example projects available under the Resource Explorer Classic. This includes locally installed software packages that Resource Explorer either discovers automatically, or is configured to discover.

Note

In the automatically discovered ControlSuite package, not all examples are directly accessible. To access all examples, you must have Resource Explorer parse the package to generate a complete resource package

  1. In the Resource Explorer home page, select option to Configure Resource Explorer to discover examples, documentation and generates a resource package

  2. In the Package Configuration dialog, click the Add button

  3. Browse to the installation directory of controlSUITE (in this case c:\ti\controlSUITE)

  4. Click OK. ControlSUITE should appear in the list of packages to parse

  5. Click OK to parse the package for all examples

    Note that an extra controlSUITE entry will appear under the original entry. This extra entry will have the results of the complete parse of all examples

  6. Select the Example_F2802xLEDBlink example under controlSUITE -> development_kits -> C2000_LaunchPad –> f2802x_examples

  7. Click on Step 1: Import the example project into CCS link to import the Example_F2802xLEDBlink project into the CCS Workspace

    The project will appear in the Project Explorer view if the import is successful and a green checkmark will appear next to the link to indicate success

    The following error may appear in the Problems view during import

    This is because the example project has a reference to XDAIS but the XDAIS tools are no longer installed with CCS, hence it is unrecognized. This reference can be safely deleted (by following the next steps) as XDAIS is not required by the project even though the project makes reference to it. This will be fixed in a future release of controlSUITE

  8. Right-click on the project in the Project Explorer view and go to Properties

  9. In the Products tab, uncheck the box for XDAIS and click OK

  10. In Resource Explorer click on Step 2: Build the imported project link to build the Example_F2802xLEDBlink project

    If the build is successful a green checkmark will appear next to the link to indicate success

  11. Click on Step 3: Debugger Configuration link and specify the Debug Connection by selecting Texas Instruments XDS100v2 USB Debug Probe for the Connection in the pop-up dialog. Cick OK

    A green checkmark will appear next to the link to indicate success

  12. Click on Step 4: Debug the imported project link to debug the project. Alternately, you can select CCS menu Run -> Debug or click the bug button on the toolbar to build/load/run the project

    Several actions are done automatically

    • Prompt to save source files (if necessary)
    • Build the project (incrementally)
    • Start the debugger (CCS will switch to the CCS Debug perspective)
    • Connect CCS to the target
    • Load (flash) the program on the target
    • Run to main

    Don’t want it to do all of the above at once? You can configure it to skip some steps (Debugger Options)

    CCS will switch to the CCS Debug perspective and be halted at main()

  13. Select menu Run -> Resume or click the Resume button on the toolbar to run the program

    Program will run and blue LEDs on the Launchpad will blink in sequence

  14. Click the Suspend button on the toolbar to halt the program

  15. Click the Restart button to restart the program

Summary

In this lab we completed the following:

  • Imported an example that blinks the LED from controlSUITE via the Resource Explorer Classic
  • Built and ran the example

LAB 2 - Basic Debug Concepts

Key Objectives

  • Learn the basics of debugging using the LED Blink example
  • Basic Profiling

Tools and Concepts Covered

  • Basic Debug Concepts
  • Breakpoints/Watchpoints
  • Profile Clock

Breakpoints

Note

Both software breakpoints and hardware breakpoints are available for use. A hardware breakpoint uses debug resources on the device as compared to a software breakpoint which is typically an opcode replacement. A hardware breakpoint is required when setting a breakpoint in Flash, while a software breakpoint can be used in RAM. While the number of software breakpoints available is practically limitless, the number of hardware breakpoints is typically small in number. C2000 devices support two hardware breakpoints

  1. Go to menu View -> Breakpoints to open the Breakpoints view

  2. Double-click in the left selection margin of the editor beside line 150 in Example_F2802xLEDBlink.c. This will set a software breakpoint as the code is in RAM. An icon will appear in the selection margin indicating the location of the breakpoint. It will also be listed in the Breakpoints view

  3. Click the Resume button. The program will halt at the breakpoint

  4. Click Resume again a few times. Observe the LEDs toggling during each run

  5. Remove the breakpoint by selecting the breakpoint in the Breakpoints view and clicking the Remove button

  6. Restart the program by going to menu Run -> Restart or clicking the Restart button in the Debug view

Watchpoints

A watchpoint is a type of breakpoint that monitors activity on a memory address

  1. In the Breakpoints view click the down arrow beside the New Breakpoint button and select Hardware Watchpoint

  2. For Location, enter interruptCount and for Memory, select Write. Click OK

  3. In the Breakpoints view, right-click on the watchpoint and select Breakpoint Properties in the context menu

  4. Modify the properties to match the settings shown below

    • With Data: Yes
    • Data Value: 0xa

    Click OK to apply changes

    This sets a watchpoint to halt the CPU when interruptCount is written to with a value of 10

  5. In the editor view, highlight interruptCount, right-click and select Add Watch Expression... in the context menu

    This will add interruptCount to the Expressions view

  6. Click the Resume button to run the target. Check the value of interruptCount in the Expressions view when the program is halted. Note that it should be the same value that was entered in the Data Value field for the watchpoint properties, in this case 10

  7. In the Breakpoints view, remove the watchpoint using the Remove All Breakpoints button

  8. Restart the program by going to menu Run -> Restart or clicking the Restart button in the Debug view

Profile Clock

The profile clock can be used to count clock cycles

  1. Enable the clock by going to menu Run -> Clock -> Enable

    The clock will be displayed in the CCS status bar at the bottom right

  2. Double-click in the left selection margin of the editor beside line 147 in Example_2802xLEDBlink.c to set a breakpoint

  3. Click the Resume button. The program will halt at the breakpoint and Clock will show the number of cycles to execute from the beginning of main to current breakpoint (~25M cycles)

  4. Double-click on the Clock icon to reset the count to 0

  5. Click the Resume button again. The Clock will show the number of cycles to execute from the previous breakpoint to the current breakpoint (~25M cycles between each LED blink)

  6. Click the Resume button several times and note that the clock cycles increment by about 25M cycles each time

  7. Disable the clock by going to menu Run -> Clock -> Disable

  8. Remove the breakpoint by selecting the breakpoint in the Breakpoints view and clicking the Remove button.

Disassembly View

  1. Restart the program by going to menu Run -> Restart or clicking the Restart button in the Debug view

  2. Open the Disassembly view by going to View -> Disassembly. By default it will show the disassembly of the current location in the code. The location of the Program Counter is indicated with a small blue arrow. You can enter in an address or symbol in the location box to change the address that disassembly starts at.

  3. Click the Show Source button in the Dissassembly view to toggle interleaving of source code with the assembly code.

Other Views

Several other views are available under the View menu. Experiment with the various views

Registers view

The Registers view is used to display and edit the values of core and memory mapped (peripheral) registers

Memory Allocation view

The Memory Allocation view shows a graphical display of memory allocation

Summary

In this lab we completed the following:

  • Covered the basics of Debugging
  • Learned how to use breakpoints and watchpoints
  • Learned how to count cycles using profile clock
  • Became familiar with several debug views