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.
This workshop uses projects from C2000Ware software package. If you are using ControlSuite instead, please refer to the workshop here. The workshop using ControlSuite is written for F28027 Launchpad, but both workshops can be run on any C2000 Launchpad as long as you choose the appropriate project for your device.
Requirements
Software:
- Code Composer Studio v7.3 or greater
- With all C2000 components installed
Hardware:
- F28379D LaunchPad (LAUNCHXL-F28379D)
Connect the LaunchPad to the Computer via mini-USB cable
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
Launch CCS with the Code Composer Studio desktop icon
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
Select Browse Examples in the Getting Started page
Resource Explorer: Examples
Displays all example projects available under the Resource Explorer. This includes all available content on the remote TI server, in addition to any content you may have installed locally.
Select the device or board you are working with in the Select a device or board filter box in the top left corner. For this workshop, we select F28379D
Select the Bitfield examples under Software -> C2000Ware -> English -> Devices -> F28379D -> Examples
Click the Download and install icon. This will make a copy of the C2000Ware package that is on the Cloud onto your local machine. This is required to import any examples into your local CCS environment
A prompt will appear, asking for confirmation. After agreeing to the prompt, the C2000Ware will start downloading. Once the download and installation to the local environment is completed, C2000Ware will appear in the Resource Explorer, highlighted with green arrows, indicating that it is available locally (offline) on your machine.
Select the timed_led_blink example under Software -> C2000Ware -> English -> Devices -> F28379D -> Examples ->Bitfield ->CPU1 and click the Import to IDE icon
This will import the project into your workspace. The project will appear in the Project Explorer view if the import is successful
Select menu Run -> Debug to build/load/run the project. Alternatively you can click the bug button on the toolbar
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)
If a debug session for this device is being launched for first time, a dialog will prompt user to select which CPUs to load the program to. This dialog will appear if the device has multiple CPUs supported by the project
Uncheck the second entry C28xx_CPU2 and click OK
CCS will switch to the CCS Debug perspective and be halted at main()
Select menu Run -> Resume or click the Resume button on the toolbar to run the program
Program will run and blink the red LED on the Launchpad
Click the Suspend button on the toolbar to halt the program
Click the Restart button on the toolbar to restart the program
Summary
In this lab we completed the following:
- Imported an example that blinks the LED from C2000Ware via the Resource Explorer
- Built and ran the example
LAB 2 - Basic Debug Concepts
Key Objectives
- Learn the basics of debugging using the Blink LED 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.
Go to menu View -> Breakpoints to open the Breakpoints view
Double-click in the left selection margin of the editor beside line 176 in LEDBlink.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
Click the Resume button. The program will halt at the breakpoint
Click Resume again a few times. Observe the red LED toggling during each run
Remove the breakpoint by selecting the breakpoint in the Breakpoints view and clicking the Remove button
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
In the Breakpoints view click the down arrow beside the New Breakpoint button and select Hardware Watchpoint
For Location, enter CpuTimer0.InterruptCount and for Memory, select Write. Click OK
In the Breakpoints view, right-click on the watchpoint and select Breakpoint Properties in the context menu
Modify the properties to match the settings shown below
- With Data: Yes
Data Value: 0x20
Click OK to apply changes
This sets a watchpoint to halt the CPU when CpuTimer0.InterruptCount is written to with a value of 0x20
In the editor view, go to line 176, highlight CpuTimer0.InterruptCount, right-click and select Add Watch Expression... in the context menu
This will add CpuTimer0.InterruptCount to the Expressions viewClick the Resume button to run the target. Wait until the program halts. Check the value of CpuTimer0.InterruptCount in the Expressions view when the program is halted. Note that it should be the same value that was entered in the Value field for the watchpoint properties, in this case 32 (0x20)
In the Breakpoints view, remove the watchpoint using the Remove All Breakpoints button
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
Enable the clock by going to menu Run -> Clock -> Enable
The clock will be displayed in the CCS status bar at the bottom right
Double-click in the left selection margin of the editor beside line 176 in LEDBlink.c to set a breakpoint
Click the Resume button. The program will halt at the breakpoint. The Clock will show the number of cycles it took to execute from the beginning of main to current breakpoint (~30M cycles)
Double-click on the Clock icon to reset the count to 0
Click the Resume button again. The Clock will show the number of cycles to execute from the previous breakpoint to the current breakpoint (~30M cycles between each LED blink)
Click the Resume button several times and note that the clock cycles increment by about 30M cycles each time
Disable the clock by going to menu Run -> Clock -> Disable
Remove the breakpoint by selecting the breakpoint in the Breakpoints view and clicking the Remove button
Disassembly View
Restart the program by going to menu Run -> Restart or clicking the Restart button in the Debug view. The program will be at the start of main()
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
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