You are on page 1of 38

Program Development Tools

Code Composer Studio® IDE

1
Code Composer Studio® IDE
Menus or Icons Help CPU
Project Manager: Window
¾Source & object files
¾File dependencies
¾Compiler, Assembler
& Linker build options

Full C/C++ & Assembly


Debugging:
¾C & ASM Source
¾Mixed mode
¾Disassembly (patch)
¾Set Break Points
¾Set probe Points

Productive Editor:
¾Structure Expansion Status Watch window Graph
window Memory window
window

2
Code Composer Studio
Build SIM
Compile lnk.cmd Probe In

eZdsp™
Asm Link Debug
EVM
DSP/BIOS
DSP/BIOS Probe Out
Edit Config Third
Libraries Graphs
Tool Party
Profiling

XDS
• Code Composer Studio includes:
– Integrated Edit/Debug GUI
– Code Generation Tools DSP
– DSP/BIOS
Board

3
Code Composer Studio: IDE

• Integrates: edit, code generation, and debug


• Single-click access using buttons
• Powerful graphing/profiling tools
• Automated tasks using GEL scripts
• Built-in access to BIOS functions
• Support TI or 3rd party plug-ins

4
The CCS Project
Project (.pjt) files contain:

• Source files (by reference)


– Source (C, assembly)
– Libraries
– DSP/BIOS configuration
– Linker command files
• Project settings:
– Build Options (compiler and assembler)
– Build configurations
– DSP/BIOS
– Linker

5
Build Options GUI - Compiler

• GUI has 8 pages of categories for code generation tools


• Controls many aspects of the build process, such as:
– Optimization level
– Target device
– Compiler/assembly/link options

6
Build Options GUI - Linker

• GUI has 2 categories for linking


• Specifies various link options
• “.\Debug\” indicates on
subfolder level below project
(.pjt) location

7
Default Build Configurations
• For new projects, CCS automatically
creates two build configurations:
– Debug (unoptimized)
– Release (optimized)
• Use the drop-down menu to quickly
select the build configuration

• Add/Remove your own custom


build configurations using Project
Configurations
• Edit a configuration:
1. Set it active
2. Modify build options
3. Save project

8
eZdsp™ F2812 Hardware
JTAG Interface (P1) EXPANSION SRAM
Data & Address (P2) 64K x 16

Parallel Port/
JTAG
Controller
Interface (P3)

Power TMS320F2812 - DSP


Connector (P6) ANALOG
+5V Interface (P5/P9)
I/O Interface (P4/P8/P7)
9
Connecting the eZdsp™ to your PC

25 pin male
D-sub connector
(Plugs into parallel
port on PC)

25 Conductor Cable

eZdsp™ F2812

25 pin male
D-sub connector
Power
Supply

25 pin female To wall outlet


D-sub connector

Code Composer Studio – eZdsp™ F2812 Configuration


10
Lab Experiments - the Peripheral Adapter

1 SPI EEPROM ( M95080)

8 x switch

1 CAN - Transceiver ( SN 65HVD230 )

8 x LED
1 CAN - Transceiver ( TJA 1054 )

1 Loudspeaker

1 SPI DAC ( TLV 5617 ) 1 I2C Sensor ( DS 1621)

2 x push- button
2 potentiometers 1 SCI - Transceiver (MAX 232)

eZdsp™ F2812 plus Zwickau Adapterboard


11
Learning by doing - Step by Step

Code Composer Studio® - The Basics


1. The Start-up - Window
2. Create a F28x - project, based on C language
3. Debug your program
4. Watch your variables
5. Perform a Single Step Debug
6. Use Breakpoints
7. What is a Probe Point for ?
8. Other View Commands
9. GEL - General Extension Language

12
1. The Startup - Window

Project-
tree
Working
Area

13
2. Create a F28x - project
• Project ==> New
give your project a name : “Lab1”, select a target and a suitable
location of your hard disk:

Note : the project file (“Lab1.pjt) is a plain ASCII-text file and stores
all set-ups and options of the project. This is very useful for a version
management.
14
2. Create a F28x - project (cont.)
• Write a C-Source Code :
ÎFile ÎNew ÎSource File
unsigned int k;
void main (void)
{
unsigned int i;
while(1)
{
for (i=0;i<100;i++)
k=i*i;
}
}

Î File ÎSave as : “lab1.c”

15
2. Create a F28x - project (cont.)

16
2. Create a F28x - project (cont.)
• Add your file to the project :
– Î Project Î Add files to project
– Add: “lab1.c”

• Compile your source code :


Î Project Î Compile File
– active window will be compiled
– in the event of syntax errors : modify your source code as needed

• Add the C-runtime-library to your project :


Î Project Î Build Options Î Linker Î Library Search Path :
c:\ti\c2000\cgtools\lib
Î Project Î Build Options Î Linker Î Include Libraries :
rts2800_ml.lib

• Add the stack- size of 0x400


Î Project Î Build Options Î Linker Î Stack Size : 0x400

17
2. Create a F28x - project (cont.)

Close the build-window by ‘OK’


18
2. Create a F28x - project (cont.)
• Add the Linker - Command File to your project:
Î Project Î Add Files to Project Î ..\cmd\EzDSP_RAM_lnk.cmd
• Finally : Build the code ( compile / assemble / link ) :
Î Project Î Build

19
Placing Sections in Memory
Memory
Sections
0x00 0000 M0SARAM
(0x400)
.ebss
0x00 0400 M1SARAM
(0x400)
.stack

0x3D 8000 FLASH .cinit


(0x20000)

.text

20
Linking

