Overview
This workshop provides an introduction to the Code Composer Studio Theia integrated development environment leveraging C2000 C29x Academy. It will cover how to get started using an F29H85x controlSOM.
Note:
This workshop can be used to learn about all Theia-based IDE, including CCS Theia and CCS 20.
Requirements
Software:
- Code Composer Studio Theia v1.5.1 or Code Composer Studio v20.x or greater.
- F29H85x SDK which can be installed as a step of Lab 1.
- C29x Academy is necessary for Lab 1.
Hardware
- F29H85x, F29H85x controlSOM, or F29H85x LaunchPad
- Internet access
Lab 1: Importing, Editing, and Running an Example Project
This lab will go over importing an example project from the F29H85x SDK, making some edits to modify the program's functionality, and flashing the program to the target (the F29H85x controlSOM) to run the program.
Please refer to the Timer LED Lab in C29x Academy for step-by-step instructions as well as the complete software solution.
Note:
For further code development support, browse through example projects in the F29H85x SDK. There are simple projects which utilize hardware resources such as the ADC, I2C, SPI, etc.
Lab 2: Basic Debug Concepts
This lab will cover the basics of debugging, using the modified timer_academy_lab.c code from Lab 1. Specific tools and concepts that are covered are:
- Breakpoints
- Watchpoints
- Watch
- Debug view
- Disassembly view
- Other Views
Breakpoints
Breakpoints are specific points that can be set in the code, where the program is to halt execution. Once halted, the values in registers/memory/etc. can be inspected to gain a deeper understanding of the program execution. This is very useful when debugging.
Hardware Breakpoints
A hardware breakpoint is required when setting a breakpoint in Flash. The number of available hardware breakpoint resources varies per device. The F29H85x supports up to seven simultaneous hardware breakpoints.
If your F29H85x controlSOM is currently running, ensure you are in the Debug view and Pause it. Otherwise, click on Run → Debug Project(...) to flash the program to the target and pause it.
Click on the Breakpoints panel under the Debug view to expand it. There should be no breakpoints to start.
While staying in the Debug view, in timer_academy_lab.c, scroll to the definition of the INT_myCPUTIMER0_ISR() function, and click on the margin to the left of the line number. This will insert a breakpoint that will halt program execution whenever it reaches this point in the code.
Click Run → Continue to resume program execution on the controlSOM. Click the left button on the board, and note that the program has suspended due to the breakpoint.
By clicking Run → Step Into or Run → Step Over (or using the related buttons in the Debug view), the target will do the associated source step. Click Run → Continue to resume program execution.
- Step Into steps to the next line of code, including stepping into a new function call.
- Step Over steps to the next line of code in the current function, but will not step into a new function call. It will remain in the current function until it ends or returns.
- Step Out steps out of the current function before it reaches its end, and suspends execution on the next statement of the calling function.
After you are finished with this part of the lab, in the Breakpoints panel, remove the breakpoint. You can also remove it by clicking the margin next to the line number in timer_academy_lab.c, where the breakpoint currently exists.
Watchpoints
A watchpoint is a type of hardware breakpoint that monitors activity on a memory address, for example where a variable's value is stored.
If your F29H85x controlSOM is currently running, ensure you are in the Debug view and Pause it. Otherwise, click on Run → Debug Project(...) to flash the program to the target and pause it.
Click Run → New Breakpoint → Hardware Watchpoint. This will open a dialog to add a new data breakpoint.
Set the Address to
&cpuTimer0IntCount
(the address ofcpuTimer0IntCount
) and Access type to Write, and click OK. This installs a watchpoint which will pause program execution on the target whenever the value ofcpuTimer0IntCount
is modified (whenever it is written to).
A new breakpoint will be added under the Breakpoints panel under the Debug view.
Click Run → Continue to resume program execution on the controlSOM. Click the left button on the board, and note that the program has paused due to the data breakpoint.
Leave the data breakpoint set as it will be used in the next section.
Watch
The Watch view allows you to monitor the values of variables (local, global, static), C-valid expressions and even registers. The value of an expression may also be modified when the situation permits.
Ensure that the program is paused. In the Debug view, click on the Watch panel to expand it. Click on the
+
button and addcpuTimer0IntCount
in Expression to watch. This will display the value ofcpuTimer0IntCount
whenever the program is paused. Resume the program and click the left button on the board again to pause the program and view the value ofcpuTimer0IntCount
change.Click Run → Continue to resume program execution on the controlSOM.
Take note of the speed at which the LED lights are blinking. Click Run → Pause to pause the execution of the program.
In the Watch panel, mouse right-click on the
cpuTimer0IntCount
expression and click Edit Expression. Set the value to10
and click OK. Click Run → Continue to resume program execution. The LED blinking rate should be noticeably slower. This is an example of modifying variable values through the Watch panel.In the Breakpoints panel, remove the data breakpoint. The press the Continuous Refresh button on the toolbar. It is the third button from the left which looks like a continuous circle. This will update the expressions in the view continuously. If the device supports non-intrusive memory accesses (allow the debugger to access memory while the target is running), then the values can be updated while the target is still running. F29H85x supports non-intrusive memory accesses. Click the left button on the board periodically and note how the
cpuTimer0IntCount
expression will change as the button is pressed.After you are finished with this part of the lab, in the Watch panel, remove the cpuTimer0IntCount expression.
Debug View
In addition to the target execution toolbar and providing information on Breakpoints, the Debug view also provides more information in the following collapsable views:
- Threads: This view will show the current debug session and the status the CPU.
- Call Stack: This view will provide the current call stack information for the program.
- Variables: This view will display all local variables and related values.
- Watch: This view allows you to add/view desired expression. For example, use the
+
button to add the global variablecpuTimer0IntCount
to the list of watch expressions. Breakpoints: This view allows you to view/enable/disable/remove breakpoints.
Disassembly View
If your F29H85x controlSOM is currently running, ensure you can see the Debug view and that execution is Paused. Otherwise, click on Run → Debug Project (...) to flash the program to the target and pause it.
Click on View → Disassembly to open the Disassembly view. 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 yellow arrow(s). Symbols will be highlighted in green text.
You can enter in an address or symbol in the location box at the top of the Disassembly view to change the address that the view starts at. Enter main to display diassembly content starting from the main symbol.
Note the toolbar with button to Refresh view, Goto current PC location, Assembly step-into, and Assembly step-over.
To toggle source interleaving, bring up the context menu in the Disassembly view and select Show source in the context menu. This will interleave the source lines with the disassembly. Source lines will be highlighted in yellow text
Other Views
Several other views are available under the View menu. Experiment with the various views such as:
Register View
The Registers view is used to display and edit the values of core and memory mapped (peripheral) registers. Click on View → Register to open the view.
Memory View
The Memory view is used to display and edit the values memory. Click on View → Memory to open the view.
Summary
Lab 1 covered using Code Composer Studio Theia to import an example project, modify it, and flash it to a target to run the program. Lab 2 provided information on the basics of using debug tools in Code Composer Studio Theia.