Lab 2: Linker Command File
TMS320F2837xD Microcontroller Workshop - Programming Development Environment 2 - 23
Debug Environment Windows
It is standard debug practice to watch local and global variables while debugging code. There are
various methods for doing this in Code Composer Studio. We will examine two of them here:
memory browser, and expressions.
23. Open a “Memory Browser” to view the global variable “z”.
Click: View Memory Browser on the menu bar.
Type &z into the address field, select “Data” memory page, and then <enter>. Note that you
must use the ampersand (meaning “address of”) when using a symbol in a memory browser
address box. Also note that CCS is case sensitive.
Set the properties format to “16-Bit Hex – TI Style” in the browser. This will give you more
viewable data in the browser. You can change the contents of any address in the memory
browser by double-clicking on its value. This is useful during debug.
24. Notice the “Variables” window automatically opened and the local variables x and y are
present. The variables window will always contain the local variables for the code function
currently being executed.
(Note that local variables actually live on the stack. You can also view local variables in a
memory browser by setting the address to “SP” after the code function has been entered).
25. We can also add global variables to the “Expressions” window if desired. Let's add the global
variable “z”.
Click the “Expressions” tab at the top of the window. In the empty box in the “Expression”
column (Add new expression), type z and then <enter>. An ampersand is not used here.
The expressions window knows you are specifying a symbol. (Note that the expressions
window can be manually opened by clicking: View Expressions on the menu bar).
Check that the expressions window and memory browser both report the same value for “z”.
Try changing the value in one window, and notice that the value also changes in the other
window.
Single-stepping the Code
26. Click the “Variables” tab at the top of the window to watch the local variables. Single-step
through main() by using the <F5> key (or you can use the “Step Into” button on the
horizontal toolbar). Check to see if the program is working as expected. What is the value
for “z” when you get to the end of the program?
Terminate Debug Session and Close Project
27. The “Terminate” button will terminate the active debug session, close the debugger and
return Code Composer Studio to the CCS Edit perspective view.
Click: Run Terminate or use the Terminate icon:
28. Next, close the project by right-clicking on Lab2 in the Project Explorer window and select
Close Project.
End of Exercise