zz Memory
Memorydescription
description
zz How
Howto
toplace
places/w
s/winto
intoh/w
h/w

name.cmd

.obj Linker .out

.map

21
Linker Command File

MEMORY
{
PAGE 0: /* Program Space */
FLASH: org = 0x3D8000, len = 0x20000

PAGE 1: /* Data Space */


M0SARAM: org = 0x000000, len = 0x400
M1SARAM: org = 0x000400, len = 0x400
}

SECTIONS
{
.text: > FLASH PAGE 0
.ebss: > M0SARAM PAGE 1
.cinit: > FLASH PAGE 0
.stack: > M1SARAM PAGE 1
}

22
2. Create a F28x - project (cont.)

• Load the binary code into the DSP :


ÎFile Î Load Program Î Debug\Lab1.out

– Note: a new binary code can be downloaded automatically into the target. This
is done by Î Option Î Customize Î Program Load Options ÎLoad Program
after Build. This setup will be stored for permanently.

• Run the program until label “main”

Î Debug Î Go main

23
2. Create a F28x - project (cont.)

yellow arrow :
current PC

24
3. Debug your code !
• Perform a real time run :
Î Debug Î Run (F5)

Note 1: the bottom left corner will be marked as : “DSP Running”.


You’ll see no activity on the peripherals of the Adapter Board because our first
example program does not use any of them !

Note 2: the yellow arrow is no longer visible – that’s another sign of a real time
run.

• Stop the real time run :


Î Debug Î Halt

• Reset the DSP :


ÎDebug Î Reset CPU
ÎDebug Î Restart
• Run again to main :
Î Debug ÎGo Main

25
4. Watch your variables

• Open the Watch Window :


Î View Î Watch Window

• The variable ‘i’ is already visible inside the “Watch Locals”-


window .
• To see also the global ‘k’ we need to add this variable
manually. This can be done inside window ‘Watch 1’. In the
column ‘name’ we just enter ‘k’ and in the second line ‘i’.
– Note : another convenient way is to mark the variables inside the source code
with the right mouse button and then select “Add to watch window”

• note : with the column ‘radix’ one can adjust the data format
between decimal, hexadecimal, binary etc.

26
4. Watch your variables

Watch-
Window
27
5. Perform a Single Step Debug

• Perform a single step trough the program :


Î Debug Î Step Into ( or F8 )

• Watch the current PC ( yellow arrow) and the numerical


values of i and k in Watch Window while you single step
through the code !

• There are more debug - commands available, see next slide

28
5. Perform a Single Step Debug

Source Single Step

Source Step Over

Step Out

Assembly Single Step

Assembly Step Over


Run to
Halt Run cursor

29
6. Adding a Breakpoint
• Set a Breakpoint :
– Place the Cursor in Lab1.c on line : k = i * i;
– Click right mouse and select ‘Toggle Breakpoint’
– the line is marked with a red dot ( = active breakpoint )

Note : most Code Composer Studio Commands are also available through buttons
or trough Command -Keys ( see manual, or help )

• Reset the Program


Î Debug Î Reset CPU
Î Debug Î Restart

• Perform a real time run


Î Debug Î Run ( or F5)
• DSP stops when reaching an active breakpoint
• repeat ‘Run’ and watch your variables
• remove the breakpoint ( Toggle again) when you’re done.
30
6. Adding a Breakpoint (cont. )
Toggle
Breakpoint

Remove all
Breakpoints

Red dot : Yellow arrow :


active Current PC
Breakpoint

31
7. Set a Probe Point
• Causes an update of a particular window at a specific point in your
program.

• When a window is created it is updated at every breakpoint. However, you


can change this so the window is updated only when the program reaches
the connected Probe Point. When the window is updated, execution of the
program is continued.

• To set a Probe - Point :


– Click right mouse on the line ‘k = i*i;’ in the program first.c
– select : ‘Toggle Probe Point ‘ ( indicated by a blue dot )
– select Î Debug Î Probe Points...
– In the Probe Point Window click on the line ‘first.c line 13 -> no Connection’
– in the ‘Connect to’ - selector select ‘Watch Window’
– exit this dialog with the ‘Replace’ and ‘OK’ - Button

• Run the program and verify that the watch window is updated
continuously.

32
7. Set a Probe Point (cont.)

33
8. Other View Commands

• The View menu includes more useful windows to monitor and


control the DSP

• Î View Î Registers Î Core


• Î View Î Registers Î Status
– click right mouse inside the new windows and select ‘Float in Main Window’

– double click on line ‘ACC’ and modify the value inside the Accumulator ACC

34
8. Other View Commands (cont.)

• To view both the Assembler code and the C Source Code :

• click right mouse inside “Lab1.c” and select “Mixed Mode”

• The Assembler Instruction Code generated by the Compiler is


added and printed in grey colour

• Single Step ( ‘Assembly Step Into’ ) is now possible on


instruction level
– Perform : Î Debug Î Reset DSP
Î Debug Î Restart
Î Debug Î Go Main
Î Debug Î Step Into (F8)
– You’ll see two arrows , a yellow one on C-lines and a green one for assembler
instruction-lines
35
8. View C and Disassembly

Current
C - line

Current
Instruction

36
9. GEL - General Extension Language

• language similar to C
• lets you create functions to extend Code Composer's features
• to create GEL functions use the GEL grammar
• load GEL-files into Code Composer

• With GEL, you can:


– access actual/simulated target memory locations
– add options to Code Composer’s GEL menu

• GEL is useful for automated testing and user workspace


adjustment .

• GEL - files are ASCII with extension *.gel

37

You might also like