Using Example Projects, Code and Scripts To Jump-Start Customers With Code Composer Studio 2.0
Using Example Projects, Code and Scripts To Jump-Start Customers With Code Composer Studio 2.0
ABSTRACT
This application note describes the new and improved features of Code Composer Studio
(CCS) 2.0 and provides instructions on how to use the new features. This is done by utilizing
existing examples and sample code that are shipped with Code Composer Studio 2.0. This
note attempts to correlate the new features with the Code Development cycle.
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Code Composer Studio and the Code Development Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 The Code Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 The Debug Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 The Analyze Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.4 The Optimization Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.5 New Features of Code Composer Studio 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Configuring and Launching Code Composer Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1 Choosing Your Code Composer Studio Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Code Composer Studio Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4 Before Beginning Your First Code Composer Studio Session . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1 Choosing an External Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2 Enabling and Disabling the External Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Other Tabs on the Customize Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5 Code Composer Studio and Source Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1 Setting up Source Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2 Source Control Tool Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6 A Simple Project With Code Composer Studio 2.0 – Code Phase . . . . . . . . . . . . . . . . . . . . . . . 13
6.1 Adding Files to Your Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.2 Description of the Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.3 The Code Composer Studio Project Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.4 Code Composer Studio and GEL Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7 Building a Project With Code Composer Studio 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.1 Code Composer Studio Build Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.2 Using the Visual Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Code Composer is a trademark of Texas Instruments.
All trademarks are the property of their respective owners.
1
SPRA766
List of Figures
Figure 1. Code Composer Studio Setup Dialog and Import Configuration Dialog . . . . . . . . . . . . . . . . . . 5
Figure 2. Board Properties Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 3. Customize Dialog Box With Editor Properties Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 4. Select Source Control Provider Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 5. Source Control Setup Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 6. Add Files to Project Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 7. Project Manager With Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 8. Build Window Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 9. Build Options Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 10. Linker Configuration Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 11. Build Window Utilizing Visual Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 12. Visual Linker Recipe Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 13. Symbol Browser Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 14. DSP/BIOS Configuration Template Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 15. DSP/BIOS Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 16. Graph Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 17. Watch Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 18. Profile Statistics Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 19. Profile Range Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 20. PBC Wizard Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
1 Introduction
This application note uses existing code and sample files that ship with Code Composer Studio
2.0 to walk through the code development cycle. It also highlights the new features that are part
of this release and utilizes them while explaining the development cycle.
The purpose of this application note is to provide an introduction to Code Composer Studio 2.0,
and allow developers to acquaint themselves with the latest features offered by the IDE.
For the purpose of this application note, the Code Composer Studio 2.0 simulator is used,
configured as a TMS320C64x, (C64x) using fast sim and little-endian configuration. For
simplicity, the HELLO2 tutorial that is included with Code Composer Studio is used. You should
also bear in mind that the following steps and principles can be applied to actual DSP hardware
targets and most ISAs (Instruction Set Architectures).
TIP – The Code Composer Studio simulator does not support multiple processors.
TIP – Code Composer Studio does not affect, add or modify any environment variables
nor is there a need for you to make any additions or changes to the autoexec.bat file
(depending on whether you are using Windows 98, Windows 2000 or Windows NT). This
information is stored in the registry. If you need to build from a command line or set any
environment variables, please run the batch file DosRun.bat (generated and located in
the c:\ti directory during default installation).
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 3
SPRA766
4 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Figure 1. Code Composer Studio Setup Dialog and Import Configuration Dialog
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 5
SPRA766
Platform – Allows you choose the proper hardware platform that you are working with on a
particular session such as DSK, EVM, Simulator, All, etc.
Endianness – Allows you to choose the type of endianness that you want to build your code
with. The choices are: big, little or all.
When you highlight any configuration file in the Import Configuration dialog, the detailed
information on that configuration file populates the Configuration Description field. This field is
directly below the Filters section. This information tells you what DSP target the configuration file
supports and other information. In some cases the description also informs you of the peripheral
devices the file does and does not support, such as McBSP and DMA. The Advanced>> button
offers some other functionality such as the capability to import configuration files from other
directories and the ability to deal with duplicate filenames.
6 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
The first tab, Board Name & Data File, allows you to see what type of board is configured and
the device driver location. The Board Properties tab informs you what configuration file and
endianness the software is using. The Processor Configuration tab allows you to select a single
processor, add multiple processors, or remove one or more processors from the configuration.
The Startup Gel File(s) tab enables the running of a GEL (General Extension Language) file to
initialize and configure the target DSP. This is required because sometimes, depending on the
target DSP, certain registers and memory must be configured in order for the target DSP to
receive and run code properly, and for proper operation of the DSP as well as debugging your
code.
For more detailed information on any part of the setup procedure or component thereof, please
consult the extensive online documentation. After going through the setup procedure, you are
prompted to Save the configuration. If Yes is chosen, you are prompted to Start Code Composer
Studio on exit. Answering Yes opens up the Code Composer Studio application while a No
response simply saves your setup information without opening the application. Once you have
chosen your configuration and saved it, this setup information is stored in the registry and in the
ccBrd.dat file. This file is binary and is non-editable.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 7
SPRA766
8 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Once you have set up Code Composer Studio to use an external editor in the Customize dialog
box, just click on the Apply button and then the OK button for the changes to take effect.
See Figure 3 for a look at the Customize dialog box. For more detailed information on External
Editor Support, please refer to the Code Composer Studio online help.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 9
SPRA766
Directories Tab – This tab allows you to specify the path that the debugger uses to locate the
source files that are included in your project. The directories list displays the defined search path
and the debugger searches the directories listed in order from top to bottom. If two files have the
same name but are in different directories, the file in the directory that is highest in the list has
priority over the file in the lower directory. This dialog allows you to add a new directory, delete a
directory already in the list or to move a directory in the list either up or down in priority.
Color Tab – This tab enables you to change the default colors of different screen elements of
the Code Composer Studio environment. Once a color is changed and applied, this information
is stored in the Code composer Studio workspace (covered later). You can change the colors of
various texts, backgrounds, graph and axis backgrounds, grids, sets of keywords and function
names.
Editor Properties – This tab not only allows you to choose and utilize an external editor as
discussed in section 4.2, but enables you to set tab stops, browse files while debugging, open
files as read-only, auto-save before build and prompt before reloading. You can also select the
Cursor mode. In Stream mode your editor acts similarly to the way Microsoft Word selects and
inserts text. In Virtual whitespace mode you can use the mouse or arrows keys to move the
cursor to any place within the document window. The editor automatically fills in any whitespace
between the cursor and the end of line with spaces. You can also set keyword color highlighting
to suit your own development standards or according to target processor and file type, including
GEL files. To do this, you can create your own custom keyword files or use one of the four
provided keyword files. You can also choose the functionality of your selection margin, which by
default, is displayed on the left side of the Code Composer Studio editor and on disassembly
windows. There are colored icons in the selection margin that tell you where you have a
breakpoint (red dot) or a Probe Point (blue dot) set at a particular location. A yellow arrow
indicates the location of the program counter. This feature also allows you to display line
numbers and marker points associated with a particular line of code. You can also change the
width of the selection margin by entering a number between 20 and 999 as well as the mode of
operation, to Normal mode or Range mode. For more detailed information on this dialog tab or
any features listed, please consult the Code Composer Studio online help.
TIP – This functionality not available with an external editor.
Keyboard Properties Tab – There are a number of default keyboard shortcuts that come with
Code Composer Studio that enable you to save time in performing repetitive or multiple
keyboard/mouse commands by using a single key or combination of keys. Among the default
shortcuts are the ability to: move insertion point, scroll and select text, delete, insert or copy text,
window management, mark text, various debugging shortcuts and so on. You can also assign
custom keyboard shortcuts or change the default shortcuts for any editing or debug commands
that can be invoked from any document window. There is more information on using this
functionality in the Code Composer Studio online help.
TIP – Please take note that these features are only available in document windows.
10 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Program Load Options Tab – This tab allows you to select certain actions that are to
automatically happen when programs or symbols are loaded onto the DSP or simulated DSP.
The options available here are: Perform verification after Program Load, which enables Code
Composer Studio to verify the program was loaded onto the target correctly. It does this by
reading back selected memory from the target. The next option is Load Program After Build,
which automatically loads your executable right after it has been built or modified. This
guarantees that you have loaded the latest symbol information onto your target. Finally, the last
option is Add Symbols With Offsets, which enables you to specify a code offset and a data offset
when a new symbol file is loaded using the Add Symbols command. The symbol file specifies
the code and data addresses where symbols are to be loaded.
Control Window Display Tab – The topmost section, Title Bar Displays, allows you flexibility in
the information that is displayed in the title bar of the Code Composer Studio control window. In
some cases, you may be working on several projects simultaneously. Some of these projects
may have different board names, processor names or types and these may be specific to a
product that is to be released. You may find it easier to administer and work with projects that
have additional details in the title. The next section of this tab enables Code Composer Studio to
display the full pathname to the source files. You can also select whether to close all windows of
the project when the Project close option is selected or to close projects when exiting the Control
Window.
File Access Tab – This tab allows you to select the maximum number of recent files to display
in the list in the Code Composer Studio File and Project menus. Recent source files, Programs
and Workspaces can be selected from the File menu. You can select from 1–10 files to display
and the default is 4. You can also select between 1–10 (maximum) project files to display in the
Project menu. Code Composer Studio allows you to Reset All File Directories when a project is
opened by simply ensuring that box is checked.
Shared Memory Configuration Tab – The operations on this tab allow you to halt all
processors with executable code on a shared block of memory to ensure that no breakpoints are
missed and so that invalid code is not executed. The second option allows you to override the
default action when stepping over a breakpoint that is set in a shared memory block. When
stepping over a software breakpoint, the breakpoint has to be cleared first, then the processor
steps, then the breakpoint is reset. Any other processors executing code in that shared memory
block could miss the breakpoint. By default, when specified as a shared memory attribute, all
processors that have executable code on that memory block are halted until the code has
stepped over the breakpoint.
Advanced Editor Features Tab – This tab allows you to enable or disable certain features of
the integrated editor. The Code Composer Studio editor prompts you with a tooltip as it attempts
to recognize the word you are typing. The editor also tries to complete any words you are typing:
simply type a few letters and hit the Tab key to be presented with a list of possible selections.
The integrated editor also attempts to select the correct case for any keyword you are typing if
this feature is enabled. You can enable Code Composer Studio to display a list of members
available for an object by typing a period that separates the object name and the member name.
TIP – This functionality is not available when using an external editor.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 11
SPRA766
12 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 13
SPRA766
You need to ensure that the following files are added to the project before the executable can be
built: hellocfg.cmd, hello.c, rts6400.lib. Once these files have been added, you can right-click on
the project name in the Project Manager and Scan All Dependencies. This automatically adds
the last files needed, the header files (*.h).
Once all the above files have been added to the project, you can check the Code Composer
Studio Project Manager to review the file structure and examine what files were added to a
particular folder. The Project Manager also supports drag and drop functionality from the
Windows Explorer. In this example, the Project Manager should look like Figure 7:
14 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 15
SPRA766
RTS6400.lib – (library file) – is the run-time-support object library for use with C/C++ code. It
contains the following:
ANSI C/C++ standard library
C I/O library
Low Level support functions that provide Input/Output to the host system
Intrinsic arithmetic routines
System startup routine, _c_int00
Functions and Macros that allow C/C++ to access certain instructions
*.h – (header files) – contain variable declarations and function definitions. These files are
automatically added to your project if referenced in your C source file. Others are created as a
result of using DSP/BIOS. This is explained in more detail later.
*.cmd – (linker command file) – contains linker options and names the input files for the linker. It
also defines memory on the DSP and tells your code what areas it can write to.
Hellocfg.cmd – is the DSP/BIOS linker command file
Hellocfg.h – includes DSP/BIOS module header files and declares external variables for objects
that are created in the configuration file.
Hellocfg_c.c – contains code for the CSL (chip Support Library) structures and settings, and is
generated by the DSP/BIOS Configuration tool. It is recommended that this file is not modified.
Hellocfg.s62 – is an assembly language source file for DSP/BIOS settings.
Hellocfg.h62 – is an assembly language header file that is included by Hellocfg.s62.
Hello.cdb – is a DSP/BIOS configuration database file which stores the DSP/BIOS configuration
settings.
GEL files – are .gel extension files that are either supplied with Code Composer Studio or are
created by you. When added to a project, they can be used for customizing the environment,
automating testing, configuring the DSPs’ memory and registers and creating dialog and slider
bars.
HELLO.CCF – exists in the project directory. This file is temporary and only exists when the
configuration file is open. It is strongly recommended that this file is not modified, opened or
deleted.
TIP – It is strongly recommended that the HELLO.CFG file is not opened, modified or deleted.
16 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Multiple configurations are supported with the Project Manager in that you are permitted to
utilize separate build options for each configuration. You can also create Release or Debug
(created by default) configurations and are free to add custom configurations. These project
configurations define sets of project level build options and when specified, they apply to every
file in a particular project.
Code Composer Studio also allows you to specify the order in which all the files in your project
are to be linked. In other words, this functionality allows you to control the order that object files
and libraries are linked at build time.
More information is available on the Project Manager topics in the Code Composer Studio online
help.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 17
SPRA766
Once all the files are loaded, you can check the Load Program After Build checkbox in the
Customize dialog that was described in section 4.3. This ensures that the executable is loaded
immediately after a successful build. Please ensure that you have loaded and run the correct
GEL file to setup the DSP target to receive your executable. In this case, the init64xxsim.gel file
must be loaded and run by clicking on the GEL menu item and then the
Resets→ClearBreakPts_Reset_EMIFset.
There are three ways to issue a Build command, from the menu or from the icon and they are as
follows: select Project→Build, click the icon beside the active configuration dialog box, or
right-click on the project name in the Project Manager (in this case, HELLO.PJT). Once you
have chosen your preferred method to build, a Build window opens in the lower section of the
Code Composer Studio interface. It will look like that shown in Figure 8.
Any errors and unresolved dependencies will appear in this window in red text. Provided you
have all source files relating to this project loaded, double-clicking on any line containing an
error in the build window causes one of two actions: if using the Code Composer Studio editor,
the source file automatically opens up with the cursor flashing at the offending line or, if you are
using an external editor, it becomes active in the task bar at the bottom of your PC screen and
has the cursor flashing at the offending line of code that needs to be corrected. You also have
the option to turn off the external editor by clicking on the icon at the top right corner of the icon
bar within the Code Composer Studio environment. This allows you to selectively use one editor
or the other or to toggle back and forth between editors.
Your build window may not look exactly like the one in Figure 8 because your directory structure
may be different than the test system that was used for the purposes of this application note.
Double-clicking on any line in red in the build window opens the source file associated with the
error in either your external editor or the Code Composer Studio editor and takes you to the
suspect line of code. Errors are something that must be addressed before you can proceed with
your development, but warnings are something that you can choose to ignore because they will
not impede your progress.
18 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 19
SPRA766
As can be seen in Figure 9, there are four tabs on this dialog that provide a great deal of
flexibility when building a project. These tabs each have your own purpose as is described
below.
General Tab – This tab allows you to specify the order of the initial and final build steps, place
additional steps in either the initial or final steps, change the order, apply custom build steps,
delete any build step, exclude a particular step from the build process, remove any files that
have been generated by the build, define a path and filename for the executable and any other
files created during the build process, etc.
Compiler Tab – This tab is used to allow you to choose commonly used compiler options,
optimization speed versus size, optimization level, and program-level optimization. The other
categories provide you with the ability to choose endianness and memory model, control
aliasing, provide feedback banners during the build, specify .obj and listing directories (among
others), control the assembly process, control the parser and preprocessor functions, and select
diagnostics. At the top of the Compiler options tab, there is a window (scrollable) that provides
you with a line summary of all the options to be used during the final build. When checking or
highlighting any particular category from Basic to Diagnostics, you are presented with various
checkboxes, pull-down menus and/or text boxes. These features can be used with the default
options or if preferred, you can select the options and functionality you prefer or need for a
particular project. When any option is chosen, you can see the options change in the scrollable
window at the top of the Build Options dialog. You can also simply add your own options to this
scrollable window, but in many cases this requires a thorough knowledge of the actual text
commands for the options requested. As can be seen in the scrollable window, the example
string provides the path of the project .obj files, the configuration of the project (in this case,
debug) and target information. You can also see that this project will be compiled with full
symbolic debug (–g option), with no banners (–q option) and with symbols defined (–d option).
Linker Tab – Similarly to the Compiler tab window at the top of the screen, the Linker tab also
provides a scrollable window that provides you with a summary of all the options that will be
used during the link phase of the build. As described for the Compiler tab, whenever an option is
chosen on the Linker tab, you can see the line summary or string change in the scrollable
window. This scrollable window supports not only direct editing, but the ability to specify options
that are not listed in the dialog. The executable filename and the directory of the executable are
also present in this scrollable window.
TIP – Whenever options are typed directly into the scrollable window in either the
Compiler tab or the Linker tab, you must click inside the window in order to update the
display.
Link Order Tab – This tab allows you to choose the order that object and library files are linked
into the project during the build. If you have implemented multiple versions of the same function
in different files, link order is very important to ensure that the correct version is linked into the
program being built. This tab allows you to specify the link order, change the link order, remove a
file from the list of files to be linked, and so on. In the lower window on this tab, you are
presented with a list of the files that are not in any order to be linked. This list of files will execute
after the files in the link order window.
For more information on any of the Build Option tabs or categories, please refer to the Code
Composer Studio online help.
20 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
As well as using the text linker through the Linker tab, you can also use the Visual Linker that is
supplied with Code Composer Studio. The difference between these two methods is that the text
linker generates a single COFF (Common Object File Format) object module from the object
files of a particular project. The linker instructions in the linker command file (.cmd) enable you to
unite object file sections and to attach sections or symbols to addresses or memory ranges. You
can also define or redefine global symbols within the project.
Where the text linker combines the object files from a project to generate a COFF object module
or executable file, the Visual Linker allows interaction from you when linking to create an
executable. This method uses object files and a memory description as input. You can then drag
and drop the object files to arrange a graphical model of memory. When you have chosen a
satisfactory memory model, the executable (.OUT) can be generated.
From the Linker Configuration dialog, you can select whether to use the Visual Linker or the
legacy text linker. Once the option for the Visual Linker has been selected, simply click OK and
then select Project→Rebuild All from within the Code Composer Studio environment. Code
Composer Studio then proceeds in going through the build process. Please bear in mind that the
project does not progress beyond the link stage due to the fact that the Visual Linker has been
selected.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 21
SPRA766
Once the software has progressed to the link stage, you are presented with a series of
messages as detailed in Figure 11.
Code Composer Studio has now informed you that there is no visual Linker recipe file in this
project. In order to generate one, simply double-click on the lower of the error messages as it
says.
Once you have done this, Code Composer Studio presents a Visual Linker Wizard to walk you
through the process. There are a total of nine steps to this process that walk you through it.
During this process, you have the flexibility to choose when to initialize global variables, to do a
full or partial link, and then present a summary of the features of the recipe that is about to be
created. You can then choose to accept these features or continue on through the Wizard in
order to change them.
The Wizard next prompts you to translate the SECTIONS directives and provides several
options for you to choose. You also have the option not to translate these directives.
Following the options for SECTIONS directives, you are provided with output file information and
the opportunity to change the name and/or location of both the output file and the map file from
the ones Code Composer Studio has detected.
Moving forward through the Wizard, you can choose to accept the default sizes for the stack and
heap size, or change them to increase or decrease the sizes.
In step 7 of the Wizard, Code Composer Studio has detected a code entry point and section for
interrupt vectors. Here, you have the choice of accepting what Code Composer Studio has
detected or to change these options.
The next step involving the Wizard is the Roots portion. This page provides a list of all the input
sections that are not reachable from the noted code entry point or interrupt vector section. Any
section listed here can be included in the linked image by checking the appropriate box beside
the section.
The final step of the Wizard is some information about the Mission of the Wizard. It informs you
that the recipe file has been added to the project and can be found in the Code Composer
Studio Project Manager. The name of this file will be HELLO.RCP. In order to use this file, you
only need to double-click on it and the screen in Figure 12 should appear.
22 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
The screen in Figure 12 indicates that a recipe file has been successfully created. You can
resize the window so that all four panes are visible. Depending on the target configuration, the
elements contained in this file may vary and may not be exactly as depicted in Figure 12.
If you want to accept the recipe that the Visual Linker has generated, then continue with building
your code. However, if you want to obtain more information on the specifics and particulars of
using the Visual Linker or how to allocate or change a program in memory, it is strongly
recommended that you refer to the online help.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 23
SPRA766
In order to use the Watch Window, you need to ensure that Code Composer Studio has been
launched and that your executable has been launched on the target. In this case, you open the
HELLO2 tutorial and load the executable file, HELLO.OUT. Once this is done, you set a
breakpoint at the line: LOG_printf(&trace, hello world!);
The breakpoint can be set using either a double-click in the selection margin or by right-clicking
on the line of code you wish to set the breakpoint at, then selecting the Toggle Breakpoint
option. Breakpoints can also be set using the F9 key or by using the icon that looks like an open
hand.
At this point, you can either use the different colored icons in the selection margin to indicate
breakpoints, Probe Points or Profile Points or use the Customize dialog box to choose the option
of the whole line to change color wherever a breakpoint, Probe Point or Profile Point is set. You
can even get creative and select any color you want to indicate the various types of breakpoints
in the selection margin.
TIP – Please ensure that whatever color you choose does not obscure the keywords in
the editor because colors similar to your keywords makes seeing them difficult.
You then need to open the Watch Window by going to the Code Composer Studio View menu
and selecting the Watch Window option. The Watch Window opens at the bottom-right corner of
the Code Composer Studio environment. This area shows the value of watched variables when
running your code. The default mode of the Watch Window displays the Local variables tab to
display variables local to the function being executed.
In order to add a variable or variables to the Watch Window, several methods have been
implemented to achieve this. You can click on the expression icon in the Name field of the Watch
Window and simply type the name of the variable in this field or you can highlight the variable in
the source window, right-click and choose the Add to Watch Window option.
You can also use the Watch Window to watch structures, and by double-clicking on any element
in the structure, the value for that element can be edited. The same principle applies with arrays.
Please note that whenever a variable is changed, the change is reflected in the Watch Window
and the value is in red. The red color of the variables indicates that the value has changed most
recently.
24 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
The Files tab displays a list of all the files that are in the currently loaded executable. If you click
on the plus (+) sign in front of the executable filename, a complete list of all the files that are in
the output file is presented. Each file listed can be further expanded to show all the functions in
that file and each function can be expanded to show the local variables in the function and so
on. Double-clicking on a filename displays the files’ source code in a document window. This
action holds true for the other tabs within the Symbol Browser as well.
There are some limitations when using GEL expressions with C++ and they are summarized as
follows:
• No pointer adjustment is made when casting to or from a virtual base class
• Identifiers after a “.” Or “–>” operator cannot be qualified
• The destructor of a class cannot be named
• Pointer to member values appear as implementation structures
• Type synonyms defined with typedef are not available
• Types must be fully qualified and cannot be partly qualified the same way as identifiers
• The IDE does not identify dynamic or run-time type objects that base class pointers refer to
• GEL expressions must dereference C++ references, otherwise they appear as pointers
It is recommended that you be familiar with C++ and that the online help be reviewed before
moving forward in working with C++.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 25
SPRA766
26 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
You are required to select the configuration database (.cdb) file template that most closely
matches your target. In this case, the C64x.cdb template is used. Once this has been
accomplished, please note that the Configuration window is now visible on the screen. On the
left side of this screen, you see categories of modules and if you click on the plus (+) sign beside
any of these categories, you are presented with the modules contained in each of these
categories. You can also see the various module managers and if you click on the plus (+) sign
to the left of the module manager, you can see the modules objects. The right side of this
window displays the properties of the selected module manager or object.
For this exercise, you need to create a DSP/BIOS configuration file, so from the information you
currently have on the screen, make the required changes as outlined below:
• From the Event Log Manager option, LOG – please choose Insert Log after right-clicking on
this item
• right-click on the newly formed LOG0 object and choose to rename it to trace
• From the Code Composer Studio menu, choose File→Save and save this file as
HELLO.CDB
This file should look like Figure 15:
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 27
SPRA766
Saving the configuration in Figure 15 generates a series of files. These files are header files,
linker command files, BIOS header files, and so on. You also need to remove the library file that
you used previously. A file named hello.ccf, which is a temporary file that is spawned when
opening the configuration file, is shown. It is not recommended to open, modify or delete this file.
You then need to add the specific DSP/BIOS files to the project as you did in the beginning.
Once these DSP/BIOS generated files have been added to the project, you need to remove the
files they have replaced. In this case, the files hello.cdb and hello.cfg.cmd, are added or need to
be added to the project. Once you have added these files, ensure you are also working with the
Visual Linker or the text linker as the case may be, and go to Project→Rebuild All.
Please ensure that the executable has been loaded after the Rebuild All step and then go to the
DSP/BIOS message log. In order to launch this, simply go to the DSP/BIOS menu item and
down to the Message Log option. This step presents the message log at the bottom of your code
Composer Studio screen. In order to test the program, right-click on the message log screen and
choose Properties Page. The Message Log Properties dialog appears. At this point, you need to
check the Log to File checkbox and click OK. Go to the Debug menu and click on the Run
option. After a few seconds, the HELLO WORLD string should appear in the message log
window. Right-click on the message log window and then do a File→Open and in the Debug
folder, there should be a HELLO.TXT file. If you open up this file, it should contain the same
message that was just in the Message Log window. If you don’t see anything in the HELLO.TXT
file, it is likely because you did not close the Message Log window.
28 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
At this time, it is also recommended that you disable the RTDX functionality, because Profiling is
used in section 10.1. In order to do this, go to Tools→RTDX→Configuration Control in the Code
Composer Studio environment. This should be done because on most DSP platforms, the
profiler and RTDX cannot be used at the same time. For more detailed information on moving
forward with DSP/BIOS and the Real Time Analysis Tools, it is recommended that you refer to
the Code Composer Studio tutorial and online help.
There is also the new functionality of the Chip Support Library (CSL) which is a C language
interface for configuring and controlling peripherals that are on chip. These peripherals include
timers, DMA, and McBSP. It consists of modules that are built and archived into a library file.
More information is available on this topic in the online help.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 29
SPRA766
For more information on Advanced Event Triggering, please consult the online help and ideally,
work through the Code Composer Studio tutorial.
30 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
You can also add the inp_buffer variable to the Watch Window and view the data as it is being
streamed into the code. This window appears as in Figure 17.
Note that by left-clicking on the RADIX column in the Watch Window, you can change or select
the data type that you want to view.
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 31
SPRA766
32 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
This window was actually too big to fit on the page for the purposes of this application note, but
as can be seen, it provides the capability to calculate inclusive and exclusive counts, information
on file size, information on functions, ranges, and setup. The setup tab provides information on
the start and end points that you have chosen. The icons on the left side of the profile statistics
window allow you to enable or disable a session, profile all the functions in your code, create a
profile area (for profiling a few lines at a time), create start and end points of where to profile,
and to enable or disable a profile area. Another feature of this window is the ability to generate
reports on the profiling statistics after you have profiled your code.
For the purpose of this application note, the Profile All Functions option was selected from the
Satistics window. A Profile Range has been set up in the left-hand selection margin of the
C source code and that should look similar to that in Figure 19:
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 33
SPRA766
Once you begin to animate (Debug→Animate) the code, the various fields within the profiler
stats window begin to populate with data obtained from the profiling process. From here, you
can determine where the majority of the CPU cycles are being used, and can begin to optimize
from there with the goal of executable speed or size.
In order to enable to the PBC, simply go to the PBC menu at the top of the screen and down to
the Enable option. This displays the PBC Startup dialog that walks you through either the tutorial
or the Getting Started phase of using this tool. Clicking OK opens up the PBC Wizard, which
walks you through the process of creating configurations for your application. The PBC Wizard is
illustrasted in Figure 20:
34 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
SPRA766
Each tab is numbered to allow you to follow the process through in logical progression. Passing
the cursor over each tab displays options for each step in the process.
The Setup tab allows you to select Exit Points, Profile Ranges, and PBC Configurations.
The Profile tab provides the ability to Build and Profile a configuration, or to ReBuild and
ReProfile a configuration.
The Select Configuration tab lets you view your selected configuration and view or apply any
overrides. Overrides are specific compiler options that have been ignored for a particular
function.
The Save tab lets you verify your configuration and save it to a project.
When building and profiling from the Profile tab, please ensure that you have created an exit
point for any application you wish to profile that is not self-terminating, otherwise the build and
profile stage could go on indefinitely. For more information on Profile Based Compilation, please
refer to either the online help or the PBC Wizard to walk you through the process.
11 Summary
Over the past pages of this application note, many things were accomplished and many new
features and functionality were introduced. In summary the following were discussed:
• The building of code using the Code Composer Studio Editor and Project Manager
• How to link a program with the Visual Linker and to configure CCS to use either the Visual
Linker or the text linker
• How to set up CCS to use an external editor and source control
• The debug phase of the development cycle where the Symbol Browser and C++ Support
were introduced
• Steps to analyze code, and DSP/BIOS, Chip Support Library, Advanced Event Triggering,
and graphing functionality
• The CCS profiler and Profile Based Compilation
Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0 35
SPRA766
By now, you should have a basic understanding of the Code Composer Studio environment and
what all the features included with the software do. Unfortunately, it is impossible to provide the
detailed information in this application note to make one an expert with the software. That will
come with exposure and practice with the environment as well as reading through the online
help and working with the examples that are supplied.
Code Composer Studio Setup – has been enhanced to include many new target-specific
configuration files to reflect the many new TI DSPs on the market.
Code Generation Tools – the Texas Instruments compiler has been enhanced to support C++.
There is also a new linker option to enable function subsections and the run-time libraries
support both C and C++.
CCS Debugger – has been upgraded so you can specify the search path for include files and to
view local variables while debugging. There is also support for shared memory and a series of
new GEL functions have been added.
DSP/BIOS – now supports C55x and C64x platforms as well as C++. There is also a HWI
dispatcher that supports the C54x platform. The configuration and analysis tools have also been
enhanced.
CCS Project Manager – has been enhanced to support multiple projects and allow you to save
an active project before switching to another project. There is also support for multiple
configurations and the ability to specify a link order when building a project. External make file
support and source code control has also been added.
RTDX – Real Time Data Exchange has been added to allow you to transfer data between host
and target without interfering with the target application. This allows you to monitor your system
in real-time which is important for providing a realistic representation of your system in time
critical applications.
Text Editor – has been upgraded to provide you with more flexibility for choosing cursor mode,
editor properties, selection margin, keyword highlighting, choosing a third party editor, etc.
TI Command Window – many new features have been incorporated into this area and they are
as follows: Profile Based Compiler, Watch Window, Symbol Browser, Component Manager,
Update Advisor, and Advanced Event Triggering.
TMS320 Algorithm Standard – TI has created this algorithm standard to provide a common
platform or template for any algorithms to run on TI DSPs. This allows these algorithms to be
portable and standardized.
Visual Linker – allows you to visually see and configure your code into a graphic representation
of memory on the DSP.
36 Using Example Projects, Code and Scripts to Jump-Start Customers With Code Composer Studio 2.0
IMPORTANT NOTICE
Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue
any product or service without notice, and advise customers to obtain the latest version of relevant information
to verify, before placing orders, that information being relied on is current and complete. All products are sold
subject to the terms and conditions of sale supplied at the time of order acknowledgment, including those
pertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its products to the specifications applicable at the time of sale in accordance with
TI’s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary
to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except
those mandated by government requirements.
In order to minimize risks associated with the customer’s applications, adequate design and operating
safeguards must be provided by the customer to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent
that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other
intellectual property right of TI covering or relating to any combination, machine, or process in which such
products or services might be or are used. TI’s publication of information regarding any third party’s products
or services does not constitute TI’s approval, license, warranty or endorsement thereof.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations and notices. Representation
or reproduction of this information with alteration voids all warranties provided for an associated TI product or
service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Resale of TI’s products or services with statements different from or beyond the parameters stated by TI for
that product or service voids all express and any implied warranties for the associated TI product or service,
is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.
Also see: Standard Terms and Conditions of Sale for Semiconductor Products. www.ti.com/sc/docs/stdterms.htm
Mailing Address:
Texas Instruments
Post Office Box 655303
Dallas, Texas 75265