The MathWorks CC 3 Embedded IDE Link User’s Guide
Embedded IDE Link CC 3 enables you to use MATLAB® functions to communicate with Code Composer Studio™ software and with information stored in memory and registers on a processor. With the ticcs objects, you can transfer information to and from Code Composer Studio software and with the embedded objects you get information about data and functions stored in your signal processor memory and registers, as well as information about functions in your project. Embedded IDE Link CC makes it easy to verify code executing within the Code Composer Studio software environment using a model in Simulink software. This processor-in-the-loop testing environment uses code automatically generated from Simulink models by Real-Time Workshop® Embedded Coder™ software.
Advertisement
Advertisement
Embedded IDE Link™ CC 3
User’s Guide
How to Contact The MathWorks www.mathworks.com
comp.soft-sys.matlab
www.mathworks.com/contact_TS.html
Web
Newsgroup
Technical Support
Product enhancement suggestions
Bug reports
Documentation error reports
Order status, license renewals, passcodes
Sales, pricing, and general information
508-647-7000 (Phone)
508-647-7001 (Fax)
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Embedded IDE Link™ CC User’s Guide
© COPYRIGHT 2002–2009 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government’s needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information.
Revision History
July 2002
October 2002
Online only
Online only
May 2003 Online only
September 2003 Online only
June 2004
October 2004
Online only
Online only
December 2004 Online only
March 2005 Online only
September 2005 Online only
March 2006
April 2006
Online only
Online only
September 2006 Online only
March 2007 Online only
September 2007 Online only
March 2008
October 2008
March 2009
Online only
Online only
Online only
New for Version 1.0 (Release 13)
Revised for Version 1.1
Revised for Version 1.2
Revised for Version 1.3 (Release 13SP1+)
Revised for Version 1.3.1 (Release 14)
Revised for Version 1.3.2 (Release 14SP1)
Revised for Version 1.4 (Release 14SP1+)
Revised for Version 1.4.1 (Release 14SP2)
Revised for Version 1.4.2 (Release 14SP3)
Revised for Version 1.5 (Release 2006a)
Revised for Version 2.0 (Release 2006a+)
Revised for Version 2.1 (Release 2006b)
Revised for Version 3.0 (Release 2007a)
Revised for Version 3.1 (Release 2007b)
Revised for Version 3.2 (Release 2008a)
Revised for Version 3.3 (Release 2008b)
Revised for Version 3.4 (Release 2009a)
Getting Started
Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Components of Embedded IDE Link CC Software
Product Features Supported for Each Processor Family
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuration Information . . . . . . . . . . . . . . . . . . . . . . . . .
Verifying Your Code Composer Studio Installation
Requirements for Embedded IDE Link CC Software . .
Automation Interface
Getting Started with Automation Interface
Introducing the Automation Interface Tutorial
Creating and Querying Objects for CCS IDE
Working with Projects and Data
Closing the Links or Cleaning Up CCS IDE
. . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
Introducing the Tutorial for Using RTDX
Configuring Communications Channels
Listing the Functions in Embedded IDE Link CC software
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Closing the Connections and Channels or Cleaning Up . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
v
vi
Contents
Constructing ticcs Objects . . . . . . . . . . . . . . . . . . . . . . . . . .
Example — Constructor for ticcs Objects
ticcs Properties and Property Values . . . . . . . . . . . . . . . .
Overloaded Functions for ticcs Objects . . . . . . . . . . . . . .
ticcs Object Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Quick Reference to ticcs Object Properties
Details About ticcs Object Properties
. . . . . . . . . . . . . . . . . .
Managing Custom Data Types with the Data Type
Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Adding Custom Type Definitions to MATLAB . . . . . . . . . .
Project Generator
Introducing Project Generator . . . . . . . . . . . . . . . . . . . . . .
Project Generation and Board Selection . . . . . . . . . . . . .
About the CCSLinkLib Blockset . . . . . . . . . . . . . . . . . . . . .
Schedulers and Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuring Models for Asynchronous Scheduling
Multitasking Scheduler Examples
. . . . . . . . . . . . . . . . . . . . .
Comparing Synchronous and Asynchronous Interrupt
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Adding the Target Preferences Block to Your Model
Specify Configuration Parameters for Your Model
Setting Code Generation Parameters for TI
Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setting Model Configuration Parameters
Embedded IDE Link CC Pane Parameters
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
Embedded IDE Link CC Default Project Configuration —
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Custom Source Files in Generated Projects
Preparing to Replace Generated Files With Custom
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Replacing Generated Source Files with Custom Files When
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optimizing Embedded Code with Target Function
About Target Function Libraries and Optimization
Using a Processor-Specific Target Function Library to
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Process of Determining Optimization Effects Using
Real-Time Profiling Capability . . . . . . . . . . . . . . . . . . . .
Reviewing Processor-Specific Target Function Library
Changes in Generated Code . . . . . . . . . . . . . . . . . . . . . . .
Reviewing Target Function Library Operators and
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating Your Own Target Function Library . . . . . . . . . . .
Model Reference and Embedded IDE Link CC
. . . . . . . . . . . . . . . . . . . . . . . .
Using Model Reference with Embedded IDE Link CC
Configuring processors to Use Model Reference
vii
viii
Contents
Verification
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Processor-in-the-Loop Overview
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
Profiling Execution By Subsystems . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . .
Exporting Filter Coefficients from FDATool
About FDATool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preparing to Export Filter Coefficients to Code
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
Choosing the Export Data Type . . . . . . . . . . . . . . . . . . . . . .
Exporting Filter Coefficients to Your Code Composer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exporting Filter Coefficients from FDATool to the CCS IDE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reviewing ANSI C Header File Contents . . . . . . . . . . . . . .
Preventing Memory Corruption When You Export
Coefficients to Processor Memory
Allocating Sufficient or Extra Memory for Filter
Example: Using the Exported Header File to Allocate Extra
Replacing Existing Coefficients in Memory with Updated
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example: Changing Filter Coefficients Stored on Your
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Function Reference
Operations on Objects for CCS IDE . . . . . . . . . . . . . . . . . .
Operations on Objects for RTDX . . . . . . . . . . . . . . . . . . . .
Functions — Alphabetical List
Block Reference
C280x/C28x3x DSP Chip Support (ccslinklib_c280x) . . .
C281x DSP Chip Support (ccslinklib_c281x) . . . . . . . . . .
C5xxx DSP Chip Support (ccslinklib_c5xxx) . . . . . . . . . .
C6xxx DSP Chip Support (ccslinklib_c6xxx) . . . . . . . . . .
ix
x
Contents
Core Support (ccslinklib_core) . . . . . . . . . . . . . . . . . . . . . .
Target Preferences (ccslinklib_tgtpref) . . . . . . . . . . . . . .
Blocks — Alphabetical List
Embedded IDE Link CC Configuration
Parameters
Profile by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Interrupt overrun notification method
Interrupt overrun notification function
. . . . . . . . . . . . . . . . . . . . . . .
Embedded IDE Link CC Overview . . . . . . . . . . . . . . . . . . .
Export IDE link handle to base workspace
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
Number of profiling samples to collect
Inline run-time library functions
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Maximum time allowed to build project (s) . . . . . . . . . . . . .
Maximum time to complete IDE operations (s) . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Supported Hardware
Supported Platforms for Embedded IDE Link CC
Supported Hardware and Simulators
Product Features Supported by Each Processor or
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
Supported Versions of Code Composer Studio . . . . . . . .
Reported Limitations and Tips
Reported Issues Using Embedded IDE Link CC
Demonstration Programs Do Not Run Properly Without
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Issues Using USB-Based RTDX Emulators and the C6416
Error Accessing type Property of ticcs Object Having Size
Changing the represent Property of an Object
Changing Values of Local Variables Does Not Take
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Different Read Techniques Appear to Return Different
Using Function Call with C28x Processors
RTDX Demos Do Not Run on C6727 PADK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Code Composer Studio Cannot Find a File After You Halt a
Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C54x XPC Register Can Be Modified Only Through the PC
Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Working with More Than One Installed Version of Code
Composer Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing CCS Versions During a MATLAB Session
MATLAB Hangs When Code Composer Studio Cannot Find a Board
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xi
xii
Contents
Using Mapped Drives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index
Getting Started
• “Product Overview” on page 1-2
• “Configuration Information” on page 1-6
• “Requirements for Embedded IDE Link CC Software” on page 1-10
1
1
Getting Started
1-2
Product Overview
In this section...
“Components of Embedded IDE Link CC Software” on page 1-3
“Automation Interface” on page 1-3
“Project Generator” on page 1-4
“Product Features Supported for Each Processor Family” on page 1-5
Embedded IDE Link™ CC software enables you to use MATLAB ® functions to communicate with Code Composer Studio™ software and with information stored in memory and registers on a processor. With the ticcs objects, you can transfer information to and from Code Composer Studio software and with the embedded objects you get information about data and functions stored in your signal processor memory and registers, as well as information about functions in your project.
Embedded IDE Link CC lets you build, test, and verify automatically generated code using MATLAB, Simulink ® , Real-Time Workshop ® , and the
Code Composer Studio integrated development environment. Embedded IDE
Link CC makes it easy to verify code executing within the Code Composer
Studio software environment using a model in Simulink software. This processor-in-the-loop testing environment uses code automatically generated from Simulink models by Real-Time Workshop ® Embedded Coder™ software.
A wide range of Texas Instruments DSPs are supported:
• TI’s C2000™
• TI’s C5000™
• TI’s C6000™
With Embedded IDE Link CC , you can use MATLAB software and Simulink software to interactively analyze, profile and debug processor-specific code execution behavior within CCS. In this way, Embedded IDE Link CC automates deployment of the complete embedded software application and makes it easy for you to assess possible differences between the model simulation and processor code execution results.
Product Overview
Embedded IDE Link CC consists of these components:
• Project Generator—generate C code from Simulink models
• Automation Interface—use functions in the MATLAB command window to access and manipulate data and files in the IDE and on the processor
• Verification—verify how your programs run on your processor
With Embedded IDE Link CC, you create objects that connect MATLAB software to Code Composer Studio software. For information about using
objects, refer to “Requirements for Embedded IDE Link CC Software” on page 1-10.
Note Embedded IDE Link CC uses objects. You work with them the way you use all MATLAB objects. You can set and get their properties, and use their methods to change them or manipulate them and the IDE to which they refer.
Components of Embedded IDE Link CC Software
The next sections describe briefly the components of Embedded IDE Link
CC software.
Automation Interface
The automation interface component is a collection of methods that use the
Code Composer Studio API to communicate between MATLAB software and
Code Composer Studio. With the interface, you can do the following:
• Automate complex tasks in the development environment by writing
MATLAB software scripts to communicate with the IDE, or debug and analyze interactively in a live MATLAB software session.
• Automate debugging by executing commands from the powerful Code
Composer Studio software command language.
• Exchange data between MATLAB software and the processor running in Code Composer Studio software.
• Set breakpoints, step through code, set parameters and retrieve profiling reports.
1-3
1
Getting Started
• Automate project creation, including adding source files, include paths, and preprocessor defines.
• Configure batch building of projects.
• Debug projects and code.
• Execute API Library commands.
The automation interface provides an application program interface (API) between MATLAB software and Code Composer Studio. Using the API, you can create new projects, open projects, transfer data to and from memory on the processor, add files to projects, and debug your code.
Project Generator
The Project Generator component is a collection of methods that use the Code
Composer Studio API to create projects in Code Composer Studio and generate code with Real-Time Workshop. With the interface, you can do the following:
• Automated project-based build process
Automatically create and build projects for code generated by Real-Time
Workshop or Real-Time Workshop Embedded Coder.
• Customize code generation
Use Embedded IDE Link CC with any Real-Time Workshop system target file (STF) to generate processor-specific and optimized code.
• Customize the build process
• Automate code download and debugging
Rapidly and effortlessly debug generated code in the Code Composer
Studio software debugger, using either the instruction set simulator or real hardware.
• Create and build CCS projects from Simulink software models. Project
Generator uses Real-Time Workshop software or Real-Time Workshop
Embedded Coder software to build projects that work with C2000™ software, C5000™ software, and C6000™ software processors.
1-4
Product Overview
• Highly customized code generation with the system target file ccslink_ert.tlc
and ccslink_grt.tlc
that enable you to use the
Configuration Parameters in your model to customize your generated code.
• Automate the process of building and downloading your code to the processor, and running the process on your hardware.
Verification
Verifying your processes and algorithms is an essential part of developing applications. The components of Embedded IDE Link CC combine to provide the following verification tools for you to apply as you develop your code:
Processor in the Loop Cosimulation
Use cosimulation techniques to verify generated code running in an instruction set simulator or real processor environment.
Execution Profiling
Gather execution profiling timing measurements with Code Composer
Studio instruction set simulator to establish the timing requirements of your algorithm.
Product Features Supported for Each Processor
Family
Within the collection of processors that Embedded IDE Link CC supports, some subcomponents of the product do not apply. For the complete list of which features work with each processor or family, such as the C24xx or
C67xx, refer to “Product Features Supported by Each Processor or Family” on page A-4.
1-5
1
Getting Started
1-6
Configuration Information
To determine whether Embedded IDE Link CC is installed on your system, type this command at the MATLAB software prompt.
ver
When you enter this command, MATLAB software displays a list of the installed products. Look for a line similar to the following:
Embedded IDE Link CC Version 3.x
(Release Specifier)
To get a bit more information about the software, such as the functions provided and where to find demos and help, enter the following command at the prompt: help ticcs
Embedded IDE Link CC
Version 3.1 (R2007b Prerelease) DD-MMM-YYYY
==============================
Automation Interface Component
==============================
------------------
Debug Subcomponent
-----------------ticcs ccsboardinfo
- Create TICCS object(s).
- Query the CCS Setup utility for board info.
Methods for TICCS Class ccsdebug/add ccsdebug/activate ccsdebug/address ccsdebug/animate ccsdebug/build ccsdebug/cd ccsdebug/dir ccsdebug/disp
- Place a file in the current CCS project.
- Cause the specified file to become active in CCS.
- Return the address value of specified processor symbol.
- Run application until breakpoint is reached.
- Build a CCS project.
- Change current working directory.
- List CCS working directory.
- Display properties of a TICCS object.
Configuration Information ccsdebug/display ccsdebug/halt ccsdebug/info ccsdebug/insert
- Display properties of a TICCS object.
- Immediately terminate execution of the processor.
- Return information about the processor.
- Add a debug point into CCS.
ccsdebug/isreadable - Check if the specified memory block can be read.
ccsdebug/isrtdxcapable - Check if the processor has RTDX capability.
ccsdebug/isrunning ccsdebug/isvisible
- Check if the processor is executing.
- Check if the CCS window is open.
ccsdebug/iswritable - Check if the specified memory block can be written.
ccsdebug/list - Return variable, function, data type, or project information.
ccsdebug/load ccsdebug/new
- Transfer a program file or a GEL file to the processor.
- Create an empty file in CCS.
ccsdebug/open ccsdebug/profile ccsdebug/read ccsdebug/regread
- Load a file into the CCS IDE.
- Obtain DSP/BIOS statistics on current program execution.
- Retrieve a block of data from the processor's memory.
- Return the value in the specified processor register.
ccsdebug/regwrite ccsdebug/reload ccsdebug/remove ccsdebug/reset ccsdebug/restart ccsdebug/run ccsdebug/save ccsdebug/symbol ccsdebug/visible ccsdebug/write
- Place passed value into the specified processor register.
- Repeat load of the most recently loaded program file.
- Remove a file from the active CCS project.
- Remove a debug point from CCS.
- Initiate software reset of board.
- Restore the processor to the program entry point.
- Initiate execution of processor.
- Save CCS file to disk.
- Read the processor's entire symbol table.
- Set the visibility state of the CCS window.
- Write a block of data into the processor's memory.
===========
Demos
===========
In MATLAB, go to
Start -> Links and processors -> Embedded IDE Link CC -> Demos
Supported Code Composer Studio(tm) Version: 3.3
For questions, go to Embedded IDE Link CC FAQ.
See also ccsdemos
1-7
1
Getting Started
If you do not see the listing, or MATLAB software does not recognize the command, you need to install Embedded IDE Link CC. Without the software, you cannot use MATLAB software with the objects to communicate with CCS.
Note For up-to-date information about system requirements, refer to the
Embedded IDE Link CC system requirements page, available in the products area at the MathWorks Web site ( http://www.mathworks.com
).
Verifying Your Code Composer Studio Installation
To verify that CCS is installed on your machine and has at least one board configured, enter ccsboardinfo at the MATLAB software command line. With CCS installed and configured,
MATLAB software returns information about the boards that CCS recognizes on your machine, in a form similar to the following listing.
Board Board
Num Name
Proc Processor Processor
Num Name Type
------------------------------------------------
1 C6xxx Simulator (Texas Instrum .0
6701 TMS320C6701
0 C6x13 DSK (Texas Instruments) 0 CPU TMS320C6x1x
If MATLAB software does not return information about any boards, open your CCS installation and use the Setup Utility in CCS to configure at least one board.
As a final test, start CCS to ensure that it starts up successfully. For
Embedded IDE Link CC to operate with CCS, the CCS IDE must be able to run on its own.
Embedded IDE Link CC uses objects to create:
• Connections to the Code Composer Studio Integrated Development
Environment (CCS IDE)
1-8
Configuration Information
• Connections to the RTDX™ (RTDX) interface. This object is a subset of the object that refers to the CCS IDE.
Concepts to know about the objects in this toolbox are covered in these sections:
• Properties and Property Values
• Overloaded Functions for Links
Refer to MATLAB Classes and Objects in your MATLAB documentation for more details on object-oriented programming in MATLAB software.
Many of the objects use COM server features to create handles for working with the objects. Refer to your MATLAB documentation for more information about COM as used by MATLAB software.
1-9
1
Getting Started
Requirements for Embedded IDE Link CC Software
For detailed information about the software and hardware required to use Embedded IDE Link CC software, refer to the Embedded IDE Link
CC system requirements area for the product on the MathWorks Web site— http://www.mathworks.com
.
For information about the hardware that the software supports, refer to the
Embedded IDE Link CC supported hardware area for the product on the
MathWorks Web site— http://www.mathworks.com
.
1-10
2
Automation Interface
• “Getting Started with Automation Interface” on page 2-2
• “Getting Started with RTDX” on page 2-21
• “Constructing ticcs Objects” on page 2-46
• “ticcs Properties and Property Values” on page 2-48
• “Overloaded Functions for ticcs Objects” on page 2-49
• “ticcs Object Properties” on page 2-50
• “Managing Custom Data Types with the Data Type Manager” on page 2-58
2
Automation Interface
Getting Started with Automation Interface
In this section...
“Introducing the Automation Interface Tutorial” on page 2-2
“Selecting Your Processor” on page 2-7
“Creating and Querying Objects for CCS IDE” on page 2-8
“Loading Files into CCS” on page 2-10
“Working with Projects and Data” on page 2-13
“Closing the Links or Cleaning Up CCS IDE” on page 2-19
Introducing the Automation Interface Tutorial
Embedded IDE Link CC provides a connection between MATLAB software and a processor in CCS. You can use objects to control and manipulate a signal processing application using the computational power of MATLAB software. This approach can help you debug and develop your application.
Another possible use for automation is creating MATLAB scripts that verify and test algorithms that run in their final implementation on your production processor.
Before using the functions available with the objects, you must select a processor to be your processor because any object you create is specific to a designated processor and a designated instance of CCS IDE. Selecting a processor is necessary for multiprocessor boards or multiple board configurations of CCS.
When you have one board with a single processor, the object defaults to the existing processor. For the objects, the simulator counts as a board; if you have both a board and a simulator that CCS recognizes, you must specify the processor explicitly.
To get you started using objects for CCS IDE software, Embedded IDE Link
CC includes a tutorial that introduces you to working with data and files. As you work through this tutorial, you perform the following tasks that step you through creating and using objects for CCS IDE:
2-2
Getting Started with Automation Interface
1
Select your processor.
2
Create and query objects to CCS IDE.
3
Use MATLAB software to load files into CCS IDE.
4
Work with your CCS IDE project from MATLAB software.
5
Close the connections you opened to CCS IDE.
The tutorial provides a working process (a workflow) for using Embedded IDE
Link CC and your signal processing programs to develop programs for a range of Texas Instruments™ processors.
During this tutorial, you load and run a digital signal processing application on a processor you select. The tutorial demonstrates both writing to memory
and reading from memory in the “Working with Links and Data” portion of
the tutorial.
You can use the read and write methods, as described in this tutorial, to read and write data to and from your processor.
The tutorial covers the object methods and functions for Embedded IDE Link
CC. The functions listed in the first table apply to CCS IDE independent of the objects — you do not need an object to use these functions. The methods listed in the second and third table requires a ticcs object that you use in the method syntax:
Functions for Working With Embedded IDE Link CC
The following functions do not require a ticcs object as an input argument:
Function ccsboardinfo
Description
Return information about the boards that CCS
IDE recognizes as installed on your PC.
2-3
2
Automation Interface
Function clear ticcs
Description
Remove a specific object to CCS IDE or remove all existing objects.
Construct an object to communicate with
CCS IDE. When you construct the object you specify the processor board and processor.
Methods for Working with ticcs Objects in Embedded IDE Link
CC software
The methods in the following table require a ticcs object as an input argument:
Method address display halt info isrtdxcapable isrunning read restart
Description
Return the address and page for an entry in the symbol table in CCS
IDE.
Display the properties of an object to
CCS IDE and RTDX.
Terminate execution of a process running on the processor.
Return information about the processor or information about open
RTDX channels.
Test whether your processor supports RTDX communications.
Test whether the processor is executing a process.
Retrieve data from memory on the processor.
Restore the program counter (PC) to the entry point for the current program.
2-4
Getting Started with Automation Interface
Method run visible write
Description
Execute the program loaded on the processor.
Set whether CCS IDE window is visible on the desktop while CCS
IDE is running.
Write data to memory on the processor.
Embedded IDE Link CC Methods for Embedded Objects
The methods in the following table enable you to manipulate programs and memory with an embedded object:
Method cast list read write
Description
Create a new object with a different datatype (the represent property) from an object in Embedded IDE
Link CC. Demonstrated with a numeric object.
Return various information listings from Code Composer Studio software.
Read the information at the location accessed by an object into MATLAB software as numeric values.
Demonstrated with a numeric, string, structure, and enumerated objects.
Write to the location referenced by an object. Demonstrated with numeric, string, structure, and enumerated objects.
2-5
2
Automation Interface
Running Code Composer Studio Software on Your Desktop
— Visibility
When you create a ticcs object , Embedded IDE Link CC starts CCS in the background.
When CCS IDE is running in the background, it does not appear on your desktop, in your task bar, or on the Applications page in the Task Manager.
It does appear as a process, cc_app.exe
, on the Processes tab in Microsoft ®
Windows Task Manager.
You can make the CCS IDE visible with the function visible
. The function isvisible returns the status of the IDE—whether it is visible on your desktop. To close the IDE when it is not visible and MATLAB software is not running, use the Processes tab in Microsoft Windows Task Manager and look for cc_app.exe
.
If a link to CCS IDE exists when you close CCS, the application does not close.
Microsoft Windows software moves it to the background (it becomes invisible).
Only after you clear all links to CCS IDE, or close MATLAB software, does closing CCS IDE unload the application. You can see if CCS IDE is running in the background by checking in the Microsoft Windows Task Manager. When
CCS IDE is running, the entry cc_app.exe
appears in the Image Name list on the Processes tab.
When you close MATLAB software while CCS IDE is not visible, MATLAB software closes CCS if it started the IDE. This happens because the operating system treats CCS as a subprocess in MATLAB software when CCS is not visible. Having MATLAB software close the invisible IDE when you close
MATLAB software prevents CCS from remaining open. You do not need to close it using Microsoft Windows Task Manager.
If CCS IDE is not visible when you open MATLAB software, closing MATLAB software leaves CCS IDE running in an invisible state. MATLAB software leaves CCS IDE in the visibility and operating state in which it finds it.
Running the Interactive Tutorial
You have the option of running this tutorial from the MATLAB software command line or entering the functions as described in the following tutorial sections.
2-6
Getting Started with Automation Interface
To run the tutorial in MATLAB software, click run ccstutorial
. This command opens the tutorial in an interactive mode where the tutorial program provides prompts and text descriptions to which you respond to move to the next portion of the lesson. The interactive tutorial covers the same information provided by the following tutorial sections. You can view the tutorial M-file used here by clicking ccstutorial.m
.
Selecting Your Processor
Links for CCS IDE provides two tools for selecting a board and processor in multiprocessor configurations. One is a command line tool called ccsboardinfo which prints a list of the available boards and processors.
So that you can use this function in a script, ccsboardinfo can return a MATLAB software structure that you use when you want your script to select a board without your help.
Note The board and processor you select is used throughout the tutorial.
1
To see a list of the boards and processors installed on your PC, enter the following command at the MATLAB software prompt: ccsboardinfo
MATLAB software returns a list that shows you all the boards and processors that CCS IDE recognizes as installed on your system.
2
To use the Selection Utility, boardprocsel
, to select a board, enter
[boardnum,procnum] = boardprocsel
When you use boardprocsel
, you see a dialog box similar to the following.
Note that some entries vary depending on your board set.
2-7
2
Automation Interface
2-8
3
Select a board name and processor name from the lists.
You are selecting a board and processor number that identifies your particular processor. When you create the object for CCS IDE in the next section of this tutorial, the selected board and processor become the processor of the object.
4
Click Done to accept your board and processor selection and close the dialog box.
boardnum and procnum now represent the Board name and Processor
name you selected — boardnum
= 1 and procnum
= 0
Creating and Querying Objects for CCS IDE
In this tutorial section, you create the connection between MATLAB software and CCS IDE. This connection, or object, is a MATLAB software object that you save as variable cc
.
You use function ticcs to create objects. When you create objects, ticcs input arguments let you define other object property values, such as the global timeout. Refer to the ticcs reference documentation for more information on these input arguments.
Use the generated object cc to direct actions to your processor. In the following tasks, cc appears in all function syntax that interact with CCS
IDE and the processor:
Getting Started with Automation Interface
1
Create an object that refers to your selected board and processor. Enter the following command at the prompt.
cc=ticcs('boardnum',boardnum,'procnum',procnum)
If you were to watch closely, and your machine is not too fast, you see Code
Composer Studio software appear briefly when you call ticcs
. If CCS
IDE was not running before you created the new object, CCS starts and runs in the background.
2
Enter visible(cc,1) to force CCS IDE to be visible on your desktop.
Usually, you need to interact with Code Composer Studio software while you develop your application. The first function in this tutorial, visible
, controls the state of CCS on your desktop.
visible accepts Boolean inputs that make CCS either visible on your desktop (input to visible
= 1) or invisible on your desktop (input to visible
= 0). For this tutorial, use visible to set the CCS IDE visibility to
1
.
3
Next, enter display(cc) at the prompt to see the status information.
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
Embedded IDE Link CC provides three methods to read the status of a board and processor:
• info
— Return a structure of testable board conditions.
• display
— Print information about the processor.
• isrunning
— Return the state (running or halted) of the processor.
• isrtdxcapable
— Return whether the hardware supports RTDX.
2-9
2
Automation Interface
4
Type linkinfo = info(cc)
.
The cc link status information provides information about the hardware as follows: linkinfo = boardname: 'C6711 Device Simulator' procname: 'CPU_1' isbigendian: 0 family: 320 subfamily: 103 revfamily: 11 processortype: 'simulator' revsilicon: 0 timeout: 10
5
Check whether the processor is running by entering runstatus = isrunning(cc)
MATLAB software responds, indicating that the processor is stopped, as follows: runstatus =
0
6
At last, verify that the processor supports RTDX communications by entering usesrtdx = isrtdxcapable(cc) usesrtdx =
1
Loading Files into CCS
You have established the connection to a processor and board. Using three methods you learned about the hardware, whether it was running, its type, and whether CCS IDE was visible. Next, the processor needs something to do.
2-10
Getting Started with Automation Interface
In this part of the tutorial, you load the executable code for the processor CPU in CCS IDE. Embedded IDE Link CC includes a CCS project file. Through the next tasks in the tutorial, you locate the tutorial project file and load it into
CCS IDE. The open method directs CCS to load a project file or workspace file.
Note CCS has workspace and workspace files that are different from the
MATLAB workspace files and workspace. Remember to monitor both workspaces.
After you have executable code running on your processor, you can exchange data blocks with it. Exchanging data is the purpose of the objects provided by
Embedded IDE Link CC software.
1
To load the appropriate project file to your processor, enter the following command at the MATLAB software prompt.
getdemoproject is a specialized function for loading Embedded IDE Link CC demo files. It is not supported as a standard Embedded IDE Link CC function.
demopjt= getDemoProject(cc,'ccstutorial') demopjt = isLibProj: 0
TemplateProject: 'C:\Temp\LinkForCCSDemos_v3.2\template\c6x\c67x.pjt'
DemoDir: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c67x'
ProjectFile: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c67x\ccstut.pjt'
ProgramFile: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c67x\ccstut.out'
SrcFile: {2x1 cell}
LibFile: ''
CmdFile: {'$matlabroot\matlab\toolbox\ccslink\ccsdemos\shared\c6x\c6x.cmd'}
HdrFile: ''
BuildOpts: [1x1 struct]
ProjectAction: 'rebuildProg'
RebuildDemo: 1 demopjt.ProjectFile
ans =
2-11
2
Automation Interface
C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c67x\ccstut.pjt
demoPjt.DemoDir
ans =
C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c67x
Your paths may be different if you use a different processor. Note where the software stored the demo files on your machine. In general, Embedded
IDE Link CC software stores the demo project files in
LinkforCCS_vproduct_version
Embedded IDE Link CC creates this directory in a location where you have write permission. There are two locations where Embedded IDE Link CC software tries to create the demo directory, in the following order: a
In a temporary directory on your C drive, such as
C:\temp\
.
b
If Embedded IDE Link CC software cannot use the temp directory, you see a dialog box that asks you to select a location to store the demos.
2
Enter the following command at the MATLAB command prompt to build the processor executable file in CCS IDE.
build(cc,'all',20)
You may get an error related to one or more missing
.lib
files. If you installed CCS IDE in a directory other than the default installation directory, browse in your installation directory to find the missing file or files. Refer to the path in the error message as an indicator of where to find the missing files.
3
Enter load(cc,'projectname.out') to load the processor execution file, where projectname is the tutorial you chose, such as ccstut_67x
.
You have a loaded program file and associated symbol table to the IDE and processor.
2-12
Getting Started with Automation Interface
4
To determine the memory address of the global symbol ddat
, enter the following command at the prompt: ddata = address(cc,'ddat') ddata =
1.0e+009 *
2.1475
0
Your values for ddata may be different depending on your processor.
Note The symbol table is available after you load the program file into the processor, not after you build a program file.
5
To convert ddata to a hexadecimal string that contains the memory address and memory page, enter the following command at the prompt: dec2hex(ddata)
MATLAB software displays the following response, where the memory page is
0x00000000 and the address is
0x80000010
.
ans =
80000010
00000000
Working with Projects and Data
After you load the processor code, you can use Embedded IDE Link CC functions to examine and modify data values in the processor.
When you look at the source file listing in the CCS IDE Project view window, there should be a file named ccstut.c
. Embedded IDE Link CC ships this file with the tutorial and includes it in the project.
2-13
2
Automation Interface ccstut.c
has two global data arrays — ddat and idat
— that you declare and initialize in the source code. You use the functions read and write to access these processor memory arrays from MATLAB software.
Embedded IDE Link CC provides three functions to control processor execution — run
, halt
, and restart
.
1
To demonstrate these commands, use the following function to add a breakpoint to line 64 of cctut.c
.
insert(cc,'cctut.c',64)
Line 64 is printf("Embedded IDE Link CC: Tutorial - Memory Modified by Matlab!\n");
For information about adding breakpoints to a file, refer to insert in the online Help system. Then proceed with the tutorial.
2
To demonstrate the new functions, try the following functions.
halt(cc) restart(cc)
% Halt the processor.
% Reset the PC to start of program.
run(cc,'runtohalt',30); % Wait for program execution to stop at
% breakpoint (timeout = 30 seconds).
When you switch to viewing CCS IDE, you see that your program stopped at the breakpoint you inserted on line 64, and the program printed the following messages in the CCS IDE Stdout tab. Nothing prints in the
MATLAB command window:
Embedded IDE Link CC: Tutorial - Initialized Memory
Double Data array = 16.3 -2.13 5.1 11.8
Integer Data array = -1-508-647-7000 (call me anytime!)
3
Before you restart your program (currently stopped at line 64), change some values in memory. Perform one of the following procedures based on your processor.
C5xxx processor family — Enter the following functions to demonstrate the read and write functions.
2-14
Getting Started with Automation Interface a
Enter ddatv = read(cc,address(cc,'ddat'),'double',4)
.
MATLAB software responds with ddatv =
16.3000
-2.1300
5.1000
11.8000
b
Enter idatv = read(cc,address(cc,'idat'),'int16',4)
.
Now MATLAB software responds idatv =
-1 508 647 7000
If you used 8-bit integers ( int8
), the returned values would be incorrect.
idatv=read(cc,address(cc,'idat'),'int8',4) idatv = c
1 0 -4 1
You can change the values stored in ddat by entering write(cc,address(cc,'ddat'),double([pi 12.3 exp(-1)...
sin(pi/4)]))
The double argument directs MATLAB software to write the values to the processor as double-precision data.
d
To change idat
, enter write(cc,address(cc,'idat'),int32([1:4])) e
Here you write the data to the processor as 32-bit integers (convenient for representing phone numbers, for example).
Start the program running again by entering the following command: run(cc,'runtohalt',30);
2-15
2
Automation Interface f
The
Stdout tab in CCS IDE reveals that ddat and idat contain new values. Next, read those new values back into MATLAB software.
Enter ddatv = read(cc,address(cc,'ddat'),'double',4)
.
ddatv =
3.1416 12.3000 0.3679 0.7071
ddatv contains the values you wrote in step c.
g
Verify that the change to idatv occurred by entering the following command at the prompt: idatv = read(cc,address(cc,'idat'),'int16',4)
MATLAB software returns the new values for idatv
.
idatv = h
1 2 3 4
Use restart to reset the program counter for your program to the beginning. Enter the following command at the prompt: restart(cc);
C6xxx processor family — Enter the following commands to demonstrate the read and write functions.
a
Enter ddatv = read(cc,address(cc,'ddat'),'double',4)
.
MATLAB software responds with ddatv =
16.3000
-2.1300
5.1000
11.8000
b
Enter idatv = read(cc,address(cc,'idat'),'int16',4)
.
MATLAB software responds idatv =
2-16
Getting Started with Automation Interface
-1 508 647 7000
If you used 8-bit integers ( int8
), the returned values would be incorrect.
idatv=read(cc,address(cc,'idat'),'int8',4) idatv = c
1 0 -4 1
Change the values stored in ddat by entering write(cc,address(cc,'ddat'),double([pi 12.3 exp(-1)...
sin(pi/4)]))
The double argument directs MATLAB software to write the values to the processor as double-precision data.
d
To change idat
, enter the following command: write(cc,address(cc,'idat'),int32([1:4])) e
In this command, you write the data to the processor as 32-bit integers
(convenient for representing phone numbers, for example).
Next, start the program running again by entering the following command: run(cc,'runtohalt',30); f
The Stdout tab in CCS IDE reveals that ddat and idat contain new values. Read those new values back into MATLAB software.
Enter ddatv = read(cc,address(cc,'ddat'),'double',4)
.
ddatv =
3.1416 12.3000 0.3679 0.7071
g
Verify that ddatv contains the values you wrote in step c.
Verify that the change to idatv occurred by entering the following command: idatv = read(cc,address(cc,'idat'),'int32',4)
2-17
2
Automation Interface
MATLAB software returns the new values for idatv
.
idatv = h
1 2 3 4
Use restart to reset the program counter for your program to the beginning. Enter the following command at the prompt: restart(cc);
4
Embedded IDE Link CC offers more functions for reading and writing data to your processor. These functions let you read and write data to the processor registers: regread and regwrite
. They let you change variable values on the processor in real time. The functions behave slightly differently depending on your processor. Select one of the following procedures to demonstrate regread and regwrite for your processor.
C5xxx processor family — Most registers are memory-mapped and available using read and write
. However, the PC register is not memory mapped. To access this register, use the special functions — regread and regwrite
. The following commands demonstrate how to use these functions to read and write to the PC register.
a
To read the value stored in register PC, enter the following command at the prompt to indicate to MATLAB software the data type to read.
The input string binary indicates that the PC register contains a value stored as an unsigned binary integer.
cc.regread('PC','binary')
MATLAB software displays ans =
33824 b
To write a new value to the PC register, enter the following command.
This time, the binary input argument tells MATLAB software to write the value to the processor as an unsigned binary integer. Notice that you used hex2dec to convert the hexadecimal string to decimal.
cc.regwrite('PC',hex2dec('100'),'binary')
2-18
Getting Started with Automation Interface c
Verify that the PC register contains the value you wrote.
cc.regread('PC','binary')
C6xxx processor family — regread and regwrite let you access the processor registers directly. Enter the following commands to get data into and out of the A0 and B2 registers on your processor.
a
To retrieve the value in register A0 and store it in a variable in your
MATLAB workspace. Enter the following command: treg = cc.regread('A0','2scomp'); treg contains the two’s complement representation of the value in A0.
b
To retrieve the value in register B2 as an unsigned binary integer, enter the following command: c cc.regread('B2','binary');
Next, enter the following command to use regwrite to put the value in treg into register A2.
cc.regwrite('A2',treg,'2scomp');
CCS IDE reports that A0, B2, and A2 have the values you expect. Select
View > CPU Registers > Core Registers from the CCS IDE menu bar to list the processor registers.
Closing the Links or Cleaning Up CCS IDE
Objects that you create in Embedded IDE Link CC software have COM handles to CCS. Until you delete these handles, the CCS process ( cc_app.exe
in the Microsoft Windows Task Manager) remains in memory. Closing
MATLAB software removes these COM handles, but there may be times when you want to delete the handles without closing the application.
Use clear to remove objects from your MATLAB workspace and to delete handles they contain.
clear all deletes everything in your workspace. To retain your MATLAB software data while deleting objects and handles, use clear objname
. This applies both to ticcs objects your create with ticcs and other object you create with createobj
. To remove the objects created
2-19
2
Automation Interface during the tutorial, the tutorial program executes the following command at the prompt: clear cvar cfield uintcvar
This tutorial also closes the project in CCS with the following command: close(cc,projfile,'project')
To delete your link to CCS, enter clear cc at the prompt.
Your development tutorial using Code Composer Studio IDE is done.
During the tutorial you
1
Selected your processor.
2
Created and queried links to CCS IDE to get information about the link and the processor.
3
Used MATLAB software to load files into CCS IDE, and used MATLAB software to run that file.
4
Worked with your CCS IDE project from MATLAB software by reading and writing data to your processor, and changing the data from MATLAB software.
5
Created and used the embedded objects to manipulate data in a C-like way.
6
Closed the links you opened to CCS IDE.
2-20
Getting Started with RTDX™
Getting Started with RTDX
In this section...
“Introducing the Tutorial for Using RTDX” on page 2-22
“Creating the ticcs Objects” on page 2-27
“Configuring Communications Channels” on page 2-30
“Running the Application” on page 2-32
“Closing the Connections and Channels or Cleaning Up” on page 2-39
“Listing the Functions in Embedded IDE Link CC software” on page 2-43
Support for using RTDX with C5000 and C6000 processors will be removed in a future release.
Embedded IDE Link CC and the objects for CCS IDE and RTDX speed and enhance your ability to develop and deploy digital signal processing systems on Texas Instruments processors. By using MATLAB software and Embedded
IDE Link CC, your MathWorks™ tools, CCS IDE and RTDX work together to help you test and analyze your processing algorithms in your MATLAB workspace.
In contrast to CCS IDE, using links for RTDX lets you interact with your process in real time while it’s running on the processor. Across the connection between MATLAB software and CCS, you can:
• Send and retrieve data from memory on the processor
• Change the operating characteristics of the program
• Make changes to algorithms as needed without stopping the program or setting breakpoints in the code
Enabling real-time interaction lets you more easily see your process or algorithm in action, the results as they develop, and the way the process runs.
This tutorial assumes you have Texas Instruments’ Code Composer Studio™ software and at least one DSP development board. You can use the
2-21
2
Automation Interface hardware simulator in CCS IDE to run this tutorial. The tutorial uses the
TMS320C6711 DSK as the board, with the C6711 DSP as the processor.
After you complete the tutorial, either in the demonstration form or by entering the functions along with this text, you are ready to begin using
RTDX with your applications and hardware.
Introducing the Tutorial for Using RTDX
Digital signal processing development efforts begin with an idea for processing data; an application area, such as audio or wireless communications or multimedia computing; and a platform or hardware to host the signal processing. Usually these processing efforts involve applying strategies like signal filtering, compression, and transformation to change data content; or isolate features in data; or transfer data from one form to another or one place to another.
Developers create algorithms they need to accomplish the desired result. After they have the algorithms, they use models and DSP processor development tools to test their algorithms, to determine whether the processing achieves the goal, and whether the processing works on the proposed platform.
Embedded IDE Link CC and the links for RTDX and CCS IDE ease the job of taking algorithms from the model realm to the real world of the processor on which the algorithm runs.
RTDX and links for CCS IDE provide a communications pathway to manipulate data and processing programs on your processor. RTDX offers real-time data exchange in two directions between MATLAB software and your processor process. Data you send to the processor has little effect on the running process and plotting the data you retrieve from the processor lets you see how your algorithms are performing in real time.
To introduce the techniques and tools available in Embedded IDE Link CC for using RTDX, the following procedures use many of the methods in the link software to configure the processor, open and enable channels, send data to the processor, and clean up after you finish your testing. Among the functions covered are:
2-22
Getting Started with RTDX™
Functions From Objects for CCS IDE
Function ticcs cd open run
Description
Create connections to CCS IDE and
RTDX.
Change your CCS IDE working directory from MATLAB software.
Load program files in CCS IDE.
Run processes on the processor.
Functions From the RTDX Class
Function close configure disable display enable isenabled
Description
Close the RTDX links between
MATLAB software and your processor.
Determine how many channel buffers to use and set the size of each buffer.
Disable the RTDX links before you close them.
Return the properties of an object in formatted layout. When you omit the closing semicolon on a function,
(a built-in function) provides disp the default display for the results of the operation.
Enable open channels so you can use them to send and retrieve data from your processor.
Determine whether channels are enabled for RTDX communications.
2-23
2
Automation Interface
Function isreadable iswritable msgcount open readmat readmsg writemsg
Description
Determine whether MATLAB software can read the specified memory location.
Determine whether MATLAB software can write to the processor.
Determine how many messages are waiting in a channel queue.
Open channels in RTDX.
Read data matrices from the processor into MATLAB software as an array.
Read one or more messages from a channel.
Write messages to the processor over a channel.
This tutorial provides the following workflow to show you how to use many of the functions in the links. By performing the steps provided, you work through many of the operations yourself. The tutorial follows the general task flow for developing digital signal processing programs through testing with the links for RTDX.
Within this set of tasks, numbers 1, 2, and 4 are fundamental to all development projects. Whenever you work with MATLAB software and objects for RTDX, you perform the functions and tasks outlined and presented in this tutorial. The differences lie in Task 3. Task 3 is the most important for using Embedded IDE Link CC to develop your processing system.
1
Create an RTDX link to your desired processor and load the program to
the processor.
All projects begin this way. Without the links you cannot load your executable to the processor.
2
Configure channels to communicate with the processor.
2-24
Getting Started with RTDX™
Creating the links in Task 1 did not open communications to the processor.
With the links in place, you open as many channels as you need to support the data transfer for your development work. This task includes configuring channel buffers to hold data when the data rate from the processor exceeds the rate at which MATLAB software can capture the data.
3
Run your application on the processor. You use MATLAB software to
investigate the results of your running process.
4
Close the links to the processor and clean up the links and associated
debris left over from your work.
Closing channels and cleaning up the memory and links you created ensures that CCS IDE, RTDX, and Embedded IDE Link CC are ready for the next time you start development on a project.
This tutorial uses an executable program named rtdxtutorial_6xevm.out
as your application. When you use the RTDX and CCS IDE links to develop your own applications, replace rtdxtutorial_6xevm.out
in Task 3 with the filename and path to your digital signal processing application.
You can view the tutorial M-file used here by clicking rtdxtutorial
. To run this tutorial in MATLAB software, click run rtdxtutorial
.
2-25
2
Automation Interface
Note To be able to open and enable channels over a link to RTDX, the program loaded on your processor must include functions or code that define the channels.
Your C source code might look something like this to create two channels, one to write and one to read.
rtdx_CreateInputChannel(ichan); % processor reads from this.
rtdx_CreateOutputChannel(ochan); % processor writes to this.
These are the entries we use in int16.c
(the source code that generates rtdxtutorial_6xevm.out) to create the read and write channels.
If you are working with a model in Simulink software and using code generation, use the To Rtdx and From Rtdx blocks in your model to add the
RTDX communications channels to your model and to the executable code on your processor.
One more note about this tutorial. Throughout the code we use both the dot notation (direct property referencing) to access functions and link properties and the function form.
For example, use the following command to open and configure ichan for write mode.
cc.rtdx.open('ichan','w');
You could use an equivalent syntax, the function form, that does not use direct property referencing.
open(cc.rtdx,'ichan','w');
Or, use open(rx,'ichan','w'); if you created an alias rx to the RTDX portion of cc
, as shown by the following command:
2-26
Getting Started with RTDX™ rx = cc.rtdx;
Creating the ticcs Objects
With your processing model converted to an executable suitable for your desired processor, you are ready to use the objects to test and run your model on your processor. Embedded IDE Link CC and the objects do not distinguish the source of the executable — whether you used Embedded IDE Link CC and
Real-Time Workshop, CCS IDE, or some other development tool to program and compile your model to an executable does not affect the object connections.
So long as your .
.out
file is acceptable to the processor you select, Embedded
IDE Link CC provides the connection to the processor.
Note Program rtdxtutorial_6xevm.out
uses the C6711. The executable is compiled, built, and linked to run on the C6711 processor. To use the tutorial without changes, specify your C6711 when you define the object properties boardnum and procnum
.
Before continuing with this tutorial, you must load a valid GEL file to configure the EMIF registers of your processor and perform any required processor initialization steps. Default GEL files provided by CCS are stored in
..\cc\gel in the folder where you installed CCS software. Select File
> Load_GEL in CCS IDE to load the default GEL file that matches your processor family, such as init6x0x.gel
for the C6x0x processor family, and your configuration.
Begin the process of getting your model onto the processor by creating a an object that refers to CCS IDE. Start by clearing all existing handles and setting echo on so you see functions in the M-file execute as the program runs:
1 clear all; echo on; clear all has the side effect of removing debugging breakpoints and resetting persistent variables because function breakpoints and persistent variables are cleared whenever the M-file changes or is cleared.
Breakpoints within your executable remain after clear
. Clearing the
MATLAB workspace does not affect your executable.
2
Now construct the link to your board and processor by entering
2-27
2
Automation Interface cc=ticcs('boardnum',0); boardnum boardnum defines which board the new link accesses. In this example, is 0. Embedded IDE Link CC connects the link to the first, and in this case only, processor on the board. To find the boardnum and procnum values for the boards and simulators on your system, use ccsboardinfo
.
When you enter the following command at the prompt ccsboardinfo
Embedded IDE Link CC returns a list like the following one that identifies the boards and processors in your computer.
Board Board
Num Name
1
0
C6xxx Simulator (Texas
Inst...
C6701 EVM (Texas
Instruments)
Proc Processor Processor
Num Name Type
0 CPU TMS320C6211
0 CPU_1 TMS320C6701
3
To open and load the processor file, change the path for MATLAB software to be able to find the file.
projname =
C:\Temp\LinkForCCSDemos_3.2\rtdxtutorial\c6x\c64xp\rtdxtut_sim.pjt
outFile =
C:\Temp\LinkForCCSDemos_v3.2\rtdxtutorial\c6x\c64xp\rtdxtut_sim.out
processor_dir = demoPjt.DemoDir
processor_dir =
C:\Temp\LinkForCCSDemos_v3.2\rtdxtutorial\c6x\c64xp
2-28
Getting Started with RTDX™
% Go to processor directory cd(cc,processor_dir);cd(cc,tgt_dir); % Or cc.cd(tgt_dir) dir(cc); % Or cc.dir
To load the appropriate project file to your processor, enter the following commands at the MATLAB software prompt.
getDemoProject is a specialized function for loading Embedded IDE Link CC demo files. It is not supported as a standard Embedded IDE Link CC function.
demoPjt = getDemoProject(cc,'ccstutorial'); demoPjt = isLibProj: 0
TemplateProject: 'C:\Temp\LinkForCCSDemos_v3.2\template\c6x\c64x.pjt'
DemoDir: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c64xp'
ProjectFile: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c64xp\ccstut.pjt'
ProgramFile: 'C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c64xp\ccstut.out'
SrcFile: {' $matlabroot \toolbox\ccslink\ccsdemos\ccstutorial\ccstut.c'}
LibFile: ''
CmdFile: {' $matlabroot \toolbox\ccslink\ccsdemos\shared\c6x\c64p.cmd'}
HdrFile: ''
BuildOpts: [1x1 struct]
ProjectAction: 'recreateProj-rebuildProg'
RebuildDemo: 1 demoPjt.ProjectFile
ans =
C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c64xp\ccstut.pjt
demoPjt.DemoDir
ans =
C:\Temp\LinkForCCSDemos_v3.2\ccstutorial\c6x\c64xp
2-29
2
Automation Interface
Notice where the demo files are stored on your machine. In general,
Embedded IDE Link CC software stores the demo project files in
LinkforCCS_vproduct_version
For example, if you are using version 3.2 of Embedded IDE Link CC software, the project demos are stored in
LinkforCCS_v3.2\
. Embedded
IDE Link CC software creates this directory in a location on your machine where you have write permission. Usually, there are two locations where
Embedded IDE Link CC software tries to create the demo directory, in the order shown.
a
In a temporary directory on the C drive, such as
C:\temp\
.
b
If Embedded IDE Link CC software cannot use the temp directory, you see a dialog box that asks you to select a location to store the demos.
4
You have reset the directory path to find the tutorial file. Now open the
.out
file that matches your processor type, such as rtdxtutorial_c67x.out
or rtdxtutorial_c64x.out
.
cc.open('rtdxtutorial_67x.out')
Because open is overloaded for the CCS IDE and RTDX links, this may seem a bit strange. In this syntax, open loads your executable file onto the processor identified by cc
. Later in this tutorial, you use open with a different syntax to open channels in RTDX.
In the next section, you use the new link to open and enable communications between MATLAB software and your processor.
Configuring Communications Channels
Communications channels to the processor do not exist until you open and enable them through Embedded IDE Link CC and CCS IDE. Opening channels consists of opening and configuring each channel for reading or writing, and enabling the channels.
In the open function, you provide the channel names as strings for the channel name property. The channel name you use is not random. The channel name string must match a channel defined in the executable file. If you specify
2-30
Getting Started with RTDX™ a string that does not identify an existing channel in the executable, the open operation fails.
In this tutorial, two channels exist on the processor — ichan and ochan
.
Although the channels are named ichan for input channel and ochan for output channel, neither channel is configured for input or output until you configure them from MATLAB software or CCS IDE. You could configure ichan as the output channel and ochan as the input channel. The links would work just the same. For simplicity, the tutorial configures ichan for input and ochan for output. One more note—reading and writing are defined as seen by the processor. When you write data from MATLAB software, you write to the channel that the processor reads, ichan in this case. Conversely, when you read from the processor, you read from ochan
, the channel that the processor writes to:
1
Configure buffers in RTDX to store the data until MATLAB software can read it into your workspace. Often, MATLAB software cannot read data as quickly as the processor can write it to the channel.
cc.rtdx.configure(1024,4); % define 4 channels of 1024 bytes each
Channel buffers are optional. Adding them provides a measure of insurance that data gets from your processor to MATLAB software without getting lost.
2
Define one of the channels as a write channel. Use ’ ichan
’ for the channel name and ’ w
’ for the mode. Either ’ w
’ or ’ r
’ fits here, for write or read.
cc.rtdx.open('ichan','w');
3
Now enable the channel you opened.
cc.rtdx.enable('ichan');
4
Repeat steps 2 and 3 to prepare a read channel.
cc.rtdx.open('ochan','r'); cc.rtdx.enable('ochan');
5
To use the new channels, enable RTDX by entering
2-31
2
Automation Interface cc.rtdx.enable;
You could do this step before you configure the channels — the order does not matter.
6
Reset the global time-out to 20s to provide a little room for error.
ticcs applies a default timeout value of 10s. In some cases this may not be enough.
cc.rtdx.get('timeout') ans =
10 cc.rtdx.set('timeout', 20); % Reset timeout = 20 seconds
7
Check that the timeout property value is now 20s and that your object has the correct configuration for the rest of the tutorial.
cc.rtdx
RTDX Object:
API version:
Default timeout:
Open channels:
1.0
20.00 secs
2
Running the Application
To this point you have been doing housekeeping functions that are common to any application you run on the processor. You load the processor, configure the communications, and set up other properties you need.
In this tutorial task, you use a specific application to demonstrate a few of the functions available in Embedded IDE Link CC that let you experiment with your application while you develop your prototype. To demonstrate the link for RTDX readmat
, readmsg
, and writemsg functions, you write data to your processor for processing, then read data from the processor after processing:
1
Restart the program you loaded on the processor.
restart ensures the program counter (PC) is at the beginning of the executable code on the processor.
cc.restart
2-32
Getting Started with RTDX™
Restarting the processor does not start the program executing. You use run to start program execution.
2
Type cc.run('run')
;
Using ’ run
’ for the run mode tells the processor to continue to execute the loaded program continuously until it receives a halt directive. In this mode, control returns to MATLAB software so you can work in MATLAB software while the program runs. Other options for the mode are
• ’ runtohalt
’ — start to execute the program and wait to return control to
MATLAB software until the process reaches a breakpoint or execution terminates.
• ’ tohalt
’ — change the state of a running processor to ’ runtohalt
’ and wait to return until the program halts. Use tohalt mode to stop the running processor cleanly.
3
Type the following functions to enable the write channel and verify that the enable takes effect.
cc.rtdx.enable('ichan'); cc.rtdx.isenabled('ichan')
If MATLAB software responds ans = 0 your channel is not enabled and you cannot proceed with the tutorial. Try to enable the channel again and verify the status.
4
Write some data to the processor. Check that you can write to the processor, then use writemsg to send the data. You do not need to enter the if-test code shown.
if cc.rtdx.iswritable('ichan'), % Used in a script application.
disp('writing to processor...') % Optional to display progress.
indata=1:10 cc.rtdx.writemsg('ichan', int16(indata)) end % Used in scripts for channel testing.
The if statement simulates writing the data from within a MATLAB software script. The script uses iswritable to check that the input channel is functioning. If iswritable returns
0 the script would skip the write
2-33
2
Automation Interface and exit the program, or respond in some way. When you are writing or reading data to your processor in a script or M-file, checking the status of the channels can help you avoid errors during execution.
As your application runs you may find it helpful to display progress messages. In this case, the program directed MATLAB software to print a message as it reads the data from the processor by adding the function disp('writing to processor...')
Function cc.rtdx.writemsg('ichan', int16(indata)) results in 20 messages stored on the processor. Here’s how.
When you write indata to the processor, the following code running on the processor takes your input data from ichan
, adds one to the values and copies the data to memory: while ( !RTDX_isInputEnabled(&ichan) )
{/* wait for channel enable from MATLAB */}
RTDX_read( &ichan, recvd, sizeof(recvd) ); puts("\n\n Read Completed "); for (j=1; j<=20; j++) { for (i=0; i<MAX; i++) { recvd[i] +=1;
} while ( !RTDX_isOutputEnabled(&ochan) )
{ /* wait for channel enable from MATLAB */ }
RTDX_write( &ochan, recvd, sizeof(recvd) ); while ( RTDX_writing != NULL )
{ /* wait for data xfer INTERRUPT DRIVEN for C6000 */ }
}
Program int16_rtdx.c
contains this source code. You can find the file in a folder in the
..\tidemos\rtdxtutorial directory.
5
Type the following to check the number of available messages to read from the processor.
num_of_msgs = cc.rtdx.msgcount('ochan');
2-34
Getting Started with RTDX™ num_of_msgs should be zero. Using this process to check the amount of data can make your reads more reliable by letting you or your program know how much data to expect.
6
Type the following to verify that your read channel ochan is enabled for communications.
cc.rtdx.isenabled('ochan')
You should get back ans = 0
— you have not enabled the channel yet.
7
Now enable and verify ’ ochan
’.
cc.rtdx.enable('ochan'); cc.rtdx.isenabled('ochan')
To show that ochan is ready, MATLAB software responds ans = 1
. If not, try enabling ochan again.
8
Type pause(5);
The pause function gives the processor extra time to process the data in indata and transfer the data to the buffer you configured for ochan
.
9
Repeat the check for the number of messages in the queue. There should be
20 messages available in the buffer.
num_of_msgs = cc.rtdx.msgcount('ochan')
With num_of_msgs = 20
, you could use a looping structure to read the messages from the queue in to MATLAB software. In the next few steps of this tutorial you read data from the ochan queue to different data formats within MATLAB software.
10
Read one message from the queue into variable outdata
.
outdata = cc.rtdx.readmsg('ochan','int16') outdata =
2-35
2
Automation Interface
2 3 4 5 6 7 8 9 10 11
Notice the ’ int16
’ represent option. When you read data from your processor you need to tell MATLAB software the data type you are reading.
You wrote the data in step 4 as 16-bit integers so you use the same data
type here.
While performing reads and writes, your process continues to run. You did not need to stop the processor to get the data or send the data, unlike using most debuggers and breakpoints in your code. You placed your data in memory across an RTDX channel, the processor used the data, and you read the data from memory across an RTDX channel, without stopping the processor.
11
You can read data into cell arrays, rather than into simple double-precision variables. Use the following function to read three messages to cell array outdata
, an array of three, 1-by-10 vectors. Each message is a 1-by-10 vector stored on the processor.
outdata = cc.rtdx.readmsg('ochan','int16',3) outdata =
[1x10 int16] [1x10 int16] [1x10 int16]
12
Cell array outdata contains three messages. Look at the second message, or matrix, in outdata by using dereferencing with the array.
outdata{1,2} outdata =
4 5 6 7 8 9 10 11 12 13
13
Read two messages from the processor into two 2-by-5 matrices in your
MATLAB workspace.
outdata = cc.rtdx.readmsg('ochan','int16',[2 5],2) outdata =
[2x5 int16] [2x5 int16]
2-36
Getting Started with RTDX™
To specify the number of messages to read and the data format in your workspace, you used the siz and nummsgs options set to
[2 5] and
2
.
14
You can look at both matrices in outdata by dereferencing the cell array again.
outdata{1,:} ans =
6 ans =
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
15
For a change, read a message from the queue into a column vector.
outdata = cc.rtdx.readmsg('ochan','int16',[10 1]) outdata =
8
9
10
11
12
13
14
15
16
17
16
Embedded IDE Link CC provides a function for reading messages into matrices– readmat
. Use readmat to read a message into a 5-by-2 matrix in
MATLAB software.
outdata = readmat(cc.rtdx,'ochan','int16',[5 2]) outdata =
9 14
10
11
15
16
2-37
2
Automation Interface
12
13
17
18
Because a 5-by-2 matrix requires ten elements, MATLAB software reads one message into outdata to fill the matrix.
17
To check your progress, see how many messages remain in the queue. You have read eight messages from the queue so 12 should remain.
num_of_msgs = cc.rtdx.msgcount('ochan') num_of_msgs =
12
18
To demonstrate the connection between messages and a matrix in MATLAB software, read data from
'ochan' to fill a 4-by-5 matrix in your workspace.
outdata = cc.rtdx.readmat('ochan','int16',[4 5]) outdata =
10 14
11
12
13
15
16
17
18
19
11
12
13
14
15
16
17
18
19
20
Filling the matrix required two messages worth of data.
19
To verify that the last step used two messages, recheck the message count.
You should find 10 messages waiting in the queue.
num_of_msgs = cc.rtdx.msgcount('ochan')
20
Continuing with matrix reads, fill a 10-by-5 matrix (50 matrix elements or five messages).
outdata = cc.rtdx.readmat('ochan','int16',[10 5]) outdata =
12 13
13
14
14
15
14
15
16
15
16
17
16
17
18
2-38
Getting Started with RTDX™
19
20
21
15
16
17
18
20
21
22
16
17
18
19
21
22
23
14
18
19
20
22
23
24
18
19
20
21
23
24
25
19
20
21
22
21
Recheck the number of messages in the queue to see that five remain.
22 flush lets you remove messages from the queue without reading them.
Data in the message you remove is lost. Use flush to remove the next message in the read queue. Then check the waiting message count.
cc.rtdx.flush('ochan',1) num_of_msgs = cc.rtdx.msgcount('ochan') num_of_msgs =
4
23
Empty the remaining messages from the queue and verify that the queue is empty.
cc.rtdx.flush('ochan','all')
With the all option, flush discards all messages in the ochan queue.
Closing the Connections and Channels or Cleaning Up
One of the most important programmatic processes you should do in every
RTDX session is to clean up at the end. Cleaning up includes stopping your processor, disabling the RTDX channels you enabled, disabling RTDX and closing your open channels. Performing this series of tasks ensures that future processes avoid trouble caused by unexpected interactions with remaining handles, channels, and links from earlier development work.
Best practices suggest that you include the following tasks (or an appropriate subset that meets your development needs) in your development scripts and programs.
2-39
2
Automation Interface
We use four functions in this section; each has a purpose — the operational details in the following list explain how and why we use each one. They are
• clear
— remove all RTDX objects and handles associated with a CCS and RTDX link. When you finish a session with RTDX, clear removes all traces of the specified link, or all links when you use the ’ all
’ option in the syntax. When you clear one or more links, they no longer exist and cannot be reopened or used. If you are ending your programming session and do not want to retain any of the channels or links you created, use clear to end the RTDX communications and links and release all channels and resources associated with existing CCS IDE and RTDX links. You do not need to use the close or disable functions first.
To load a new program to a processor on which you have a program running, and to which you have links, you must clear the existing links before you load the new program to the processor.
• close
— close the specified RTDX channel. To use the channel again, you must open and enable the channel. Compare close to disable
.
close('rtdx') closes the communications provided by RTDX. After you close RTDX, you cannot communicate with your processor.
• disable
— remove RTDX communications from the specified channel, but does not remove the channel, or link. Disabling channels may be useful when you do not want to see the data that is being fed to the channel, but you may want to read the channel later. By enabling the channel later, you have access to the data entering the channel buffer. Note that data that entered the channel while it was disabled is lost.
• halt
— stop a running processor. You may still have one or more messages in the host buffer.
Use the following procedure to shut down communications between MATLAB software and the processor, and end your session:
1
Begin the process of shutting down the processor and RTDX by stopping the processor. Type the following functions at the prompt.
if (isrunning(cc)) % Use this test in scripts.
cc.halt; % Halt the processor.
end % Done.
2-40
Getting Started with RTDX™
Your processor may already be stopped at this point. In a script, you might put the function in an ifstatement as we have done here. Consider this test to be a safety check. No harm comes to the processor if it is already stopped when you tell it to stop. When you direct a stopped processor to halt, the function returns immediately.
2
You have stopped the processor. Now disable the RTDX channels you opened to communicate with the processor.
cc.rtdx.disable('all');
If necessary, using disable with channel name and processor identifier input arguments lets you disable only the channel you choose. When you have more than one board or processor, you may find disabling selected channels meets your needs.
When you finish your RTDX communications session, disable RTDX to ensure that Embedded IDE Link CC releases your open channels before you close them.
cc.rtdx.disable;
3
Use one or all of the following function syntaxes to close your open channels. Either close selected channels by using the channel name in the function, or use the all option to close all open channels.
• cc.rtdx.close('ichan') to close your input channel in this tutorial.
• cc.rtdx.close('ochan') to close your output channel in the tutorial.
• cc.rtdx.close('all') to close all of your open RTDX channels, regardless of whether they are part of this tutorial.
Consider using the all option with the close function when you finish your RTDX work. Closing channels reduces unforeseen problems caused by channel objects that exist but do not get closed correctly when you end your session.
4
When you created your RTDX object ( cc = ticcs('boardnum',1
) at the beginning of this tutorial, the ticcs function opened CCS IDE and set the visibility to 0. To avoid problems that occur when you close the interface to
RTDX with CCS visibility set to 0, make CCS IDE visible on your desktop.
2-41
2
Automation Interface
The following if statement checks the CCS IDE visibility and changes it if needed.
if cc.isvisible, cc.visible(1); end
Visibility can cause problems. When CCS IDE is running invisibly on your desktop, do not use clear all to remove your links for CCS IDE and
RTDX. Without a ticcs object that references the CCS IDE you cannot access CCS IDE to change the visibility setting, or close the application. To close CCS IDE when you do not have an existing object, either create a new object to access the CCS IDE, or use Microsoft Windows Task Manager to end the process cc_app.exe
, or close the MATLAB software.
5
You have finished the work in this tutorial. Enter the following commands to close your remaining references to CCS IDE and release the associated resources.
clear ('all'); % Calls the link destructors to remove all links.
echo off clear all without the parentheses removes all variables from your
MATLAB workspace.
You have completed the tutorial using RTDX. During the tutorial you
1
Opened connections to CCS IDE and RTDX and used those connections to load an executable program to your processor.
2
Configured a pair of channels so you could transfer data to and from your processor.
3
Ran the executable on the processor, sending data to the processor for processing and retrieving the results.
4
Stopped the executing program and closed the links to CCS IDE and RTDX.
This tutorial provides a working process for using Embedded IDE Link CC and your signal processing programs to develop programs for a range of Texas
2-42
Getting Started with RTDX™
Instruments processors. While the processor may change, the essentials of the process remain the same.
Listing the Functions in Embedded IDE Link CC software
To review a complete list of functions and methods that operate with ticcs objects, either CCS IDE or RTDX, enter either of the following commands at the prompt.
help ticcs help rtdx
If you already have a ticcs object cc
, you can use dot notation to return the methods for CCS IDE or RTDX by entering one of the following commands at the prompt:
• cc.methods
• cc.rtdx.methods
In either instance MATLAB software returns a list of the available functions for the specified link type, including both public and private functions. For example, to see the functions (methods) for links to CCS IDE, enter: help ticcs
TICCS Base constructor for the 'Embedded IDE Link(TM) CC'.
H=TICCS('propertyname','propertyvalue',...) returns a handle H that
Embedded IDE Link CC software uses to communicate with Code Composer
Studio(TM) (CCS) IDE. The input parameters to TICCS are treated as property definitions. Each property definition consists of a property name/property value pair.
Property Names:
* 'boardnum' - the identifier for the installed board selected from the list of boards configured under CCS Setup. If you have only one board under CCS Setup, use the default property value 0 to access the board. This value is read-only after you create the object.
* 'procnum' - the identifier for the processor on the board defined by
2-43
2
Automation Interface boardnum. On boards with more than one processor, use this value to specify the processor on the board. On boards with one processor, use the default property value 0 to specify the processor. This value is read-only after you create the object.
* 'timeout' - the maximum period (in seconds) that a TICCS method waits for a processor operation to complete (e.g. load).
If this time is exceeded, a time-out error is thrown.
The default value is 10 seconds.
Examples: cc = ticcs % defaults to boardnum=0, procnum=0, timeout=10 cc = ticcs('boardnum',value) % defaults to procnum=0, timeout=10 cc = ticcs('boardnum',value,'procnum',value) cc = ticcs(...,'timeout',value)
% defaults to timeout=10
---------------------------------------------------------------------
Description of methods available for TICCS
---------------------------------------------------------------------
ACTIVATE Set the active project, text file or build configuration
ADD
ANIMATE
ADDRESS
BUILD
Add source file to a project
Initiate a processor execution with breakpoint animation
Search the processor's symbol table for an address
Compile/Link to build a program file
CD
CLOSE
DIR
DISP
Change or query working directory of CCS
Close a CCS project
List files in CCS working directory
Display information about the TICCS object
HALT
INFO
Immediately terminate execution of the processor
Produce a list of information about the processor
INSERT Insert a debug point into processor memory
ISREADABLE Query if a block of processor memory is available for reading
ISRUNNING Query status of processor execution
ISRTDXCAPABLE Query if processor supports RTDX communications
ISVISIBLE Query visibility of CCS application
ISWRITABLE Query if a block of processor memory is available for writing
LIST
LOAD
NEW
OPEN
Produce various lists of information from CCS
Load a program file or a GEL file into the processor
Create a default project or build configuration
Open a project file
2-44
Getting Started with RTDX™
PROFILE
READ
REGREAD
REGWRITE
RELOAD
REMOVE
RESET
RESTART
RUN
SAVE
SYMBOL
VISIBLE
WRITE
Return execution and stack profile report
Return a block of data from the memory of the processor
Return data stored in a processor register
Modify the contents of a processor register
Reload most recently loaded program file
Remove a file from a project or a debug point from memory
Reset the processor
Return PC to the beginning of a program
Initiate execution of the processor
Save the changes made to a CCS project
Return the processor's entire symbol table
Hide or reveal CCS application window
Place a block of MATLAB data into the memory of the processor
For more information on a given method, use the following syntax: help ccsdebug/(method)
See also rtdx.
Reference page in Help browser doc ticcs
2-45
2
Automation Interface
2-46
Constructing ticcs Objects
When you create a connection to CCS IDE using the ticcs command, you are creating a “ ticcs object for accessing the CCS IDE and RTDX interface”. The ticcs object implementation relies on MATLAB software object-oriented programming capabilities.
The discussions in this section apply to the ticcs objects in Embedded IDE
Link CC.
Like other MATLAB software structures, objects in Embedded IDE Link CC have predefined fields called object properties.
You specify object property values by one of the following methods:
• Setting the property values when you create the ticcs object
• Creating an object with default property values, and changing some or all of these property values later
For examples of setting ticcs object properties, refer to ticcs
.
Example — Constructor for ticcs Objects
The easiest way to create an object is to use the function ticcs to create an object with the default properties. Create an object named cc to refer to
CCS IDE by entering cc = ticcs
MATLAB software responds with a list of the properties of the object cc you created along with the associated default property values.
ticcs object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
Constructing ticcs Objects
RTDX channels : 0
Inspecting the output reveals two objects listed—a CCS IDE object and an
RTDX object. CCS IDE and RTDX objects cannot be created separately. By design they maintain a member class relationship; the RTDX object is a class, a member of the CCS object class. In this example, cc is an instance of the class CCS. If you enter rx = cc.rtdx
rx is a handle to the RTDX portion of the CCS object. As an alias, rx replaces cc.rtdx
in functions such as now produces readmat or writemsg that use the RTDX communications features of the CCS link. Typing rx at the command line rx
RTDX channels : 0
The object properties are described in Chapter 6, “Function Reference”, and
in more detail in ticcs Object Properties. These properties are set to default
values when you construct objects.
2-47
2
Automation Interface
ticcs Properties and Property Values
Objects in Embedded IDE Link CC software have properties associated with them. Each property is assigned a value. You can set the values of most properties, either when you create the link or by changing the property value later. However, some properties have read-only values. And a few property values, such as the board number and the processor to which the link attaches, become read-only after you create the object. You cannot change those after you create your link.
For more information about using objects and properties, refer to “Using
Objects” in MATLAB Programming Fundamentals.
2-48
Overloaded Functions for ticcs Objects
Overloaded Functions for ticcs Objects
Several functions in this Embedded IDE Link CC have the same name as functions in other MathWorks toolboxes or in MATLAB software. These behave similarly to their original counterparts, but you apply these functions directly to an object. This concept of having functions with the same name operate on different types of objects (or on data) is called overloading of functions.
For example, the set command is overloaded for ticcs objects. After you specify your link by assigning values to its properties, you can apply the functions in this toolbox (such as readmat for using RTDX to read an array of data from the processor) directly to the variable name you assign to your object, without specifying your object parameters again.
For a complete list of the functions that act on ticcs objects, refer to the
tables of functions in the function reference pages.
2-49
2
Automation Interface
ticcs Object Properties
In this section...
“Quick Reference to ticcs Object Properties” on page 2-50
“Details About ticcs Object Properties” on page 2-52
Embedded IDE Link CC provides an interface to your processor hardware so you can communicate with processors for which you are developing systems and algorithms. Each ticcs object comprises two objects—a CCS IDE object and an RTDX interface object. The objects are not separable; the RTDX object is a subclass of the CCS IDE object. Each of the objects has multiple properties. To configure the interface objects for CCS IDE and RTDX, you set parameters that define details such as the desired board, the processor, the timeout period applied for communications operations, and a number of other values. Because Embedded IDE Link CC uses objects to create the interface, the parameters you set are called properties and you treat them as properties when you set them, retrieve them, or modify them.
This section details the properties for the ticcs objects for CCS IDE and
RTDX. First the section provides tables of the properties, for quick reference.
Following the tables, the section offers in-depth descriptions of each property, its name and use, and whether you can set and get the property value associated with the property. Descriptions include a few examples of the property in use.
MATLAB software users may find much of this handling of objects familiar.
Objects in Embedded IDE Link CC, behave like objects in MATLAB software and the other object-oriented toolboxes. For C++ programmers, discussion of object-oriented programming is likely to be a review.
Quick Reference to ticcs Object Properties
The following table lists the properties for the ticcs objects in Embedded
IDE Link CC. The second column tells you which object the property belongs to. Knowing which property belongs to each object in a ticcs object tells you how to access the property.
2-50
ticcs Object Properties
Property
Name
boardnum ccsappexe numchannels
Applies to Which
Connection?
CCS IDE
CCS IDE
CCS IDE
RTDX
CCS IDE
CCS IDE
RTDX
RTDX
CCS IDE
RTDX
User
Settable?
No
Yes/initially
No
No
Yes/default
Yes/at start only
No
No
Yes/default
No
Description
Reports the version number of your CCS
API.
Specifies the index number of a board that CCS IDE recognizes.
Specifies the path to the
CCS IDE executable.
Read-only property.
Contains the number of open RTDX channels for a specific link.
Stores the default memory page for reads and writes.
Stores the number CCS
Setup Utility assigns to the processor.
Specifies RTDX in a syntax.
A string. Identifies the
RTDX channel for a link.
Contains the global timeout setting for the link.
Reports the version of your
RTDX software.
Some properties are read only — you cannot set the property value. Other properties you can change at all times. If the entry in the User Settable column is “Yes/initially”, you can set the property value only when you create the link. Thereafter it is read only.
2-51
2
Automation Interface
Details About ticcs Object Properties
To use the links for CCS IDE and RTDX interface you set values for:
• boardnum
— specify the board with which the link communicates.
• procnum
— specify the processor on the board. If the board has multiple processors, procnum identifies the processor to use.
• timeout
— specify the global timeout value. (Optional. Default is 10s.)
Details of the properties associated with connections to CCS IDE and RTDX interface appear in the following sections, listed in alphabetical order by property name.
Many of these properties are object linking and embedding (OLE) handles.
The MATLAB software COM server creates the handles when you create objects for CCS IDE and RTDX. You can manipulate the OLE handles using get
, set
, and invoke to work directly with the COM interface with which the handles interact.
apiversion
Property appversion contains a string that reports the version of the application program interface (API) for CCS IDE that you are using when you create a link. You cannot change this string. When you upgrade the API, or
CCS IDE, the string changes to match. Use display to see the apiversion property value for a link. This example shows the appversion value for link cc
.
display(cc)
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
2-52
ticcs Object Properties
Note that the API version is not the same as the CCS IDE version.
boardnum
Property boardnum identifies the board referenced by a link for CCS IDE.
When you create a link, you use boardnum to specify the board you are using.
To get the value for boardnum
, use ccsboardinfo or the CCS Setup utility from Texas Instruments software. The CCS Setup utility assigns the number for each board installed on your system.
ccsappexe
Property ccsappexe contains the path to the CCS IDE executable file cc_app.exe
. When you use ticcs to create a link, MATLAB software determines the path to the CCS IDE executable and stores the path in this property. This is a read-only property. You cannot set it.
numchannels
Property numchannels reports the number of open RTDX communications channels for an RTDX link. Each time you open a channel for a link, numchannels increments by one. For new links numchannels is zero until you open a channel for the link.
To see the value for numchannels create a link to CCS IDE. Then open a channel to RTDX. Use get or display to see the RTDX link properties.
cc=ticcs
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
2-53
2
Automation Interface rx=cc.rtdx
RTDX channels : 0 open(rx,'ichan','r','ochan','w'); get(cc.rtdx) ans = numChannels: 2
Rtdx: [1x1 COM ]
RtdxChannel: {'' '' ''} procType: 103 timeout: 10
page
Property page contains the default value CCS IDE uses when the user does not specify the page input argument in the syntax for a function that access memory.
procnum
Property procnum identifies the processor referenced by a link for CCS IDE.
When you create an object, you use procnum to specify the processor you are using . The CCS Setup Utility assigns a number to each processor installed on each board. To determine the value of procnum for a processor, use ccsboardinfo or the CCS Setup utility from Texas Instruments software.
To identify a processor, you need both the boardnum and procnum values.
For boards with one processor, procnum equals zero. CCS IDE numbers the processors on multiprocessor boards sequentially from 0 to the number of processors. For example, on a board with four processors, the processors are numbered 0, 1, 2, and 3.
2-54
ticcs Object Properties
rtdx
Property rtdx is a subclass of the ticcs link and represents the RTDX portion of a link for CCS IDE. As shown in the example, rtdx has properties of its own that you can set, such as timeout
, and that report various states of the link.
get(cc.rtdx) ans = version: 1 numChannels: 0
Rtdx: [1x1 COM ]
RtdxChannel: {'' [] ''} procType: 103 timeout: 10
In addition, you can create an alias to the rtdx portion of a link, as shown in this code example.
rx=cc.rtdx
RTDX channels : 0
Now you can use rx with the functions in Embedded IDE Link CC, such as get or set
. If you have two open channels, the display looks like the following get(rx) ans = numChannels: 2
Rtdx: [1x1 COM ]
RtdxChannel: {2x3 cell} procType: 98 timeout: 10 when the processor is from the C62 family.
2-55
2
Automation Interface
rtdxchannel
Property rtdxchannel
, along with numchannels and proctype
, is a read-only property for the RTDX portion of a link for CCS IDE. To see the value of this property, use get with the link. Neither set nor invoke work with rtdxchannel
.
rtdxchannel is a cell array that contains the channel name, handle, and mode for each open channel for the link. For each open channel, rtdxchannel contains three fields, as follows:
.rtdxchannel{i,1}
.rtdxchannel{i,2}
.rtdxchannel{i,3}
Channel name of the i th-channel, i from 1 to the number of open channels
Handle for the i th-channel
Mode of the i th-channel, either
'r' for read or
'w' for write
With four open channels, rtdxchannel contains four channel elements and three fields for each channel element.
timeout
Property timeout specifies how long CCS IDE waits for any process to finish.
Two timeout periods can exist — one global, one local. You set the global timeout when you create a link for CCS IDE. The default global timeout value 10 s. However, when you use functions to read or write data to CCS
IDE or your processor, you can set a local timeout that overrides the global value. If you do not set a specific timeout value in a read or write process syntax, the global timeout value applies to the operation. Refer to the help for the read and write functions for the syntax to set the local timeout value for an operation.
version
Property version reports the version number of your RTDX software. When you create a ticcs object, version contains a string that reports the version of the RTDX application that you are using. You cannot change this string.
When you upgrade the API, or CCS IDE, the string changes to match. Use display to see the version property value for a link. This example shows the apiversion value for object rx
.
2-56
get(rx) % rx is an alias for cc.rtdx.
ans = version: 1 numChannels: 0
Rtdx: [1x1 COM ]
RtdxChannel: {'' [] ''} procType: 103 timeout: 10 ticcs Object Properties
2-57
2
Automation Interface
Managing Custom Data Types with the Data Type Manager
Using custom data types, called typedef s (using the C keyword typedef
), is one of the complications you encounter when you use hardware-in-the-loop
(HIL) to run a function in your project from MATLAB. Because MATLAB does not recognize custom type definitions you use in your projects, it cannot interpret data that you define in your project code with the typedef keyword, or use as arguments in your function prototype (declaration).
To allow you to use functions that include custom type definitions in function calls, Embedded IDE Link CC offers the Data Type Manager (DTM), a tool for defining custom type definitions to MATLAB. Using options in the DTM, you define one or more custom data types for a project and use them in the project. Or you define your custom data types and save them to use in many projects. This second feature is particularly useful when you use the same custom data types in many projects. Rather than redefining your custom types for each new project or function, you reload the types from an earlier project to use them again.
As programmers, usually you use typedefs for one or more of a few reasons:
• Make your code more accessible by providing more information about the variable(s)
• Create a Boolean data type that C does not provide
• Define structures in your programs
• Define nonstandard data types
The DTM lets you define all of these things in the MATLAB context so your
C function that uses typedefs works with your MATLAB command line functions. For reference information about the DTM, go to datatypemanager
.
Entering datatypemanager(cc)
2-58
Managing Custom Data Types with the Data Type Manager at the MATLAB command line opens the DTM, with the Data Type Manager dialog box shown here:
When the DTM opens, a variety of information and options displays in the
Data Type Manager dialog box:
• Typedef name (Equivalent data type) — provides a list of default data types. When you create a typedef
, you see it added to this list.
The lowercase versions of the data types appear because MATLAB does not recognize the initial capital versions automatically. In the data type list the project data type with the initial capital letter is mapped to the lowercase MATLAB data type.
• Add typedef — opens the Add Typedef dialog box so you can add one or more typedefs to your object. Your added typedef appears on the Typedef
name (Equivalent data type) list and is added to your ticcs object. Also,
2-59
2
Automation Interface when you pass the cc object to the DTM, and then add a typedef
, the command cc.type
returns the list of data types in the type property of your cc object, including the typedef s you added.
• Remove typedef — removes a selected typedef from the Typedef name
(Equivalent data type) list.
• Load session — loads a previously saved session so you can use the typedefs you defined earlier without reentering them.
• Refresh list — updates the list in Typedefs name (Equivalent data
type). Refreshing the list ensures the contents are current. If you changed your project data type content or loaded a new project, this updates the type definitions in the DTM.
• Close — closes the DTM and prompts you to save the session information.
This is the only way to save your work in this dialog box. Saving the session creates an M-file you can reload into the DTM later.
Adding Custom Type Definitions to MATLAB
Every custom type definition in your project must appear on the Typedef
name (Equivalent data type) list for MATLAB to understand the data types involved. To add entries the list, use the Add typedef option to identify your type definition with a data type that MATLAB recognizes. When you click Add typedef, the List of Known Data Types dialog box opens, displaying the data types currently recognized by MATLAB. To make finding a specific type easier, the known data types are grouped into categories:
• MATLAB types
• TI C types
• TI fixed point types
• Struct, union, enum types
• Other (e.g. pointers, typedefs)
2-60
Managing Custom Data Types with the Data Type Manager
Each custom type definition added in the DTM becomes part of the ticcs object passed to the DTM in datatypemanager(objectname)
. The list of data types in the object, both default and custom, is available by entering objectname.type
at the command prompt.
The same list appears in the DTM on the Typedef name (Equivalent data type)
MATLAB uses the type definitions when you run a function residing on your processor from MATLAB.
To Add a Typedef to MATLAB
You use the DTM to add typedefs for MATLAB to recognize, such as:
• Typedefs that use a MATLAB data type in the type definition
• Typedefs that use an enumerated or union data type in the type definition
• Typedefs that use a structure in the type definition
2-61
2
Automation Interface
• Typedefs that use pointers or typedefs in the type definition
To define custom data types that use structs, enums, or unions from a project, the project must be loaded on the processor before you add the custom type definitions. Either load the project and .
out file before you start the DTM, or use the Load Program option in the DTM to load the .
out file.
Note After a successful load process, you see the name of the file you loaded in
Loaded program. Otherwise, you get an error message that the load failed.
Only programs that you load from this dialog box appear in Program
loaded. Programs that are already loaded on your processor do not appear there because MATLAB cannot determine what program you have loaded.
You need to know the custom definitions you used so you can add them in the DTM. Use the options for list to verify whether you loaded a .
out file on the processor.
Create an object and load a program.
1
Create a ticcs object.
cc=ticcs;
2
Load a program on your processor. For example, the MATLAB command load(cc,'c6711dskwdnoisf_c6000_rtwD\c6711dskwdnoisf.out'); loads the executable file from the model c6711dskwdnois.mdl
on the processor.
3
Start the DTM with the object you created.
datatypemanager(cc);
The DTM starts, showing the default data types.
2-62
Managing Custom Data Types with the Data Type Manager
2-63
2
Automation Interface
4
Click Add typedef to add your first custom data type. The List of Known
Data Types dialog box appears as shown.
Add a MATLAB type definition.
5
In Typedef, enter the name of the typedef as you defined it in your code.
For this example, use typedef1_matlab
.
2-64
Managing Custom Data Types with the Data Type Manager
6
Select an appropriate MATLAB data type from the
MATLAB Types in
Known Types.
uint16 is the choice. Choose the data type that best represents the data type in your code.
7
Click OK to close the dialog box and add the new type definition to the
Typedef name list.
Add an enumerated type definition.
8
Click Add Typedef.
9
From the Known Types list, select
Struct, Enum, Union Types
.
10
To define your type definition, give it a name in Typedef, such as typedef_enum
2-65
2
Automation Interface
11
From the
Struct, Enum, Union Types list, select the appropriate enumerated data type to use with typedef_enum
. The enum_TAG_myEnum choice fills the enumerated type chosen.
2-66
12
Click OK to close the dialog box and add typedef_enum to your defined types that MATLAB software recognizes.
Add a structure typedef.
13
Click Add Typedef.
14
From the Known Types list, select
Struct, Enum, Union Types
.
15
To define your type definition, give it a name in Typedef, such as typedef_struct
.
16
From the
Struct, Enum, Union Types list, select the appropriate enumerated data type to use with typedef_struct
. This example uses struct_TAG_mySTruct
.
17
Click OK to close the dialog box and add the new data type to the list.
Managing Custom Data Types with the Data Type Manager
After you close the dialog box, the Typedef name list in the Data Type
Manager looks like this.
To check the data types in the cc object, enter cc.type
which returns
Defined types : Void, Float, Double, Long, Int, Short, Char, typedef1_matlab, typedef_enum, typedef struct
If your function declaration uses any of the types listed by cc.type
, MATLAB software can interpret the data correctly. For example, MATLAB software interprets the typedef1_matlab data type as uint16
.
2-67
2
Automation Interface
Clicking Close in the DTM prompts you to save your session. Saving the session creates an M-file that contains operations that create your final list of data types, identical to the data types in the Typedef name list.
The first line of the M-file is a function definition, where the name of the function is the filename of the session you saved. In the stored M-file, you find a function that includes add and remove operations that replicate the add and remove typedef operations you used to create the list of known data types in the DTM. For each time you added a typedef in the DTM, the M-file contains an add command that adds the new type definition to the type property of the cc object. When you removed a data type, you created an equivalent clear command that removes the specified data type from the type property of the cc object.
All the operations you performed adding and removing data types in the DTM during the session are stored in the generated M-file that you save, including mistakes you made while creating or removing type definitions. When you load your saved session into the DTM, you see the same error messages you saw, during the session. Keep in mind that you have already corrected these errors.
2-68
3
Project Generator
• “Introducing Project Generator” on page 3-2
• “Project Generation and Board Selection” on page 3-3
• “About the CCSLinkLib Blockset” on page 3-5
• “Schedulers and Timing” on page 3-12
• “Project Generator Tutorial” on page 3-39
• “Setting Code Generation Parameters for TI Processors” on page 3-48
• “Setting Model Configuration Parameters” on page 3-51
• “Using Custom Source Files in Generated Projects” on page 3-65
• “Optimizing Embedded Code with Target Function Libraries” on page 3-70
• “Model Reference and Embedded IDE Link CC” on page 3-77
3
Project Generator
Introducing Project Generator
Project generator provides the following features for developing project and generating code:
• Support automated project building for Texas Instruments’ Code Composer
Studio software that lets you create projects from code generated by
Real-Time Workshop and Real-Time Workshop Embedded Coder products.
The project automatically populates CCS projects in the CCS development environment.
• Configure code generation using model configuration parameters and processor preferences block options
• Select from two system target files to generate code specific to your processor
• Configure project build process
• Automatically download and run your generated projects on your processor
Note You cannot generate code for C6000 processors in big-endian mode.
Code generation supports only little-endian processor data byte order.
3-2
Project Generation and Board Selection
Project Generation and Board Selection
Project Generator uses ticcs objects to connect to the IDE. Each time you build a model to generate a project, the build process starts by issuing the ticcs method, as shown here: cc=ticcs('boardnum',boardnum,'procnum',procnum)
The software attempts to connect to the board ( boardnum
) and processor
( procnum
) associated with the Board name and Processor number parameters in the Target Preferences block in the model.
The result of the ticcs method changes, depending on the boards you configured in CCS. The following table describes how the software selects the board to connect to in your board configuration.
CCS Board Configuration State
Code Composer Studio or Embedded
IDE Link CC software not installed.
Code Composer Studio software does not have any configured boards.
Code Composer Studio software has one configured board.
Code Composer Studio software has one board configured that does not match the board name in the Target
Preferences block.
(*)
Response by Software
Returns an error message asking you to verify that you installed both Code
Composer Studio and Embedded
IDE Link CC properly.
Returns an error message that the software could not find any boards in your configuration. Use Setup Code
Composer Studio™ to configure at least one board.
Attaches to the board regardless of the name of the board supplied in the Target Preferences block. You see a warning message telling you which board the software selected.
Returns a warning message that the software could not find the board specified in the block and connected to the board listed in the warning message. The software connects to the first board in your CCS configuration.
3-3
3
Project Generator
CCS Board Configuration State
Code Composer Studio has more than one board configured. The board name specified in the Target
Preferences block is one of the configured boards.
Code Composer Studio has more than one board configured. The board name specified in the Target
Preferences block is not one of the configured boards.
(*)
Response by Software
Connects to the specified board.
Returns a message asking you to select a board from the list of configured boards. You have two choices:
• Select a board to use for project generation, and click OK. Your selection does not change the board specified in the Target
Preferences block. The software connects to the selected board.
• Click Abort to stop the project build and code generation process.
The software does not connect to the IDE or board.
(*) You may encounter the situation where you do not have the correct board configured in CCS because of one of the following conditions:
• You changed your board configuration after you added the Target
Preferences block to a model and saved the model. When you reopen the model, the board specified in Board name in the block is no longer in your configuration.
• You are working with a model from a source whose board configuration is not the same as yours. The model includes a Target Preferences block.
Use ccsboardinfo at the MATLAB prompt to verify or review your configured boards.
3-4
About the CCSLinkLib Blockset
About the CCSLinkLib Blockset
Embedded IDE Link CC block library ccslinklib comprises block libraries that contain blocks designed for generating projects for specific processors.
The libraries are
Library
C280x/C28x3x DSP Chip Support
( ccslinklib_c280x
)
C281x DSP Chip Support
( ccslinklib_c281x
)
C5000 DSP Chip Support
( ccslinklib_c5xxx
)
C6000 DSP Chip Support
( ccslinklib_c6xxx
)
Core Support ( ccslinklib_core
)
Target Preferences
( ccslinklib_tgtprefs
)
Description
Block for managing asynchronous scheduling on C280x-based hardware or simulators.
Block for managing asynchronous scheduling on C281x-based hardware or simulators.
Block for managing asynchronous scheduling on C5000-based hardware or simulators.
Block for managing asynchronous scheduling on C6000-based hardware or simulators.
Blocks for managing memory and scheduling on C6000-based hardware or simulators.
Block that configures Simulink models for specific processors.
Each block library appears in one of the next sections. The sections review the configuration options for blocks. For more information about RTDX, refer to
Getting Started with RTDX in your Embedded IDE Link CC documentation.
Each processor-specific block library contains a Hardware Interrupt block specific to the processor family.
The Core Support block library contains the following blocks that apply to all supported processors:
• Idle Task block
3-5
3
Project Generator
• Memory Allocate block
• Memory Copy block
Blocks for the processor families are almost identical. The following descriptions about each block, such as the Hardware Interrupt block, present all options for the block. Notes indicate when an option applies only to a processor-specific version of the block.
Here is the main library of blocks for Embedded IDE Link CC.
3-6
About the CCSLinkLib Blockset
The following figure shows the C280x/C28x3x DSP Chip Support library.
The C281x DSP Chip Support library contains the block in the following figure.
3-7
3
Project Generator
For the C5000 processor family, the C5000 DSP Chip Support library appears in the following figure.
3-8
About the CCSLinkLib Blockset
The C6000 DSP Chip Support library appear in the next figure.
The Core Support library appears in the next figure.
3-9
3
Project Generator
The Target Preferences library appears in the next figure.
3-10
About the CCSLinkLib Blockset
3-11
3
Project Generator
Schedulers and Timing
In this section...
“Configuring Models for Asynchronous Scheduling” on page 3-12
“Using Asynchronous Scheduling” on page 3-14
“Comparing Synchronous and Asynchronous Interrupt Processing” on page
“Using Synchronous Scheduling” on page 3-18
“Using Asynchronous Scheduling” on page 3-19
“Multitasking Scheduler Examples” on page 3-24
Configuring Models for Asynchronous Scheduling
Using the scheduling blocks, you can use an asynchronous (real-time) scheduler for your processor application. The asynchronous scheduler enables you to define interrupts and tasks to occur when you want by using blocks in the following libraries:
• C280x/C28x3x DSP Chip Support
• C281x DSP Chip Support
• C5000 DSP Chip Support
• C6000 DSP Chip Support
• Core Support
• Freescale™ MPC5500 Support
• Freescale MPC7400
• SHARC DSP Support
• TigerSHARC DSP Support
3-12
Schedulers and Timing
Note Models in this section are for example purposes only. You cannot build and run them without additional blocks.
Also, you can schedule multiple tasks for asynchronous execution using the blocks.
The following figures show a model updated to use the asynchronous scheduler by converting the model to a function subsystem and then adding a scheduling block (Hardware Interrupt) to drive the function subsystem in response to interrupts.
Before
The following model uses synchronous scheduling provided by the base rate in the model.
1
In 1
2: Asym
Dyadic Analysis
Filter Bank
In 1
In 2
In 3
In 4
Delay Alignment
Out 1
Out 2
Out 3
Out 4
Dead Zone
Soft Threshold
2: Asym
Dyadic Synthesis
Filter Bank
Output
1
Out 1
After
To convert to asynchronous operation, wrap the model in the previous figure in a function block and drive the input from a Hardware Interrupt block. The hardware interrupts that trigger the Hardware Interrupt block to activate an
ISR now triggers the model inside the function block.
3-13
3
Project Generator
3-14
1
In 1
2: Asym
Dyadic Analysis
Filter Bank
Algorithm Inside the Function Call Subsystem Block
Here’s the model inside the function call subsystem in the previous figure. It is the same as the original model that used synchronous scheduling.
In 1
In 2
In 3
In 4
Delay Alignment
Out 1
Out 2
Out 3
Out 4
Dead Zone
Soft Threshold
2: Asym
Dyadic Synthesis
Filter Bank
Output
1
Out 1
Using Asynchronous Scheduling
The following sections present common cases for using the scheduling blocks described in the previous sections.
Idle Task
The following model illustrates a case where the reverberation algorithm runs in the context of a background task in bare-board code generation mode.
Schedulers and Timing
The function generated for this task normally runs in free-running mode—repetitively and indefinitely. Subsystem execution of the reverberation function is the same as the subsystem described for the Free-Running
DSP/BIOS Task. It is data driven via a background DMA interrupt-controlled
ISR, shown in the following figure.
f() function
1
In1
0.8
Feedback Gain z
−2400
Integer Delay
.9
Delay Mix
1
Out1
Hardware Interrupt Triggered Task
In the next figure, you see a case where a function (LED Control) runs in the context of a hardware interrupt triggered task.
3-15
3
Project Generator
In this model, the Hardware Interrupt block installs a task that runs when it detects an external interrupt. This task performs the specified function with an LED.
3-16
Comparing Synchronous and Asynchronous Interrupt
Processing
Code generated for periodic tasks, both single- and multitasking, runs via a timer interrupt. A timer interrupt ensures that the generated code representing periodic-task model blocks runs at the specified period. The periodic interrupt clocks code execution at runtime. This periodic interrupt clock operates on a period equal to the base sample time of your model. You can use timer interrupts with:
Schedulers and Timing
• Generated code that incorporates DSP/BIOS real-time operating system
(RTOS)
• Generated code that does not include DSP/BIOS RTOS
Note In timer-based models, the timer counts through one full base-sample-time before it creates an interrupt. When Simulink software finally execute the model, it is for time 0.
The following figure shows the relationship between model startup and execution. Execution starts where your model executes the first interrupt, offset to the right of t=0 from the beginning of the time line. Before the first interrupt, the simulation goes through the timer set up period and one base rate period.
Timer setup period
Base rate period
Base rate period
Base rate period t=0.0
Base rate task execution time
Timer-based scheduling does not provide enough flexibility for some systems.
Systems for control and communications must respond to asynchronous events in real time. Such systems may need to handle a variety of hardware interrupts in an asynchronous, or aperiodic , fashion.
3-17
3
Project Generator
When you plan your project or algorithm, select your scheduling technique based on your application needs.
• If your application processes hardware interrupts asynchronously, add the appropriate asynchronous scheduling blocks from the library to your model:
-
A Hardware Interrupt block, to create an interrupt service routine to handle hardware interrupts on the selected processor
-
An Idle Task block, to create a task that runs as a separate thread
The following table lists specific scheduling blocks for each supported processor or family.
DSP Chip Library Support
C280x DSP/C28x3x DSP Chip
Support
C281x DSP Chip Support
C5000 Chip Support
C6000 Chip Support
Core Support
Scheduling Blocks
Hardware Interrupt
Hardware Interrupt
Hardware Interrupt
Hardware Interrupt
Idle Task
• Simulink sets the base rate priority to 40, the lowest priority.
• If your application does not service asynchronous interrupts, include only the algorithm and device driver blocks that specify the periodic sample times in the model.
Note Generating code from a model that does not service asynchronous interrupts automatically enables and manages a timer interrupt. The periodic timer interrupt clocks the entire model.
Using Synchronous Scheduling
Code that runs synchronously via a timer interrupt requires an interrupt service routine (ISR). Each model iteration runs after an ISR services a posted interrupt. The code generated for Embedded IDE Link CC uses a timer. To calculate the timer period, the software uses the following equation:
3-18
Schedulers and Timing
=
( _ _ ) * ( _
Low Resolu
_ _
_ )
*
Prescaler
The software configures the timer so that the base rate sample time for the coded process corresponds to the interrupt rate. Embedded IDE Link CC calculates and configures the timer period to ensure the desired sample rate.
Different processor families use the timer resource and interrupt number differently. Entries in the following table show the resources each family uses.
Processor
Family
C28x™
C55x™
C6000
C672x
Timer Resource Interrupt
Number
Timer 1
Timer 1
Timer 1
Timer 1
6
22
15
5
Simulink
Priority
40 for all processors
The minimum base rate sample time you can achieve depends on two factors—the algorithm complexity and the CPU clock speed. The maximum value depends on the maximum timer period value and the CPU clock speed.
If all the blocks in the model inherit their sample time value, and you do not define the sample time, Simulink assigns a default sample time of 0.2 second.
Using Asynchronous Scheduling
Embedded IDE Link CC enables you to model and automatically generate code for asynchronous systems. To do so, use the following scheduling blocks:
• Hardware Interrupt blocks for bare-board code generation mode
• Idle Task
The Hardware Interrupt block operates by
• Generating selected hardware interrupts for the processor
• Generating corresponding ISRs for the interrupts
3-19
3
Project Generator
• Connecting the ISRs to the corresponding interrupt service vector table entries
Note You are responsible for mapping and enabling the interrupts you specify in the block dialog box.
Connect the output of the Hardware Interrupt block to the control input of a function-call subsystem. By doing so, you enable the ISRs to call the generated subsystem code each time the hardware raises the interrupt.
The Idle Task block specifies one or more functions to execute as background tasks in the code generated for the model. The functions are created from the function-call subsystems to which the Idle Task block is connected.
Mapping and Enabling Interrupts in Generated Code
Although the scheduling blocks generate ISRs to respond to interrupts, they do not enable the interrupts in your code. The blocks also do not map the interrupts to the specific ISRs you specify in the block dialog boxes.
To enable and map the interrupt routines, you provide code that performs the mapping and enabling functions. ISR mapping and enabling code might look like following samples which enable and map interrupts 5 and 7:
IRQ_map(IRQ_EVT_EXTINT5,5); % Map interrupt 5 in the block to ext. int.5.
IRQ_set(IRQ_EVT_EXTINT5); % Enable interrupt 5.
IRQ_map(IRQ_EVT_EXTINT7,7); % Map interrupt 7 in the block to ext. int.7.
IRQ_set(IRQ_EVT_EXTINT7); % Enable interrupt 7.
The following figure shows the block dialog box that specifies the interrupts
3-20
Schedulers and Timing
One way to add the custom code to your generated code is to add a System
Outputs block to your model. In the System Outputs block, you add the code to enable and map the interrupts.
Real-Time Workshop includes the System Outputs block in the Custom Code library.
When you add the System Outputs block to your model and open the block dialog box, you see the following dialog box.
3-21
3
Project Generator
3-22
To enable and map the interrupts, add the code to the dialog box as shown in the following figure.
Schedulers and Timing
Generating code from your model that includes the System Outputs block adds the enabling and mapping code to your project so the interrupts work.
3-23
3
Project Generator
The following figure shows a top-level model c6000_hwi_interrupts that includes the System Outputs block in the Function-Call Subsystem2 submodel.
3-24
Multitasking Scheduler Examples
Embedded IDE Link CCEmbedded IDE Link MUEmbedded IDE Link VS provides a scheduler that supports multiple tasks running concurrently and preemption between tasks running at the same time. The ability to preempt running tasks enables a wide range of scheduling configurations.
Schedulers and Timing
Multitasking scheduling also means that overruns, where a task runs beyond its intended time, can occur during execution.
To understand these example, you must be familiar with the following scheduling concepts:
• Preemption is the ability of one task to pause the processing of a running task to run instead. With the multitasking scheduler, you can define a task as preemptible—thus, another task can pause (preempt) the task that allows preemption. The scheduler examples in this section that demonstrate preemption, illustrate one or more tasks allowing preemption.
• Overrunning occurs when a task does not reach completion before it is scheduled to run again. For example, overrunning can occur when a
Base-Rate task does not finish in 1 ms. Overrunning delays the next execution of the overrunning task and may delay execution of other tasks.
Examples in this section demonstrate a variety of multitasking configurations:
• “Three Odd-Rate Tasks Without Preemption and Overruns” on page 3-27
• “Two Tasks with the Base-Rate Task Overrunning, No Preemption” on page 3-28
• “Two Tasks with Sub-Rate 1 Overrunning Without Preemption” on page
• “Three Even-Rate Tasks with Preemption and No Overruns” on page 3-31
• “Three Odd-Rate Tasks Without Preemption and the Base and Sub-Rate1
• “Three Odd-Rate Tasks with Preemption and Sub-Rate 1 Task Overruns” on page 3-35
• “Three Even-Rate Tasks with Preemption and the Base-Rate and Sub-Rate
Each example presents either two or three tasks:
• Base Rate task. Base rate is the highest rate in the model or application.
The examples use a base rate of 1ms so that the task should execute every one millisecond.
3-25
3
Project Generator
• Sub-Rate 1. The first subrate task. Sub-Rate 1 task runs more slowly than the Base-Rate task. Sub-Rate 1 task rate is 2ms in the examples so that the task should execute every 2ms.
• Sub-Rate 2. In examples with three tasks, the second subrate task is called Sub-Rate 2. Sub-Rate 2 tasks run more slowly than Sub-Rate 1. In the examples, Sub-Rate 2 runs at either 4ms or 3ms.
-
When Sub-Rate 2 is 4ms, the example is called even.
-
When Sub-Rate 2 is 3ms, the example is called odd.
Note The odd or even naming only identifies Sub-Rate 2 as being 3 or 4ms.
It does not affect or predict the performance of the tasks.
The following legend applies to the plots in the next sections:
• Blue triangles ( ) indicate when the task started.
• Dark red areas ( ) indicate the period during which a task is running
• Pink areas ( ) within dark red areas indicate a period during which a running task is suspended—preempted by a task with higher priority
3-26
Schedulers and Timing
Three Odd-Rate Tasks Without Preemption and Overruns
In this three task scenario, all of the tasks run as scheduled. No overruns or preemptions occur.
Task Identification
Base-Rate
Sub-Rate 1
Sub-Rate 2
Intended Execution
Schedule
1ms
2ms
4ms
Actual Execution
Schedule
1ms
2ms
4ms
3-27
3
Project Generator
Two Tasks with the Base-Rate Task Overrunning, No
Preemption
In this two rate scenario, the Base-Rate overruns the 1ms time intended and prevents the subrate task from completing successfully or running every 2ms.
• Sub-Rate 1 does not allow preemption and fails to run when scheduled, but is never interrupted.
• The Base-Rate runs every 2ms and Sub-Rate 1 runs every 4ms instead of 2ms.
3-28
Schedulers and Timing
Task Identification
Base-Rate
Sub-Rate 1
Intended Execution
Schedule
1ms
2ms
Actual Execution
Schedule
2ms (overrunning)
4ms (overrunning)
3-29
3
Project Generator
Two Tasks with Sub-Rate 1 Overrunning Without Preemption
In this example, two rates running simultaneously—the Base-Rate task and one subrate task. Both the Base-Rate task and the Sub-Rate 1 task overrun.
• Base-Rate runs every 2ms instead of 1ms.
-
The Sub-Rate 1 task both overruns and is affected by the Base-Rate task overrunning.
-
The Base-Rate task overrun delays Sub-Rate 1 task execution by a factor of 4.
• Sub-Rate 1 runs every 8ms rather than every 2ms.
• The Base-Rate runs at 1ms.
• The Base-Rate task preempts Sub-Rate 1 when it tries to execute.
• The Sub-Rate 1 tasks overrun, taking up to 5ms to complete rather than
2ms.
3-30
Schedulers and Timing
Task Identification
Base-Rate
Sub-Rate 1
Intended Execution
Schedule
1ms
2ms
Actual Execution
Schedule
2ms (overrunning)
8ms (overrunning)
Three Even-Rate Tasks with Preemption and No Overruns
In the following three task scenario, the Base-Rate runs as scheduled and preempts Sub-Rate 1.
3-31
3
Project Generator
• Both the Base-Rate and Sub-Rate 1 tasks preempt Sub-Rate 2 task execution.
• Preempting the subrate tasks does not prevent the subrate tasks from running on schedule.
3-32
Task Identification
Base-Rate
Sub-Rate 1
Sub-Rate 2
Intended Execution
Schedule
1ms
2ms
3ms
Actual Execution
Schedule
1ms
2ms
6ms
Schedulers and Timing
Three Odd-Rate Tasks Without Preemption and the Base and
Sub-Rate1 Tasks Overrun
Three tasks running simultaneously—the Base-Rate task and two subrate tasks.
• Both the Base-Rate task and the Sub-Rate 1 task overrun.
• The Base-Rate task runs every 2ms instead of 1ms.
• Sub-Rate 1 and Sub-Rate 2 task execution is delayed by a factor of
2—Sub-Rate 1 runs every 4ms rather than every 2ms and Sub-Rate 2 runs every 6ms instead of 3ms.
3-33
3
Project Generator
Task Identification
Base-Rate
Sub-Rate 1
Sub-Rate 2
Intended Execution
Schedule
1ms
2ms
3ms
Actual Execution
Schedule
2ms (overrunning)
4ms (overrunning)
6ms (overrunning)
3-34
Schedulers and Timing
Three Odd-Rate Tasks with Preemption and Sub-Rate 1 Task
Overruns
In this three task scenario, the Base-Rate preempts Sub-Rate 1 which is overrunning.
• The overrunning subrate causes Sub-Rate 1 to execute every 4ms instead of 2ms.
• Every other fourth execution of Sub-Rate 2 does not occur.
• Instead of executing at t=0, 3, 6, 9, 12, 15, 18,…, Sub-Rate 2 executes at t=0, 3, 9, 12, 15, 21, and so on.
• The t=6 and t=18 instances do not occur.
3-35
3
Project Generator
Task Identification
Base-Rate
Sub-Rate 1
Sub-Rate 2
Intended Execution
Schedule
1ms
2ms
3ms
Actual Execution
Schedule
2ms (overrunning)
4ms (overrunning)
6ms (overrunning and skipping every other fourth execution)
3-36
Schedulers and Timing
Three Even-Rate Tasks with Preemption and the Base-Rate and Sub-Rate 1 Tasks Overrun
In this three-task scenario, two of the tasks overrun—the Base-Rate and
Sub-Rate 1.
• The overrunning Base-Rate executes every 2ms.
• Sub-Rate 1 overruns due to the Base-Rate overrun, doubling the execution rate.
• Also, Sub-Rate 1 is overrunning as well, doubling the execution rate again, from the intended 2ms to 8ms.
• Sub-Rate 2 responds to the overrunning Base-Rate and Sub-Rate 1 tasks by running every 16ms instead of every 4ms.
3-37
3
Project Generator
3-38
Task Identification
Base-Rate
Sub-Rate 1
Sub-Rate 2
Intended Execution
Schedule
1ms
2ms
3ms
Actual Execution
Schedule
2ms (overrunning)
8ms (overrunning)
16ms (overrunning)
Project Generator Tutorial
Project Generator Tutorial
In this section...
“Creating the Model” on page 3-40
“Adding the Target Preferences Block to Your Model” on page 3-40
“Specify Configuration Parameters for Your Model” on page 3-44
In this tutorial you build a model and generate a project from the model using
Embedded IDE Link CC software.
Note The model demonstrates project generation. You cannot not build and run the model on your processor without additional blocks.
To generate a project from a model, complete the following tasks:
1
Use Simulink blocks, Signal Processing Blockset™ blocks, and blocks from other blocksets to create the model application.
2
Add the Target Preferences block from the Embedded IDE Link CC Target
Preferences library to your model. Verify and set the block parameters for your hardware. In most cases, the default settings work fine.
If you are using a simulator processor, select Simulator on the Board
info pane of the Target Preferences block.
3
Set the configuration parameters for your model, including
• Solver parameters such as simulation start and solver options
• Real-Time Workshop software options such as processor configuration and processor compiler selection
4
Generate your project.
5
Review your project in CCS.
3-39
3
Project Generator
Creating the Model
To create the model for audio reverberation, follow these steps:
1
Start Simulink software.
2
Create a new model by selecting File > New > Model from the Simulink menu bar.
3
Use Simulink blocks and Signal Processing Blockset blocks to create the following model.
Look for the Integer Delay block in the Discrete library of Simulink blocks and the Gain block in the Commonly Used Blocks library. Do not add the
Custom Board block at this time.
4
Save your model with a suitable name before continuing.
Adding the Target Preferences Block to Your Model
So that you can configure your model to work with TI processors, Embedded
IDE Link CC includes a block library containing a Target Preferences block for Texas Instruments processors:
• Target Preferences
Entering ccslinklib_tgtpref at the MATLAB software prompt opens this window showing the library blocks. This block library is included in Embedded
IDE Link CC ccslinklib blockset in the Simulink Library browser.
3-40
Project Generator Tutorial
Adding a Target Preferences block to a model triggers a dialog box that asks about your model configuration settings. The message tells you that the model configuration parameters will be set to default values based on the processor specified in the block parameters. To set the parameters automatically, click
Yes. Clicking No dismisses the dialog box and does not set the parameters.
When you click Yes, the software sets the system target file to ccslink_ert.stf
and sets the hardware options and product-specific parameters in the model to default values. If you open the model
Configuration Parameters, you see the Embedded IDE Link CC pane option on the select tree.
Clicking No prevents the software from setting the system target file and the product specific options. When you open the model Configuration Parameters for your model, you do not see the Embedded IDE Link CC pane option on the select tree. To enable the options, select the ccslink_ert.stf
or
3-41
3
Project Generator ccslink_grt.stf
system target file from the System Target File list in the
Real-Time Workshop pane options.
To add the Target Preferences block to your model, follow these steps:
1
Double-click Embedded IDE Link CC in the Simulink Library browser to open the ccslinklib blockset.
2
Double-click the library Target Preferences to see the blocks available for your processor.
3
Drag and drop the Custom Board block to your model as shown in the following model window figure.
4
Double-click the Custom Board block in the model to open the block dialog box.
3-42
Project Generator Tutorial
5
In the Block dialog box, select your processor from the Processor list.
6
Verify the CPU clock value and, if you are using a simulator, select
Simulator.
3-43
3
Project Generator
7
Verify the settings on the Memory and Sections tabs to be sure they are correct for the processor you selected.
8
Click OK to close the Target Preferences dialog box.
You have completed the model. Now configure the model configuration parameters to generate a project in CCS IDE from your model.
Specify Configuration Parameters for Your Model
The following sections describe how to configure the build and run parameters for your model. Generating a project, or building and running a model on the processor, starts with configuring model options in the Configuration
Parameters dialog box in Simulink software.
Setting Solver Parameters
After you have designed and implemented your digital signal processing model in Simulink software, complete the following steps to set the configuration parameters for the model:
1
Open the Configuration Parameters dialog box and set the appropriate options on the
Solver category for your model and for Embedded IDE Link
CC.
• Set Start time to
0.0
and Stop time to inf
(model runs without stopping). If you set a stop time, your generated code does not honor the setting. Set this to inf for completeness.
• Under Solver options, select the fixed-step and discrete settings from the lists
• Set the Fixed step size to
Auto and the Tasking Mode to
Single
Tasking
Note Generated code does not honor Simulink software stop time from the simulation. Stop time is interpreted as inf
. To implement a stop in generated code, add a Stop Simulation block in your model.
3-44
Project Generator Tutorial
Ignore the
Data Import/Export
,
Diagnostics
, and
Optimization categories in the Configuration Parameters dialog box. The default settings are correct for your new model.
Setting Real-Time Workshop Code Generation Parameters
To configure Real-Time Workshop software to use the correct processor files and to compile and run your model executable file, set the options in the
Real-Time Workshop category of the Select tree in the Configuration
Parameters dialog box. Follow these steps to set the code generation options for your DSP:
1
Select
Real-Time Workshop on the Select tree.
2
In processor selection
, click Browse to select the system target file for Embedded IDE Link CCcode generation — ccslink_grt.tlc
. It may already be the selected processor.
Clicking Browse opens the System Target File Browser to allow you to changes the system target file.
3
On the System Target File Browser, select the system target file ccslink_grt.tlc
and click OK to close the browser.
Setting Embedded IDE Link CC Parameters
To configure Real-Time Workshop software to use the correct code generation options and to compile and run your model executable file, set the options in the
Embedded IDE Link CC category of the Select tree in the Configuration
Parameters dialog box. Follow these steps to set the code generation options for your processor:
1
From the Select tree, choose
Embedded IDE Link CC to specify code generation options that apply to the C6711 DSK processor.
2
Set the following options in the pane under Project options:
• Project options should be Custom
.
• Set Compiler options string and Linker options string should be blank.
3-45
3
Project Generator
3
Under Code Generation, select Inline run-time library functions.
Clear the other options.
4
Under Link Automation, verify that Export IDE link handle to base
workspace is selected and provide a name for the handle in IDE handle
name (optional).
5
Set Byte ordering to
Little endian
.
6
Change the category back to
Embedded IDE Link CC
.
7
Set the following Runtime options:
• Build action: Create_project
.
• Interrupt overrun notification method: None
.
8
Change the category on the Select tree to
Hardware Implementation
.
Simulink
You have configured the Real-Time Workshop software options that let you generate a project for you processor. You may have noticed that you did not configure a few categories on the Select tree, such as
Comments
,
Symbols
, and
Optimization
.
For your new model, the default values for the options in these categories are correct. For other models you develop, you may want to set the options in these categories to provide information during the build and to run TLC debugging when you generate code. Refer to your Simulink and Real-Time
Workshop documentation for more information about setting the configuration parameters.
Building Your Project
After you set the configuration parameters and configure Real-Time Workshop software to create the files you need, you direct the build process to create your project:
1
Press OK to close the Configuration Parameters dialog box.
2
Click Ctrl+B to generate your project into CCS IDE.
3-46
Project Generator Tutorial
When you click Build with
Create_project selected for Build action, the automatic build process starts CCS IDE and populates an new project in the development environment.
3
To stop model execution, use the Halt option in CCS. You could enter halt at the MATLAB command prompt as well.
3-47
3
Project Generator
Setting Code Generation Parameters for TI Processors
Before you generate code with Real-Time Workshop software, set the fixed-step solver step size and specify an appropriate fixed-step solver if the model contains any continuous-time states. At this time, you should also select an appropriate sample rate for your system. Refer to your Real-Time
Workshop User’s Guide documentation for additional information.
Note Embedded IDE Link CC does not support continuous states in
Simulink software models for code generation. In the Solver options in the Configuration Parameters dialog box, you must select
Discrete (no continuous states) as the Type, along with
Fixed step
.
The
Real-Time Workshop pane of the Configuration Parameters dialog box lets you set numerous options for the real-time model. To open the
Configuration Parameters dialog box, select Simulation > Configuration
Parameters from the menu bar in your model.
The following figure shows the configuration parameters categories when you are using Embedded IDE Link CC.
3-48
Setting Code Generation Parameters for TI Processors
In the Select tree, the categories provide access to the options you use to control how Real-Time Workshop software builds and runs your model. The first categories under
Real-Time Workshop in the tree apply to all Real-Time
Workshop software processors. They always appear on the list.
The last category under
Real-Time Workshop is specific to the Embedded
IDE Link CC system target files ccslink_grt.tlc
and ccslink_ert.tlc
and appear when you select either file.
When you select your processor file in
Target Selection on the Real-Time
Workshop pane, the options change in the tree.
For Embedded IDE Link CC, the processor to select is ccslink_grt.tlc
.
Selecting either the ccslink_grt.tlc
or ccslink_ert.tlc
adds the
Embedded IDE Link CC options to the Select tree. The ccslink_grt.tlc
file is appropriate for all projects. Select ccslink_ert.tlc
when you are developing projects or code for embedded processors (requires Real-Time
Workshop Embedded Coder software) or you plan to use Processor-in-the-Loop
features.
3-49
3
Project Generator
The following sections present each configuration parameters Select tree category and the relevant options available in each.
3-50
Setting Model Configuration Parameters
Setting Model Configuration Parameters
In this section...
“Target File Selection” on page 3-52
“Custom Storage Class” on page 3-53
“Debug Pane Parameters” on page 3-54
“Optimization Pane Parameters” on page 3-55
“Embedded IDE Link CC Pane Parameters” on page 3-57
“Embedded IDE Link CC Default Project Configuration — Custom” on page 3-64
Use the options in the Select tree under Real-Time Workshop to perform the following configuration tasks.
• Select your processor file.
• Configure your build process.
• Specify whether to use custom storage classes.
Selecting the system target ( ccslink_grt.tlc
or ccslink_ert.tlc
) in
System target file enables Embedded IDE Link CC configuration options in the Embedded IDE Link CC pane.
3-51
3
Project Generator
3-52
Target File Selection
System target file
Clicking Browse opens the processor File Browser where you select ccslink_grt.tlc
as your
Embedded IDE Link CC.
Real-Time Workshop
System target file for
If you are using Real-Time Workshop Embedded Coder software or plan to use PIL, select the ccslink_ert.tlc
processor in System target file.
Setting Model Configuration Parameters
Build Process
Embedded IDE Link CC software does not use makefiles or the build process to generate code. Code generation is project based so the options in this group do not apply.
Custom Storage Class
When you generate code from a model employing custom storage classes
(CSC), make sure to clear Ignore custom storage classes. This setting is the default value for Embedded IDE Link CC and for Real-Time Workshop
Embedded Coder.
When you select Ignore custom storage classes,
• Objects with CSCs are treated as if you set their storage class attribute to
Auto
.
• The storage class of signals that have CSCs does not appear on the signal line, even when you select
Storage class from Format > Port/Signals
Display in your Simulink menus.
Ignore custom storage classes lets you switch to a processor that does not support CSCs, such as the generic real-time processor (GRT), without having to reconfigure your parameter and signal objects.
Generate code only
The Generate code only option does not apply to generating code with
Embedded IDE Link CC. To generate source code without building and executing the code on your processor, select
Embedded IDE Link CC from the
Select tree. Then, under Runtime, select
Create project for Build action.
You cannot use DSP/BIOS features when you use the
Create project option for the Build action.
Report Options
Two options control HTML report generation during code generation.
• “Create Code Generation report” on page 3-54
• “Launch report automatically” on page 3-54
3-53
3
Project Generator
Create Code Generation report
After you generate code, this option tells the software whether to generate an HTML report that documents the C code generated from your model.
When you select this option, Real-Time Workshop writes the code generation report files in the html subdirectory of the build directory. The top-level HTML report file is named
modelname_codegen_rpt.html
or
subsystemname_codegen_rpt.html
. For more information about the report, refer to the online help for Real-Time Workshop. You can also use the following command at the MATLAB prompt to get more information.
docsearch 'Create code generation report'
In the Navigation options, when you select Model-to-code and
Code-to-model, your HTML report includes hyperlinks to various features in your Simulink model.
Launch report automatically
This option directs Real-Time Workshop to open a MATLAB Web browser window and display the code generation report. If you clear this option, you can open the code generation report (
modelname_codegen_rpt.html
or
subsystemname_codegen_rpt.html
) manually in a MATLAB Web browser window or in another Web browser.
Debug Pane Parameters
Real-Time Workshop uses the processor Language Compiler (TLC) to generate C code from the
model.rtw
file. The TLC debugger helps you identify programming errors in your TLC code. Using the debugger, you can
• View the TLC call stack.
• Execute TLC code line-by-line and analyze and/or change variables in a specified block scope.
When you select
Debug from the Select tree, you see the
Debug options as shown in the next figure. In this dialog box, you set options that are specific to
Real-Time Workshop process and TLC debugging.
3-54
Setting Model Configuration Parameters
For details about using the options in
Debug
, refer to “About the TLC
Debugger” in your Real-Time Workshop processor Language Compiler documentation.
Optimization Pane Parameters
On the
Optimization pane in the Configuration Parameters dialog box, you set options for the code that Real-Time Workshop generates during the build process. You use these options to tailor the generated code to your needs.
Select
Optimization from the Select tree on the Configuration Parameters dialog box. The figure shows the
Optimization pane when you select the system target file ccslink_grt.tlc
under Real-Time Workshop system
target file.
3-55
3
Project Generator
3-56
These are the options typically selected for Real-Time Workshop:
• Conditional input branch execution
• Signal storage reuse
• Enable local block outputs
• Reuse block outputs
• Eliminate superfluous local variables (Expression folding)
• Loop unrolling threshold
• Optimize initialization code for model reference
For more information about using these and the other
Optimization options, refer to your Real-Time Workshop documentation.
Setting Model Configuration Parameters
Embedded IDE Link CC Pane Parameters
On the select tree, the Embedded IDE Link CC entry provides options in these areas:
• Runtime — Set options for run-time operations, like the build action
• Project Options — Set build options for your project code generation
• Code Generation — Configure your code generation requirements
• Link Automation — Export a ticcs object to your MATLAB workspace
• Diagnostic options — Determine how the code generation process responds when you use source code replacement, either in the Target
Preferences block Board custom code options, or in the Real-Time
Workshop Custom Code options in the configuration parameters.
Runtime Options
Before you are able to an executable to run on any Texas Instruments processor, you must configure the run-time options for the source model.
By selecting values for the options available, you configure the operation of your processor.
Build action
To specify to Real-Time Workshop software what to do when you click Build, select one of the following options. The actions are cumulative—each listed action adds features to the previous action on the list and includes all the previous features:
• Generate_code_only
— Directs Real-Time Workshop software to generate
ANSI C code only from the model. It does not use the Texas Instruments software tools, such as the compiler and linker, and you do not need to have
CCS installed. Also, MATLAB software does not create the connection to
CCS that results from the other options. This option does not build code for
TI processors. You cannot use this option when you set the system target file to either ccslink_grt.tlc
or ccslink_ert.tlc
.
The build process for a model also generates the files modelname
.
c
, modelname.cmd
, modelname.bld
, and many others. It puts the files in a build directory named modelname_linkforccs_rtw in your MATLAB
3-57
3
Project Generator working directory. This file set contains many of the same files that
Real-Time Workshop software generates to populate a CCS project when you choose
Create_Project for the build action.
• Create_Project
— Directs Real-Time Workshop software to start CCS and populate a new project with the files from the build process. This option offers a convenient way to build projects in CCS.
• Archive_library
— Directs Real-Time Workshop software to archive the project for this model. Use this option when you plan to use the model in a model reference application. Model reference requires that you archive your CCS projects for models that you use in model referencing.
• Build
— Builds the executable COFF file, but does not download the file to the processor.
• Build_and_execute
— Directs Real-Time Workshop software to build, download, and run your generated code as an executable on your processor.
• Create_processor_in_the_loop_project
— Directs the Real-Time
Workshop code generation process to create PIL algorithm object code as part of the project build.
Your selection for Build action determines what happens when you click
Build or press Ctrl+B. Your selection tells Real-Time Workshop software when to stop the code generation and build process.
To run your model on the processor, select
Build_and_execute
. This selection is the default build action; Real-Time Workshop software automatically downloads and runs the model on your board.
Note When you build and execute a model on your processor, the Real-Time
Workshop software build process resets the processor automatically. You do not need to reset the board before building models.
Interrupt overrun notification method
To enable the overrun indicator, choose one of three ways for the processor to respond to an overrun condition in your model:
•
None
— Ignore overruns encountered while running the model.
3-58
Setting Model Configuration Parameters
• Print_message
— When the DSP encounters an overrun condition, it prints a message to the standard output device, stdout
.
• Call_custom_function
— Respond to overrun conditions by calling the custom function you identify in Interrupt overrun notification
function.
Maximum time allowed to build project (s)
Specifies how long, in seconds, the software waits for the project build process to return a completion message. 1000 s is the default to allow extra time to complete project builds and code generation.
Interrupt overrun notification function
When you select
Call_custom_function from the Interrupt overrun
notification method list, you enable this option. Enter the name of the function the processor should use to notify you that an overrun condition occurred. The function must exist in your code on the processor.
Overrun Indicator and Software-Based Timer
Embedded IDE Link CC includes software that generates interrupts in models that do not have ADC or DAC blocks, or that use multiple clock rates.
In the following cases, the overrun indicator does not work:
• In multirate systems where the rate in the model is not the same as the base clock rate for your model. In these cases, the timer in Embedded IDE
Link CC provides the interrupts for setting the model rate.
• In models that do not include ADC or DAC blocks, the timer in Embedded
IDE Link CC provides the software interrupts that drive model processing.
Project Options
Before you run your model as an executable on any processor, you must configure the Project options for the model. The default setting is
Custom
, which does not use any optimization flags.
3-59
3
Project Generator
Compiler options string
To determine the degree of optimization provided by the TI optimizing compiler, enter the optimization level to apply to files in your project.
For details about the compiler options, refer to your CCS documentation.
When you create new projects, Embedded IDE Link CC does not set any optimization flags.
Click Get From IDE to import the compiler option setting from the current project in the IDE. To reset the compiler option to the default value, click
Reset.
Linker options string
To specify the options provided by the TI linker during link time, you enter the linker options as a string. For details about the linker options, refer to your CCS documentation. When you create new projects, Embedded IDE Link
CC does not set any linker options.
Click Get From IDE to import the linker options string from the current project in the IDE. To reset the linker options to the default value of no options, click Reset.
System stack size (MAUs)
Enter the amount of memory to use for the stack. For more information, refer to Enable local block outputs on the Optimization pane of the
Configuration Parameters dialog box. Block output buffers are placed on the stack until the stack memory is fully allocated. After that, the output buffers go in global memory. Also refer to the online Help system for more information about Real-Time Workshop options for configuring and building models and generating code.
Code Generation
From this category, you select options that define the way your code is generated:
• Profile real-time task execution
• Inline run-time library functions
3-60
Setting Model Configuration Parameters
To enable the real-time execution profile capability, select Profile real-time
task execution. With this selected, the build process instruments your code to provide performance profiling at the task level or for atomic subsystems.
When you run your code, the executed code reports the profiling information in an HTML report.
To allow you to specify whether the functions generated from blocks in your model are used inline or by pointers, Inline run-time library functions tells the compiler to inline each Signal Processing blockset and Video and
Imaging blockset function. Inlining functions can make your code run more efficiently (better optimized) at the expense of using more memory.
As shown in the following figure, the default setting uses inlining to optimize your generated code.
3-61
3
Project Generator
3-62
When you inline a block function, the compiler replaces each call to a block function with the equivalent function code from the static run-time library.
If your model use the same block four times, your generated code contains four copies of the function.
While this redundancy uses more memory, inline functions run more quickly than calls to the functions outside the generated code.
Link Automation
When you use Real-Time Workshop to build a model to a C6000 processor,
Embedded IDE Link CC makes a connection between MATLAB software and CCS.
Setting Model Configuration Parameters
If you have used Embedded IDE Link CC, you are familiar with function ticcs
, which creates objects the reference between the IDE and MATLAB.
This option refers to the same object, called cc in the function reference pages.
Although MATLAB to CCS is a bridge to a specific instance of the CCS IDE, it is an object that contains information about the IDE instance it refers to, such as the board and processor it accesses. In this pane, the Export IDE link
handle to base workspace option lets you instruct Embedded IDE Link
CC to export the object to your MATLAB workspace, giving it the name you assign in IDE link handle name.
Maximum time to complete IDE operations (s)
Specifies how long the software waits for IDE functions, such as read or write
, to return completion messages.
Diagnostic Option
Source file replacement selects the diagnostic action to take if the software detects conflicts when you replace source code with custom code. The diagnostic message responds to both source file replacement in the Embedded
IDE Link CC parameters and in the Real-Time Workshop Custom code parameters in the configuration parameters for your model.
The following settings define the messages you see and how the code generation process responds:
• none
— Does not generate warnings or errors when it finds conflicts.
• warning
— Displays a warning.
warn is the default value.
• error
— Terminates the build process and displays an error message that identifies which file has the problem and suggests how to resolve it.
The build operation continues if you select warning and the software detects custom code replacement problems. You see warning messages as the build progresses
Select error the first time you build your project after you specify custom code to use. The error messages can help you diagnose problems with your custom
3-63
3
Project Generator code replacement files. Use none when the replacement process is correct and you do not want to see multiple messages during your build.
Embedded IDE Link CC Default Project Configuration
— Custom
Although CCS offers two standard project configurations,
Release and
Debug
, models you build with Embedded IDE Link CC use a custom configuration that provides a third combination of build and optimization settings—
Custom
.
Project configurations define sets of project build options. When you specify the build options at the project level, the options apply to all files in your project. For more information about the build options, refer to your TI CCS documentation.
The default settings for
Custom are the same as the
Release project configuration in CCS, except for the compiler options discussed in the next section.
Compiler Options in Custom Project Configuration
When you create a new project or build a project from a model, your project and model inherit the build configuration settings from the configuration
Custom
. The compiler settings in
Custom differ from the settings in the default
Release and
Debug configurations in CCS.
For the compiler settings,
Custom does not use any options, to preserve important features of the generated code. The
Release configuration uses the
Release build optimizations set by CCS, with the addition of the
-o2 optimization flag. The
Debug configuration uses the CCS default debugging options and adds the
-g
,
-d
, and
_DEBUG flags.
For memory configuration, where
Release uses the default memory model that specifies near functions and data,
Custom specifies far functions and data. Your CCS documentation provides complete details on the compiler build options.
You can change the individual settings or the build configuration within CCS.
Build configuration options that do not appear on these panes default to match the settings for the
Release build configuration in CCS.
3-64
Using Custom Source Files in Generated Projects
Using Custom Source Files in Generated Projects
In this section...
“Preparing to Replace Generated Files With Custom Files” on page 3-65
“Replacing Generated Source Files with Custom Files When You Generate
The Board custom code options on the Board Info pane in the model’s
Target Preferences block enable you to replace a generated file with a custom file you provide. By replacing a file, you can modify the output of the code generation process to suit your needs. For file replacement during the code generation process to work, your custom file must have the same name as the file to replace.
The following sections show you how to:
• Identify the file to replace — “Preparing to Replace Generated Files With
• Create the custom replacement file — “Preparing to Replace Generated
Files With Custom Files” on page 3-65
• Configure the target preferences to use the custom file when you generate
a project — “Replacing Generated Source Files with Custom Files When
You Generate Code” on page 3-67
For more information about the target preferences and the Board custom code options, refer to Target Preferences in the online Help system.
Preparing to Replace Generated Files With Custom
Files
To change the content of a generated project, use custom code replacement replace a generated file in the project. By replacing a generated file in a project, you can make changes like the following in your generated project:
• Edit the file that contains linker directives to change the linking process, such as mapping memory differently.
3-65
3
Project Generator
.
• Modify a library file, such as a chip support library ( .csl
file)
• Add commands to a header file
• Modify data in a data file
• Add comments to a file for tracking or identifying the file or project
Determining the Name of the File to Replace
To replace a file created when you generate a project, you need the name of the file to replace; the content to change; and the replacement file, including the path to the file. Your model must include a target preferences block configured for your processor, either a simulator or hardware.
Custom code replacement lets you customize the behavior of the linker by replacing or editing the generated file that contains linker directives.
When you replace or update the linker directives for building your project,
Embedded IDE Link CC stores the linker directives in the file modelname.cmd
.
Follow these steps to identify the file to replace in a project:
1
Open the configuration parameters for your model.
2
On the Select tree in the Configuration Parameter dialog box, select
Embedded IDE Link CC.
3
Set Build action to any entry on the list except
Create processor-in-the-loop project
.
4
Click OK to close the dialog box.
5
Press Ctrl+B to build your model.
6
Look at the files in the project in the IDE. Find the file that contains the information to supplement or replace.
The build process stores the project files in the directory modelname_ccslink in your MATLAB working directory, and shows the project directory information in the MATLAB Command window.
3-66
Using Custom Source Files in Generated Projects
The build process stores the project files in the directory modelname_multilink in your MATLAB working directory, and shows the project directory information in the MATLAB Command window.
The build process stores the project files in the directory modelname_vdsplink in your MATLAB working directory, and shows the project directory information in the MATLAB Command window.
7
Note the file name and location. You use this information to create your custom replacement file.
Creating the Replacement File
To replace a file in a project during code generation, you need a new file with the same name saved in a different directory. Creating your replacement file from the file to replace increases the chances that the generated code will work properly with the new file. The new file must have all of the information the final project needs.
Follow these steps to create a file to use to replace a generated file in your project.
1
2
Locate the file to replace. Copy the file and save it with the same name in a new directory.
3
Open your new file and edit the file to add or remove the information to change.
4
Save your changes to the file.
Replacing Generated Source Files with Custom Files
When You Generate Code
With the replacement file and location available, configure the build process to use your replacement file. Parameters on the Target Preferences block dialog box allow you to specify the replacement file to use. For more information about the board custom code options, refer to Target PreferencesTarget
PreferencesTarget Preferences.
3-67
3
Project Generator
Follow these steps to configure the build process to use a replacement file.
1
Double-click Target Preferences in your model. The block dialog box opens as shown in the following figure.
3-68
Using Custom Source Files in Generated Projects
2
In the Board custom code options, select the type of file to replace—
Source files or
Libraries
.
3
Enter the name of your replacement file and path in the text field.
The build process recognizes two directory path tokens:
• $MATLAB to refer to your MATLAB root directory
• $install_dir to refer to the root of your IDE installation.
4
Click OK to close the dialog box.
5
Open the configuration parameters for your model and select the Build
action to use to build your model.
6
From the Source code replacement list, select warning or error to see messages when the build process replaces files.
7
Click OK to save your configuration.
8
Return to the model window and press Ctrl+B to build your project. The generated project contains your replacement file instead of generating the matching file.
3-69
3
Project Generator
Optimizing Embedded Code with Target Function Libraries
In this section...
“About Target Function Libraries and Optimization” on page 3-70
“Using a Processor-Specific Target Function Library to Optimize Code” on page 3-72
“Process of Determining Optimization Effects Using Real-Time Profiling
“Reviewing Processor-Specific Target Function Library Changes in
“Reviewing Target Function Library Operators and Functions” on page 3-76
“Creating Your Own Target Function Library” on page 3-76
About Target Function Libraries and Optimization
A target function library is a set of one or more function tables that define processor- and compiler-specific implementations of functions and arithmetic operators. The code generation process uses these tables when it generates code from your Simulink model.
The Embedded IDE Link CCsoftware registers processor-specific target function libraries during installation. To use one of the libraries, select the set of tables that correspond to functions implemented by intrinsics or assembly code for your processor from the Target function library list in the model configuration parameters.
After you select the processor-specific library, the model build process uses the library contents to optimize generated code for that processor. The generated code includes processor-specific implementations for sum
, sub
, mult
, and div
, and various functions, such as tan or abs
, instead of the default ANSI ®
C instructions and functions. The optimized code enables your embedded application to run more efficiently and quickly, and in many cases, reduces the size of the code. For more information about target function libraries, refer to “Introduction to Target Function Libraries” in the Real-Time Workshop
Embedded Coderdocumentation.
3-70
Optimizing Embedded Code with Target Function Libraries
Code Generation Using the Target Function Library
The build process begins by converting your model and its configuration set to an intermediate form that reflects the blocks and configurations in the model.
Then the code generation phase starts.
Note Real-Time Workshop refers to the following conversion process as replacement and it occurs before the build process generates a project.
During code generation for your model, the following process occurs:
1
Code generation encounters a call site for a function or arithmetic operator and creates and partially populates a target function library entry object.
2
The entry object queries the target function library database for an equivalent math function or operator. The information provided by the code generation process for the entry object includes the function or operator key, and the conceptual argument list.
3
The code generation process passes the target function library entry object to the target function library.
4
If there is a matching table entry in the target function library, the query returns a fully-populated target function library entry to the call site, including the implementation function name, argument list, and build information
5
The code generation process uses the returned information to generate code.
Within the target function library that you select for your model, the software searches the tables that comprise the library. The search occurs in the order in which the tables appear in either the Target Function Library Viewer or the Target function library tool tip. For each table searched, if the search finds multiple matches for a target function library entry object, priority level determines the match to return. The search returns the higher-priority
(lower-numbered) entry.
3-71
3
Project Generator
For more information about target function libraries in the build process, refer to “Introduction to Target Function Libraries” in the Real-Time Workshop
Embedded Coderdocumentation.
Using a Processor-Specific Target Function Library to
Optimize Code
As a best practice, you should select the appropriate target function library for your processor after you verify the ANSI C implementation of your project.
Note Do not select the processor-specific target function library if you use your executable application on more than one specific processor. The operator and function entries in a library may work on more than one processor within a processor family. The entries in a library usually do not work with different processor families.
To use target function library for processor-specific optimization when you generate code, you must install Real-Time Workshop Embedded Coder software. Your model must include a Target Preferences block configured for you intended processor.
Perform the following steps to select the target function library for your processor:
1
Select Simulation > Configuration Parameters from the model menu bar. The Configuration Parameters dialog box for your model opens.
2
On the Select tree in the Configuration Parameters dialog box, choose
Real-Time Workshop.
3
Use Browse to select ccslink_ert.tlc
as the System target file.
4
On the Select tree, choose Interface.
5
On the Target function library list, select the processor family that matches your processor. Then, click OK to save your changes and close the dialog box.
3-72
Optimizing Embedded Code with Target Function Libraries
With the target function library selected, your generated code uses the specific functions in the library for your processor.
To stop using a processor-specific target function library, open the
Interface pane in the model configuration parameters. Then, select the
C89/C90
(ANSI) library from the Target function library list.
Process of Determining Optimization Effects Using
Real-Time Profiling Capability
You can use the real-time profiling capability to examine the results of applying the processor-specific library functions and operators to your generated code. After you select a processor-specific target function library, use the real-time execution profiling capability to examine the change in program execution time.
Use the following process to evaluate the effects of applying a processor-specific target function library when you generate code:
1
Enable real-time profiling in your model. Refer to “Real-Time Execution
Profiling” on page 4-11 in the online Help system.
2
Generate code for your project using the default target function library
C89/C90 ANSI
.
3
Profile the code, and save the report.
4
Rebuild your project using a processor-specific target function library instead of the
C89/C90 ANSI library.
5
Profile the code, and save the second report.
6
Compare the profile report from running your application with the processor-specific library selected to the profile results with the ANSI library selected in the first report.
For a demonstration of verifying the code optimization, refer to the Embedded
IDE Link CC demos. Review the demo Optimizing Embedded Code via Target
Function Library.
3-73
3
Project Generator
Reviewing Processor-Specific Target Function Library
Changes in Generated Code
Use one of the following techniques or tools to see the target function library elements where they appear in the generated code:
• Use Model-to-Code Tracing to navigate from blocks in your model to the
code generated from the block.
• Use a File Differencing Scheme to compare projects that you generate
before and after you select a processor-specific target function library.
Reviewing Code Manually
To see where the generated code uses target function library replacements, review the file
modelname.c
. Look for code similar to the following statement codeopt_tfl_B.Sum6[j] = ldexp((real_T)Sum[j], -11) + ldexp((real_T) c62x_mul_s32_s32_s32_sr_sat(codeopt_tfl_P.Gain5_Gain, UnitDelay[j], 6),
The function c62x_mul_s32_s32_s32_sr_sat is the multiply implementation function registered in the TI C62x target function library. In this example, the function performs an optimized multiplication operation. Similar functions appear for add
, and sub
. For more information about the arguments in the function, refer to “Introduction to Target Function Libraries” in the online
Help system.
Using Model-to-Code Tracing
You can use the model-to-code report options in the configuration parameters to trace the code generated from any block with target function library. After you create your model and select a target function library, follow these steps to use the report options to trace the generated code:
1
Open the model configuration parameters.
2
Select
Report from the Select tree.
3
In the
Report pane, select Create code generation report and
Model-to-code, and then save your changes.
3-74
Optimizing Embedded Code with Target Function Libraries
4
Press Ctrl+B to generate code from your model.
The Real-Time Workshop Report window opens on your desktop. For more information about the report, refer to “Creating and Using a
Code Generation Report” in the Real-Time Workshop Embedded Coder documentation.
5
Use model-to-code highlighting to trace the code generated for each block with target function library applied:
• Right-click on a block in your model and select Real-Time
Workshop > Navigate to code from the context menu.
• Select Navigate-to-code to highlight the code generated from the block in the report window.
Inspect the code to see the target function operator in the generated code.
For more information, refer to “Tracing Code Generated Using Your
Target Function Library” in the Real-Time Workshop Embedded Coder documentation in the online Help system.
If a target function library replacement did not occur as you expected, use the techniques described in “Examining and Validating Function Replacement
Tables” in the Real-Time Workshop Embedded Coder documentation to help you determine why the build process did not use the function or operator.
Using a File Differencing Scheme
You can also review the target function library induced changes in your project by comparing projects that you generate both with and without the processor-specific target function library.
1
Generate your project with the default
C89/C90 ANSI target function library. Use
Create Project
,
Archive Library
, or
Build for the Build
action in the
Embedded IDE Link CC options.
2
Save the project to a new name— newproject1
.
3
Go back to the configuration parameters for your model, and select a target function library appropriate for your processor.
4
Regenerate your project.
3-75
3
Project Generator
5
Save the project with a new name— newproject2
6
Compare the contents of the
modelname.c
files from newproject1 and newproject2
. The differences between the files show the target function library induced code changes.
Reviewing Target Function Library Operators and
Functions
Real-Time Workshop Embedded Coder software provides the Target Function
Library viewer to enable you to review the arithmetic operators and functions registered in target function library tables.
To open the viewer, enter the following command at the MATLAB prompt.
RTW.viewTfl
For details about using the target function library viewer, refer to “Selecting and Viewing Target Function Libraries” in the online Help system.
Creating Your Own Target Function Library
For details about creating your own library, refer to the following sections in your Real-Time Workshop Embedded Coder documentation:
• “Introduction to Target Function Libraries”
• “Creating Function Replacement Tables”
• “Examining and Validating Function Replacement Tables”
3-76
Model Reference and Embedded IDE Link™ CC
Model Reference and Embedded IDE Link CC
Model reference lets your model include other models as modular components.
This technique provides useful features because it:
• Simplifies working with large models by letting you build large models from smaller ones, or even large ones.
• Lets you generate code once for all the modules in the entire model and only regenerate code for modules that change.
• Lets you develop the modules independently.
• Lets you reuse modules and models by reference, rather than including the model or module multiple times in your model. Also, multiple models can refer to the same model or module.
Your Real-Time Workshop documentation provides much more information about model reference.
How Model Reference Works
Model reference behaves differently in simulation and in code generation. For this discussion, you need to know the following terms:
• Top model — The root model block or model. It refers to other blocks or models. In the model hierarchy, this is the topmost model.
• Referenced models — Blocks or models that other models reference, such as models the top model refers to. All models or blocks below the top model in the hierarchy are reference models.
The following sections describe briefly how model reference works. More details are available in your Real-Time Workshop documentation in the online Help system.
Model Reference in Simulation
When you simulate the top model, Real-Time Workshop software detects that your model contains referenced models. Simulink software generates code for the referenced models and uses the generated code to build shared library files for updating the model diagram and simulation. It also creates
3-77
3
Project Generator an executable (a MEX file, .
mex
) for each reference model that is used to simulate the top model.
When you rebuild reference models for simulations or when you run or update a simulation, Simulink software rebuilds the model reference files. Whether reference files or models are rebuilt depends on whether and how you change the models and on the Rebuild options settings. You can access these setting through the Model Reference pane of the Configuration Parameters dialog box.
Model Reference in Code Generation
Real-Time Workshop software requires executables to generate code from models. If you have not simulated your model at least once, Real-Time
Workshop software creates a .
mex file for simulation.
Next, for each referenced model, the code generation process calls make_rtw and builds each referenced model. This build process creates a library file for each of the referenced models in your model.
After building all the referenced models, Real-Time Workshop software calls make_rtw on the top model, linking to all the library files it created for the associated referenced models.
Using Model Reference with Embedded IDE Link CC
With few limitations or restrictions, Embedded IDE Link CC provides full support for generating code from models that use model reference.
Build Action Setting
The most important requirement for using model reference with the TI’s processors is that you must set the Build action (go to Configuration
Parameters > Embedded IDE Link CC) for all models referred to in the simulation to
Archive_library
.
To set the build action
1
Open your model.
2
Select Simulation > Configuration Parameters from the model menus.
3-78
Model Reference and Embedded IDE Link™ CC
The Configuration Parameters dialog box opens.
3
From the Select tree, choose
Embedded IDE Link CC
.
4
In the right pane, under Runtime, select set
Archive_library from the
Build action list.
If your top model uses a reference model that does not have the build action set to
Archive_library
, the build process automatically changes the build action to
Archive_library and issues a warning about the change.
As a result of selecting the
Archive_library setting, other options are disabled:
• DSP/BIOS is disabled for all referenced models. Only the top model supports DSP/BIOS operation.
• Interrupt overrun notification method, Export IDE link handle
to the base workspace, and System stack size are disabled for the referenced models.
Target Preferences Blocks in Reference Models
Each referenced model and the top model must include a Target Preferences block for the correct processor. You must configure all the Target Preferences blocks for the same processor.
To obtain information about which compiler to use and which archiver to use to build the referenced models, the referenced models require Target
Preferences blocks. Without them, the compile and archive processes does not work.
By design, model reference does not allow information to pass from the top model to the referenced models. Referenced models must contain all the necessary information, which the Target Preferences block in the model provides.
Other Block Limitations
Model reference with Embedded IDE Link CC does not allow you to use certain blocks or S-functions in reference models:
3-79
3
Project Generator
• No blocks from the C62x DSP Library (in c6000lib
) (because these are noninlined S-functions)
• No blocks from the C64x DSP Library (in c6000lib
) (because these are noninlined S-functions)
• No noninlined S-functions
• No driver blocks, such as the ADC or DAC blocks from any Target Support
Package™ TC2 or Target Support Package TC6 block library
Configuring processors to Use Model Reference
processors that you plan to use in Model Referencing must meet some general requirements.
• A model reference compatible processor must be derived from the ERT or
GRT processors.
• When you generate code from a model that references another model, you need to configure both the top-level model and the referenced models for the same code generation processor.
• The External mode option is not supported in model reference Real-Time
Workshop software processor builds. Embedded IDE Link CC does not support External mode. If you select this option, it is ignored during code generation.
• To support model reference builds, your TMF must support use of the shared utilities directory, as described in Supporting Shared Utility
Directories in the Build Process.
To use an existing processor, or a new processor, with Model Reference, you set the
ModelReferenceCompliant flag for the processor. For information on how to set this option, refer to
ModelReferenceCompliant in the online
Help system.
If you start with a model that was created prior to version 2.4 (R14SP3), to make your model compatible with the model reference processor, use the following command to set the
ModelReferenceCompliant flag to
On
: set_param(bdroot,'ModelReferenceCompliant','on')
3-80
Model Reference and Embedded IDE Link™ CC
Models that you develop with versions 2.4 and later of Embedded IDE Link
CC automatically include the model reference capability. You do not need to set the flag.
3-81
3
Project Generator
3-82
Verification
• “What Is Verification?” on page 4-2
• “Using Processor in the Loop” on page 4-3
• “Real-Time Execution Profiling” on page 4-11
• “System Stack Profiling” on page 4-19
4
4
Verification
What Is Verification?
Verification consists broadly of running generated code on a processor and verifying that the code does what you intend. The components of Embedded
IDE Link CC combine to provide tools that help you verify your code during development by letting you run portions of simulations on your hardware and profiling the executing code.
Using the Automation Interface and Project Generator components,
Embedded IDE Link CC offers the following verification functions:
• Processor-in-the-Loop — A technique to help you evaluate how your process runs on your processor
• Real-Time Task Execution Profiling — A tool that lets you see how the tasks in your process run in real-time on your processor hardware
4-2
Using Processor in the Loop
Using Processor in the Loop
Processor in the loop provides one powerful verification capability in your development process. This section discusses the following PIL topics:
In this section...
“Processor-in-the-Loop Overview” on page 4-3
“Creating and Using PIL Blocks” on page 4-8
Processor-in-the-Loop Overview
Processor-in-the-loop (PIL) cosimulation is a technique designed to help you evaluate how well a candidate algorithm, such as a control system, operates on the actual processor selected for the application.
The term cosimulation reflects a division of labor in which Simulink software models the plant, while code generated from the controller subsystem runs on the actual processor hardware.
During the Real-Time Workshop Embedded Coder software code generation process, you can create a PIL block from one of several Simulink software components including a model, a subsystem in a model, or subsystem in a library. You then place the generated PIL block inside a Simulink software model that serves as the test harness and run tests to evaluate the processor-specific code execution behavior.
Why Use Cosimulation?
PIL cosimulation is particularly useful for simulating, testing, and validating a controller algorithm in a system comprising a plant and a controller. In a classic closed-loop simulation, Simulink software and Stateflow ® model such a system as two subsystems with the signals transmitted between them, as shown in the following block diagram.
4-3
4
Verification
4-4
Your starting point in developing a plant/controller system is to model the system as two subsystems in closed-loop simulation. As your design progresses, you can use Simulink software external mode with standard
Real-Time Workshop software processors (such as GRT or ERT) to help you model the control system separately from the plant.
However, these simulation techniques do not help you account for restrictions and requirements imposed by the hardware, such as limited memory resources, or behavior of processor-specific optimized code. When you finally reach the stage of deploying controller code on the processor hardware, you may need to make extensive adjustments to the controller system. After you make these adjustments, your deployed system may diverge significantly from the original model. Such discrepancies can create difficulties if you need to return to the original model and change it.
PIL cosimulation addresses these issues by providing an intermediate stage between simulation and deployment. In a PIL cosimulation, the processor participates fully in the simulation loop — hence the term
processor-in-the-loop.
Definitions
Using Processor in the Loop
PIL Algorithm
The algorithmic code, such as the control algorithm, to be tested during the
PIL cosimulation. The PIL algorithm resides in compiled object form to allow verification at the object level.
PIL Application
The executable application to run on the processor platform. The PIL application is created by linking the PIL algorithm object code with some wrapper code (or test harness) that provides an execution framework that interfaces to the PIL algorithm.
The wrapper code includes the string.h
header file so that the memcpy function is available to the PIL application. The PIL application uses memcpy to facilitate data exchange between Simulink software and the cosimulation processor.
Note Whether the PIL algorithm code under test uses string.h
is independent of the use of string.h
by the wrapper code. It depends entirely on the implementation of the algorithm in the generated code.
How Cosimulation Works
In a PIL cosimulation, Real-Time Workshop software generates an executable application for the PIL algorithm. This code runs (in simulated time) on a processor platform. The plant model remains in Simulink software without the use of code generation.
During PIL cosimulation, Simulink software simulates the plant model for one sample interval and exports the output signals ( ontn of the plant) to the processor platform via Code Composer Studio software. When the processor platform receives signals from the plant model, it executes the PIL algorithm for one sample step. The PIL algorithm returns its output signals ( ontn of the algorithm) computed during this step to Simulink software in inn
, via the
CCS interface. At this point, one sample cycle of the simulation is complete and the plant model proceeds to the next sample interval. The process repeats and the simulation progresses.
4-5
4
Verification
PIL tests do not run in real time. After each sample period, the simulation halts to ensure that all data has been exchanged between the Simulink software test harness and object code. You can then check functional differences between the model and generated code.
PIL Block
The PIL cosimulation block is the Simulink software block interface to
PIL and the interface between the Simulink software plant model and the executable application running on the processor. The Simulink software inputs and outputs of the PIL cosimulation block are configured to match the input and output specification of the PIL algorithm.
The block is a basic building block that enables you to perform these operations:
• Select a PIL algorithm
• Build and download a PIL application
• Run a PIL cosimulation
The PIL block inherits the shape and signal names from the parent subsystem, like those in the following example. This inheritance feature is convenient for copying the PIL block into the model to replace the original subsystem for cosimulation.
4-6
PIL Issues
• “Generic PIL Issues” on page 4-7
Using Processor in the Loop
• “PIL with DSP/BIOS Enabled Does Not Support System Stack Profiling” on page 4-7
• “Real-Time Workshop grt.tlc-Based Targets Not Supported” on page 4-7
• “Out of Date PIL Application Executable” on page 4-7
Consider the following issues when you work with PIL blocks.
Generic PIL Issues
Refer to the Support Table section in the Real-Time Workshop Embedded
Coder documentation for general PIL feature support information affecting the PIL block with Link products. See PIL Feature Support and Limitations.
PIL with DSP/BIOS Enabled Does Not Support System Stack
Profiling
With DSP/BIOS enabled, the stack profiling option is disabled. To use stack profiling with PIL, disable DSP/BIOS™ in the model Target Preferences block and rebuild your project.
Real-Time Workshop grt.tlc-Based Targets Not Supported
Real-Time Workshop grt.tlc
-based targets are not supported for PIL.
To use PIL, select the ccslink_ert.tlc
target file provided by Real-Time
Workshop Embedded Coder software.
Out of Date PIL Application Executable
The PIL block indicates that the PIL application executable is out of date only when it detects that you generated new code for the PIL algorithm under test.
The PIL application executable does not indicate it is out of date under the following circumstances:
• You updated a component of the PIL application executable, such as a C library, after you generated code for the PIL algorithm. To update the
PIL application, click Build on the PIL block to bring the PIL application executable up to date. You do not need to regenerate code for the PIL algorithm.
4-7
4
Verification
• The code generated by a model referred to by the PIL algorithm changes after you generate code for the PIL algorithm. To update the PIL application executable, regenerate code for the PIL algorithm, and then click Build on the PIL block to bring the PIL application executable up to date.
Creating and Using PIL Blocks
Using PIL and PIL blocks to verify your processes begins with a Simulink model of your process. To see an example of one such model used to implement
PIL, refer to the demo Getting Started with Application Development in the demos for Embedded IDE Link CC.
To create and use a PIL block, perform the following tasks:
1
Develop the model of the process to simulate.
Use Simulink software to build a model of the process to simulate. The blocks in the library ccslinklib can help you set up the timing and scheduling for your model.
For information about building Simulink software models, refer to Getting
Started with Simulink in the online Help system.
2
Convert your process to a masked subsystem in your model.
For information about how to convert your process to a subsystem, refer to
Creating Subsystems in Using Simulink or in the online Help system.
3
Open the new masked subsystem and add a Target Preferences block to the subsystem.
The block library ccslinklib contains the Target Preferences block to add to your system. Configure the Target Preferences block for your processor.
For details about the options on the Target Preferences block, refer to the
Target Preferences block reference in the online Help system.
4
Configure your model to enable it to generate PIL algorithm code and a PIL block from your subsystem.
4-8
Using Processor in the Loop a
From the model menu bar, go to Simulation > Configuration
Parameters in your model to open the Configuration Parameters dialog box.
b
Choose Real-Time Workshop from the Select tree. Set the configuration parameters for your model as required by Embedded IDE
Link CC software. Get more information about setting the Real-Time
c
Under Target selection, set the System target file to ccslink_ert.tlc
(PIL requires Real-Time Workshop Embedded Coder software).
5
Configure the model to perform PIL building and PIL block creation.
a
Select
Embedded IDE Link CC on the Select tree.
b c
On the Build actionlist, select
Create_processor_in_the_loop_project to enable PIL.
From PIL block action d
, select
Create_PIL_block_build_and_download from the list.
Click OK to close the Configuration Parameters dialog box.
6
To create the PIL block, right-click the masked subsystem in your model and select Real-Time Workshop > Build Subsystem from the context menu.
A new model window opens and the new PIL block appears in it.
This step builds the PIL algorithm object code and a PIL block that corresponds to the subsystem, with the same inputs and outputs. Follow the progress of the build process in the MATLAB command window.
7
Copy the new PIL block from the new model to your model, either in parallel to your masked subsystem to cosimulate the processes, or replace your subsystem with the PIL block.
To see the PIL block used in parallel to a masked subsystem, refer to the demo Getting Started with Application Development in the demos for
Embedded IDE Link CC software.
4-9
4
Verification
8
Click Simulation > Start to run the PIL simulation and view the results.
4-10
Real-Time Execution Profiling
Real-Time Execution Profiling
In this section...
“Profiling Execution by Tasks” on page 4-12
“Profiling Execution By Subsystems” on page 4-14
Overview
Real-time execution profiling in Embedded IDE Link CC software uses a set of utilities to support profiling for synchronous and asynchronous tasks, or atomic subsystems, in your generated code. These utilities record, upload, and analyze the execution profile data.
Execution profiler supports profiling your code two ways:
• Tasks—Profile your project according to the tasks in the code.
• Atomic subsystems—Profile your project according to the atomic subsystems in your model.
Note To perform execution profiling, you must generate your project from a model in Simulink modeling environment.
When you enable profiling, you select whether to profile by task or subsystem.
To profile by subsystems, you must configure your model with at least one atomic subsystem. To learn more about creating atomic subsystems, refer to
“Creating Subsystems” in the online help for Simulink software.
The profiler generates output in the following formats:
• Graphical display that shows task or subsystem activation, preemption, resumption, and completion. All data appears in a MATLAB graphic with the data notated by model rates or subsystems and execution time.
4-11
4
Verification
• An HTML report that provides statistical data about the execution of each task or atomic subsystem in the running process.
These reports are identical to the reports you see if you use profile(ticcs_obj,'execution','report) to view the execution results.
For more information about report formats, refer to profile
. In combination, the reports provide a detailed analysis of how your code runs on the processor.
Use this general process for profiling your project:
1
Create your model in Simulink modeling environment.
2
Enable execution profiling in the configuration parameters for your model.
3
Run your application.
4
Stop your application.
5
Get the profiling results with the profile function.
The following sections describe profiling your projects in more detail.
Profiling Execution by Tasks
To configure a model to use task execution profiling, perform the following steps:
1
Open the Configuration Parameters dialog box for your model.
2
Select
Embedded IDE Link CC from the Select tree. The pane appears as shown in the following figure.
4-12
Real-Time Execution Profiling
3
Select Enable real-time profiling.
4
On the Profile by list, select
Task to enable real-time task profiling.
5
Select Export IDE link handle to base workspace, and assign a name for the handle in IDE link handle name.
6
Click OK to close the Configuration Parameters dialog box.
To view the execution profile for your model:
1
Click Incremental build ( ) on the model toolbar to generate, build, load, and run your code on the processor.
2
To stop the running program, select Debug > Halt in CCS or use halt(objectname) from the MATLAB command prompt. Gathering profiling data from a running program may yield incorrect results.
3
At the MATLAB command prompt, enter
4-13
4
Verification profile(handlename, execution , report ) to view the MATLAB software graphic of the execution report and the
HTML execution report.
Refer to profile for information about other reporting options.
The following figure shows the profiling plot from running an application that has three rates—the base rate and two slower rates. The gaps in the
Sub-Rate2 task bars indicate preempted operations.
4-14
Refer to Task Profiling Report.
Profiling Execution By Subsystems
When your models use atomic subsystems, you have the option of profiling your code based on the subsystems along with the tasks.
To configure a model to use subsystem execution profiling, perform the following steps:
1
Open the Configuration Parameters dialog box for your model.
Real-Time Execution Profiling
2
Select
Embedded IDE Link CC from the Select tree. The pane appears as shown in the following figure.
3
Select Enable real-time profiling.
4
On the Profile by list, select
Atomic subsystem to enable real-time subsystem execution profiling.
5
Select Export IDE link handle to base workspace and assign a name for the handle in IDE link handle name.
6
Click OK to close the Configuration Parameters dialog box.
To view the execution profile for your model:
1
Click Incremental build ( ) on the model toolbar to generate, build, load, and run your code on the processor.
4-15
4
Verification
2
To stop the running program, select Debug > Halt in CCS, or use halt(objectname) from the MATLAB command prompt. Gathering profile data from a running program may yield incorrect results.
3
At the MATLAB command prompt, enter: profile(handlename, execution , report ) to view the MATLAB software graphic of the execution report and the
HTML execution report.
Refer to profile for more information.
The following figure shows the profiling plot from running an application that has three subsystems—For Iterator Subsystem, For Iterator Subsystem1, and
Idle Task Subsystem.
4-16
Real-Time Execution Profiling
The following figure presents the model that contains the subsystems reported in the profiling plot.
4-17
4
Verification
Atomic Subsystem Profiling
1
Constant
0.8
Feedback Gain
Rate Transition
Rate Transition 1
Out 1 for { ... } In 1
For Iterator
Subsystem1
In 1 for { ... } Out 1
For Iterator
Subsystem
.9
Gain
Rate Transition 2
Rate Transition 3
Idle Task
Idle Task1 f() function ()
IdleTask
Subsystem
Atomic Subsystem Profiling Report.
To Workspace simout
4-18
System Stack Profiling
System Stack Profiling
In this section...
“Profiling System Stack Use” on page 4-21
Overview
Embedded IDE Link CC software enables you to determine how your application uses the processor system stack. Using the profile method, you can initialize and test the size and usage of the stack. This information can help you optimize both the size of the stack and how your code uses the stack.
To provide stack profiling, profile writes a known pattern to the addresses in the stack. After you run your application for a while, and then stop your application, profile examines the contents of the stack addresses.
profile counts each address that no longer contains the known pattern as used. The total number of address that have been used, compared to the total number of addresses you allocated, becomes the stack usage profile. This profile process does not tell you how often any address was changed by your application.
You can profile the stack with both the hand written code in a project and the code you generate from a model.
Note Stack profiling always reports 100% stack usage when your project uses DSP/BIOS.
When you use profile to initialize and test the stack operation, the software returns a report that contains information about stack size, usage, addresses, and direction. With this information, you can modify your code to use the stack efficiently. The following program listing shows the stack usage results from running an application on a simulator.
profile(cc,'stack','report')
Maximum stack usage:
4-19
4
Verification
System Stack: 532/1024 (51.95%) MAUs used.
name: System Stack startAddress: [512 0] endAddress: [1535 stackSize: 1024 MAUs
0] growthDirection: ascending
The following table describes the entries in the report:
Report Entry
System Stack
Units
Minimum Addressable
Unit (MAU) name startAddress endAddress stackSize growthDirection
String for the stack name
Decimal address and page
Decimal address and page
Addresses
Not applicable
Description
Maximum number of
MAUs used and the total MAUs allocated for the stack.
Lists the name assigned to the stack.
Lists the address of the stack start and the memory page.
Lists the address of the end of the stack and the memory page.
Reports number of address locations, in
MAUs, allocated for the stack.
Reports whether the stack grows from the lower address to the higher address
( ascending
) or from higher to lower
( descending
).
4-20
System Stack Profiling
Profiling System Stack Use
To profile the system stack operation, perform these tasks in order:
1
Load an application.
2
Set up the stack to enable profiling.
3
Run your application.
4
Request the stack profile information.
Note If your application initializes the stack with known values when you run it, stack usage is reported as 100%. The value does not correctly reflect the stack usage. For example, DSP/BIOS writes a fixed pattern to the stack
(
0x00C0FFEE
) when you run your project. This pattern prevents the stack profiler from reporting the stack usage correctly. Disable DSP/BIOS to use stack profiling in your project development.
Follow these steps to profile the stack as your application interacts with it. In this example, cc is an existing ticcs object.
1
Load the application to profile.
2
Use the profile method with the setup input keyword to initialize the stack to a known state.
profile(cc,'stack','setup')
With the setup input argument, profile writes a known pattern into the addresses that compose the stack. For C6000 processors, the pattern is A5.
For C2000 and C5000 processors, the pattern is A5A5 to account for the address size. As long as your application does not write the same pattern to the system stack, profile can report the stack usage correctly.
3
Run your application.
4
Stop your running application. Stack use results gathered from an application that is running may be incorrect.
4-21
4
Verification
5
Use the profile method to capture and view the results of profiling the stack.
profile(cc,'stack','report')
The following example demonstrates setting up and profiling the stack. The ticcs object cc must exist in your MATLAB workspace and your application must be loaded on your processor. This example comes from a C6713 simulator.
profile(cc,'stack','setup') % Set up processor stack--write A5 to the stack addresses.
Maximum stack usage:
System Stack: 0/1024 (0%) MAUs used.
name: System Stack startAddress: [512 0] endAddress: [1535 stackSize: 1024 MAUs
0] growthDirection: ascending run(cc) halt(cc) profile(cc,'stack','report') % Request stack use report.
Maximum stack usage:
System Stack: 356/1024 (34.77%) MAUs used.
name: System Stack startAddress: [512 0] endAddress: [1535 stackSize: 1024 MAUs
0] growthDirection: ascending
4-22
Exporting Filter
Coefficients from FDATool
5
• “Preparing to Export Filter Coefficients to Code Composer Studio Projects” on page 5-4
• “Exporting Filter Coefficients to Your Code Composer Studio Project” on page 5-9
• “Preventing Memory Corruption When You Export Coefficients to Processor
5
Exporting Filter Coefficients from FDATool
About FDATool
Signal Processing Toolbox™ software provides the Filter Design and Analysis tool (FDATool) that lets you design a filter and then export the filter coefficients to a matching filter implemented in a CCS project.
Using FDATool with CCS IDE enables you to:
• Design your filter in FDATool
• Use CCS to test your filter on a processor
• Redesign and optimize the filter in FDATool
• Test your redesigned filter on the processor
For instructions on using FDATool, refer to the section “Filter Design and
Analysis Tool” in the Signal Processing Toolbox documentation.
Procedures in this chapter demonstrate how to use the FDATool export options to export filter coefficients to CCS. Using these procedures, you can perform the following tasks:
• Export filter coefficients from FDATool in a header file—“Exporting Filter
Coefficients from FDATool to the CCS IDE Editor” on page 5-9
• Export filter coefficients from FDATool to processor memory—“Replacing
Existing Coefficients in Memory with Updated Coefficients” on page 5-16
Caution As a best practice, export coefficients in a header file for the most reliable results. Exporting coefficients directly to processor memory can generate unexpected results or corrupt memory.
Also see the reference pages for the following Embedded IDE Link CC functions. These primary functions allow you use to access variables and write them to processor memory from the MATLAB Command window.
• address
— Return the address of a symbol so you can read or write to it.
5-2
About FDATool
• ticcs
— Create a connection between MATLAB software and CCS IDE so you can work with the project in CCS from the MATLAB Command window.
• write
— Write data to memory on the processor.
5-3
5
Exporting Filter Coefficients from FDATool
5-4
Preparing to Export Filter Coefficients to Code Composer
Studio Projects
In this section...
“Features of a Filter” on page 5-4
“Selecting the Export Mode” on page 5-5
“Choosing the Export Data Type” on page 5-6
Features of a Filter
When you create a filter in FDATool, the filter includes defining features identified in the following table.
Description Defining
Feature
Structure
Design Method
Response
Type and
Specifications
Coefficients
Structure defines how the elements of a digital filter—gains, adders/subtractors, and delays—combine to form the filter. See the Signal Processing Toolbox documentation in the Online Help system for more information about filter structures.
Defines the mathematical algorithm used to determine the filter response, length, and coefficients.
Defines the filter passband shape, such as lowpass or bandpass, and the specifications for the passband.
Data Type
Defines how the filter structure responds at each stage of the filter process.
Defines how to represent the filter coefficients and the resulting filtered output. Whether your filter uses floating-point or fixed-point coefficients affects the filter response and output data values.
When you export your filter, FDATool exports only the number of and value of the filter coefficients and the data type used to define the coefficients.
Preparing to Export Filter Coefficients to Code Composer Studio™ Projects
Selecting the Export Mode
You can export a filter by generating an ANSI C header file, or by writing the filter coefficients directly to processor memory. The following table summarizes when and how to use the export modes.
To…
Add filter coefficients to a project in
CCS
Use Export
Mode…
C header file
When to Use
You implemented a filter algorithm in your program, but you did not allocate memory on your processor for the filter coefficients.
Suggested Use
• Add the generated ANSI C header file to an appropriate project. Building and loading this project into your processor allocates static memory locations on the processor and writes your filter coefficients to those locations.
• Edit the file so the header file allocates extra processor memory and then add the header file to your project. Refer
to “Allocating Sufficient or Extra
Memory for Filter Coefficients” on page 5-15 in the next section.
Modify the filter coefficients in an embedded application loaded on a processor
Write directly to memory
You loaded a program on your processor.
The program allocated space in your processor memory to store the filter coefficients.
(For a sample generated header file,
refer to“Reviewing ANSI C Header File
• Optimize your filter design in
FDATool.
Then,
• Write the updated filter coefficients directly to the allocated processor
memory. Refer to section “Preventing
Memory Corruption When You Export
Coefficients to Processor Memory” on page 5-15 for more information.
5-5
5
Exporting Filter Coefficients from FDATool
Choosing the Export Data Type
The export process provides two ways you can specify the data type to use to represent the filter coefficients. Select one of the options shown in the following table when you export your filter.
Description Specify Data Type for
Export
Export suggested
Export as
Uses the data type that FDATool suggests to preserve the fidelity of the filter coefficients and the performance of your filter in the project
Lets you specify the data type to use to export the filter coefficients
FDATool exports filter coefficients that use the following data types directly without modifications:
• Signed integer (8, 16, or 32 bits)
• Unsigned integer (8, 16, or 32 bits)
• Double-precision floating point (64 bits)
• Single-precision floating point (32 bits)
Filters in FDATool in the Signal Processing Toolbox software use double-precision floating point. You cannot change the data type.
If you have installed Filter Design Toolbox™ software, you can use the filter quantization options in FDATool to set the word and fraction lengths that represent your filter coefficients. For information about using the quantization options, refer to Filter Design and Analysis Tool in the Filter
Design Toolbox documentation in the Online help system.
If your filter uses one of the supported data types, Export suggested specifies that data type.
If your filter does not use one of the supported data types, FDATool converts the unsupported data type to one of the supported types and then suggests that data type. For more information about how FDATool determines the data
5-6
Preparing to Export Filter Coefficients to Code Composer Studio™ Projects
type to suggest, refer to “How FDATool Determines the Export Suggested
Follow these best-practice guidelines when you implement your filter algorithm in source code and design your filter in FDATool:
• Implement your filter using one of the data types FDATool exports without modifications.
• Design your filter in FDATool using the data type you used to implement your filter.
To Choose the Export Data Type
When you export your filter, follow this procedure to select the export data type to ensure the exported filter coefficients closely match the coefficients of your filter in FDATool.
1
In FDATool, select Targets > Code Composer Studio IDE to open the
Export to Code Composer Studio IDE dialog box.
2
Perform one of the following actions:
• Select Export suggested to export the coefficients in the suggested data type.
• Select Export as and choose the data type your filter requires from the list.
Caution If you select Export as, the exported filter coefficients can be very different from the filter coefficients in FDATool. As a result, your filter cutoff frequencies and performance may not match your design in FDATool.
How FDATool Determines the Export Suggested Data Type
By default, FDATool represents filter coefficients as double-precision floating-point data. When you export your filter coefficients, FDATool suggests the same data type.
5-7
5
Exporting Filter Coefficients from FDATool
If you set custom word and fraction lengths to represent your filter coefficients, the export process suggests a data type to maintain the best fidelity for the filter.
The export process converts your custom word and fraction lengths to a suggested export data type, using the following rules:
• Round the word length up to the nearest larger supported data type. For example, round an 18-bit word length up to 32 bits.
• Set the fraction length to the maintain the same difference between the word and fraction length in the new data type as applies in the custom data type.
For example, if you specify a fixed-point data type with word length of
14 bits and fraction length of 11 bits, the export process suggests an integer data type with word length of 16 bits and fraction length of 13 bits, retaining the 3 bit difference.
5-8
Exporting Filter Coefficients to Your Code Composer Studio Project
Exporting Filter Coefficients to Your Code Composer Studio
Project
In this section...
“Exporting Filter Coefficients from FDATool to the CCS IDE Editor” on page 5-9
“Reviewing ANSI C Header File Contents” on page 5-12
Exporting Filter Coefficients from FDATool to the CCS
IDE Editor
In this section, you export filter coefficients to a project by generating an
ANSI C header file that contains the coefficients. The header file defines global arrays for the filter coefficients. When you compile and link the project to which you added the header file, the linker allocates the global arrays in static memory locations in processor memory.
Loading the executable file into your processor allocates enough memory to store the exported filter coefficients in processor memory and writes the coefficients to the allocated memory.
Use the following steps to export filter coefficients from FDATool to the CCS
IDE text editor.
1
Start FDATool by entering fdatool at the MATLAB command prompt.
fdatool % Starts FDATool.
2
Design a filter with the same structure, length, design method, specifications, and data type you implemented in your source code filter algorithm.
The following figure shows a Direct-form II IIR filter example that uses second-order sections.
3
Click Store Filter to store your filter design. Storing the filter allows you to recall the design to modify it.
5-9
5
Exporting Filter Coefficients from FDATool
4
To export the filter coefficients, select Targets > Code Composer Studio
IDE from the FDATool menu bar.
The Export to Code Composer Studio IDE dialog box opens, as shown in the following figure.
5-10
5
Set Export mode to
C header file
.
6
In Variable names in C header file, enter variable names for the
Numerator, Denominator, Numerator length, and Denominator
length parameters where the coefficients will be stored.
The dialog box shows only the variables you need to export to define your filter.
Exporting Filter Coefficients to Your Code Composer Studio Project
Note You cannot use reserved ANSI C programming keywords, such as if or int as variable names, or include invalid characters such as spaces or semicolons (
;
).
7
In Data type to use in export, select Export suggested to accept the recommended export data type. FDATool suggests a data type that retains filter coefficient fidelity.
You may find it useful to select the Export as option and select an export data type other than the one suggested.
Caution If you deviate from the suggested data type, the exported filter coefficients can be very different from the filter coefficients in FDATool. As a result, your filter cutoff frequencies and performance may not match your design in FDATool.
For more information about how FDATool decides which data type to
suggest, refer to “How FDATool Determines the Export Suggested Data
8
If you know the board number and processor number of your DSP, enter
DSP Board # and DSP Processor # values to identify your board.
When you have only one board or simulator, Embedded IDE Link CC software sets DSP Board # and DSP Processor # values for your board automatically.
If you have more than one board defined in CCS Setup:
5-11
5
Exporting Filter Coefficients from FDATool
• Click Select target to open the Selection Utility: Embedded IDE Link
CC dialog box.
• From the list of boards and list of processors, select the board name and processor name to use.
• Click Done to set the DSP Board # and DSP Processor # values.
9
Click Generate to generate the ANSI header file. FDATool prompts you for a file name and location to save the generated header file.
The default location to save the file is your MATLAB working directory.
The default file name is fdacoefs.h
.
10
Click OK to export the header file to the CCS editor.
If CCS IDE is not open, this step starts the IDE.
The export process does not add the file to your active project in the IDE.
11
Drag your generated header file into the project that implements the filter.
12
Add a
#include statement to your project source code to include the new header file when you build your project.
13
Generate a
.out
file and load the file into your processor. Loading the file allocates locations in static memory on the processor and writes the filter coefficients to those locations.
To see an example header file, refer to “Reviewing ANSI C Header File
Reviewing ANSI C Header File Contents
The following program listing shows the exported header (
.h
) file that
FDATool generates. This example shows a direct-form II filter that uses five second-order sections. The filter is stable and has linear phase.
Comments in the file describe the filter structure, number of sections, stability, and the phase of the filter. Source code shows the filter coefficients and variables associated with the filter design, such as the numerator length and the data type used to represent the coefficients.
5-12
Exporting Filter Coefficients to Your Code Composer Studio Project
/*
* Filter Coefficients (C Source) generated by the Filter Design and Analysis Tool
*
* Generated by MATLAB(R) 7.8 and the Signal Processing Toolbox 6.11.
*
* Generated on: xx-xxx-xxxx 14:24:45
*
*/
/*
* Discrete-Time IIR Filter (real)
* -------------------------------
* Filter Structure : Direct-Form II, Second-Order Sections
* Number of Sections : 5
* Stable : Yes
* Linear Phase
*/
: No
/* General type conversion for MATLAB generated C-code */
#include "tmwtypes.h"
/*
* Expected path to tmwtypes.h
* $MATLABROOT\extern\include\tmwtypes.h
*/
#define MWSPT_NSEC 11 const int NL[MWSPT_NSEC] = { 1,3,1,3,1,3,1,3,1,3,1 }; const real64_T NUM[MWSPT_NSEC][3] = {
{
0.802536131462, 0,
},
{
0.2642710234701, 0.5285420469403,
0
0.2642710234701
},
{
1, 0, 0
},
{
0.1743690465012, 0.3487380930024, 0.1743690465012
},
5-13
5
Exporting Filter Coefficients from FDATool
};
}
},
{
{
0.2436793028081, 0.4873586056161, 0.2436793028081
},
{
1, 0, 0
},
{
0.3768793219093, 0.7537586438185,
},
{
1, 0,
};
} const int DL[MWSPT_NSEC] = { 1,3,1,3,1,3,1,3,1,3,1 }; const real64_T DEN[MWSPT_NSEC][3] = {
{
1, 0,
},
{
1, -0.1842138030775,
0.3768793219093
0
0
0.1775781189277
},
{
1, 0, 0
},
1, -0.2160098642842, 0.3808329528195
1, 0, 0
5-14
Preventing Memory Corruption When You Export Coefficients to Processor Memory
Preventing Memory Corruption When You Export
Coefficients to Processor Memory
In this section...
“Allocating Sufficient or Extra Memory for Filter Coefficients” on page 5-15
“Example: Using the Exported Header File to Allocate Extra Processor
“Replacing Existing Coefficients in Memory with Updated Coefficients” on page 5-16
“Example: Changing Filter Coefficients Stored on Your Processor” on page
Allocating Sufficient or Extra Memory for Filter
Coefficients
You can allocate extra memory by editing the generated ANSI C header file.
You can then load the associated program file into your processor as described
in “Example: Using the Exported Header File to Allocate Extra Processor
Memory” on page 5-15. Extra memory lets you change filter coefficients and
overwrite existing coefficients stored in processor memory more easily.
To prevent problems when you update filter coefficients in a project, , such as writing coefficients to unintended memory locations, use the
C header file export mode option in FDATool to update filter coefficients in your program.
Example: Using the Exported Header File to Allocate
Extra Processor Memory
You can edit the generated header file so the linked program file allocates extra processor memory. By allocating extra memory, you avoid the problem of insufficient memory when you export new coefficients directly to allocated memory.
For example, changing the following command in the header file: const real64_T NUM[47] = {...}
5-15
5
Exporting Filter Coefficients from FDATool to real64_T NUM[256] = {...} allocates enough memory for
NUM to store up to 256 numerator filter coefficients rather than 47.
Exporting the header file to CCS IDE does not add the filter to your project.
To incorporate the filter coefficients from the header file, add a
#include statement:
#include headerfilename.h
coefficients.
When you export filter coefficients directly to processor memory, the export process writes coefficients to as many memory locations as they need. The write process does not perform bounds checking. To ensure you write to the correct locations, and have enough memory for your filter coefficients, plan memory allocation carefully.
Replacing Existing Coefficients in Memory with
Updated Coefficients
When you redesign a filter and export new coefficients to replace existing coefficients in memory, verify the following conditions for your new design:
• Your redesign did not increase the memory required to store the coefficients beyond the allocated memory.
Changes that increase the memory required to store the filter coefficients include the following redesigns:
-
Increasing the filter order
-
Changing the number of sections in the filter
-
Changing the numerical precision (changing the export data type)
• Your changes did not change the export data type.
5-16
Preventing Memory Corruption When You Export Coefficients to Processor Memory
Caution Identify changes that require additional memory to store the coefficients before you begin your export. Otherwise, exporting the new filter coefficients may overwrite data in memory locations you did not allocate for storing coefficients. Also, exporting filter coefficients to memory after you change the filter order, structure, design algorithm, or data type can yield unexpected results and corrupt memory.
Changing the filter design algorithm in FDATool, such as changing from
Butterworth to Maximally Flat, often changes the number of filter coefficients
(the filter order), the number of sections, or both. Also, the coefficients from the new design algorithm may not perform properly with your source code filter implementation.
If you change the design algorithm, verify that your filter structure and length are the same after you redesign your filter, and that the coefficients will perform properly with the filter you implemented.
If you change the number of sections or the filter order, your filter will not perform properly unless your filter algorithm implementation accommodates the changes.
Example: Changing Filter Coefficients Stored on Your
Processor
This example writes filter coefficients to processor memory to replace the existing coefficients. To perform this process, you need the names of the variables in which your project stores the filter data.
Before you export coefficients directly to memory, verify that your project allocated enough memory for the new filter coefficients. If your project allocated enough memory, you can modify your filter in FDATool and then follow the steps in this example to export the updated filter coefficients to the allocated memory.
If your new filter requires additional memory space, use a C header file to allocate memory on the processor and export the new coefficients as described
in “Exporting Filter Coefficients to Your Code Composer Studio Project” on page 5-9.
5-17
5
Exporting Filter Coefficients from FDATool
For important guidelines on writing directly to processor memory, refer to
“Preventing Memory Corruption When You Export Coefficients to Processor
Follow these steps to export filter coefficients from FDATool directly to memory on your processor.
1
Load the program file that contains your filter into CCS IDE to activate the program symbol table. The symbol must contain the global variables you use to store the filter coefficients and length parameters.
2
Start FDATool.
3
Click Filter Manager to open the Filter Manager dialog box, shown in the following figure.
5-18
4
Highlight the filter to modify on the list of filters, and select Edit current
filter. The highlighted filter appears in FDATool for you to change.
Preventing Memory Corruption When You Export Coefficients to Processor Memory
If you did not store your filter from a previous session, design the filter in FDATool and continue.
5
Click Close to dismiss the Filter Manager dialog box.
6
Adjust the filter specifications in FDATool to modify its performance.
7
In FDATool, select Targets > Code Composer Studio IDE to open the
Export to Code Composer Studio IDE dialog box.
Keep the export dialog box open while you work. When you do so, the contents update as you change the filter in FDATool.
Tip Click Generate to export coefficients to the same processor memory location multiple times without reentering variable names.
8
In the Export to Code Composer Studio dialog box:
• Set Export mode to Write directly to memory
• Clear Disable memory transfer warnings to get a warning if your processor does not support the export data type.
9
In Variable names in target symbol table, enter the names of the variables in the processor symbol table that correspond to the memory allocated for the parameters, such as Numerator and Denominator.
Your names must match the names of the filter coefficient variables in your program.
10
Select Export suggested to accept the recommended export data type.
5-19
5
Exporting Filter Coefficients from FDATool
For more information about how FDATool determines the data type to
suggest, refer to “How FDATool Determines the Export Suggested Data
11
If you know the board number and processor number of your DSP, enter
DSP Board # and DSP Processor # values to identify your board.
Note When you have only one board or simulator, Embedded IDE Link
CC sets DSP Board # and DSP Processor # to your board automatically.
If you have more than one board defined in CCS Setup:
• Click Select target to open the Selection Utility: Embedded IDE Link
CC dialog box.
• Select the board name and processor name to use from the list of boards.
12
Click Generate to export your filter. If your processor does not support the data type you export, you see a warning similar to the following message.
5-20
Preventing Memory Corruption When You Export Coefficients to Processor Memory
You can continue to export the filter, or cancel the export process. To prevent this warning dialog box from appearing, select Disable memory
transfer warnings in the Export to Code Composer Studio IDE dialog box.
13
(Optional) Continue to optimize filter performance by modifying your filter in FDATool and then export the updated filter coefficients directly to processor memory.
14
When you finish testing your filter, return to FDATool, and click Store
filter to save your changes.
5-21
5
Exporting Filter Coefficients from FDATool
5-22
Function Reference
Operations on Objects for CCS IDE
Operations on Objects for RTDX
Work with links for CCS IDE
Work with links to RTDX
6
6
Function Reference
Operations on Objects for CCS IDE
Make specified project, file, or build configuration active in CCS IDE
Add files or new typedef to active project in CCS
Address and page for entry in symbol table in CCS IDE
Run application on processor to breakpoint
Build active project in CCS IDE
Information about boards and simulators known to CCS IDE
Change CCS IDE working directory
Remove links to CCS IDE and RTDX interface, or clear type entries in type objects
Close CCS IDE files or RTDX channel
Remove debug points in addresses or source files in CCS
List files in current CCS IDE working directory
Display properties of object that refers to CCS IDE or RTDX link
Access object properties
Terminate execution of process running on processor
Information about processor
Add debug point to source file or address in CCS
6-2
Operations on Objects for CCS IDE
Determine whether MATLAB software can read specified memory block
Determine whether processor supports RTDX
Determine whether processor is executing process
Determine whether CCS IDE is running
Determine whether MATLAB software can write to specified memory block
Transfer program file (*.
out
, *.
obj
) to processor in active project
Create and open text file, project, or build configuration in CCS IDE
Open channel to processor or load file into CCS IDE
Code execution and stack usage profile report
Data from memory on processor or in CCS
Value from processor register
Write data values to registers on processor
Reload most recent program file to processor signal processor
Remove file from active CCS IDE project
Reset processor
Restore program counter to entry point for current program
6-3
6
Function Reference
Execute program loaded on processor
Program symbol table from CCS IDE
Create object that refers to CCS IDE
Set whether CCS IDE window is visible while CCS runs
Write data to memory on processor
Operations on Objects for RTDX
Close CCS IDE files or RTDX channel
Define size and number of RTDX channel buffers
Disable RTDX interface, specified channel, or all RTDX channels
Display properties of object that refers to CCS IDE or RTDX link
Enable RTDX interface, specified channel, or all RTDX channels
Flush data or messages from specified RTDX channels
Access object properties
Determine whether RTDX link is enabled for communications
Determine whether MATLAB software can write to specified memory block
Number of messages in read-enabled channel queue
6-4
Operations on Objects for RTDX™
Open channel to processor or load file into CCS IDE
Matrix of data from RTDX channel
Read messages from specified RTDX channel
Write messages to specified RTDX channel
6-5
6
Function Reference
6-6
Functions — Alphabetical
List
7
activate
Purpose
Syntax
Description
Examples
Make specified project, file, or build configuration active in CCS IDE activate(cc,'objectname','type') activate(cc,'objectname','type') objectname makes the object specified by and type the active document window or project in CCS
IDE. While you must include the link cc
, it does not identify the project or file you make active.
activate accepts one of three strings for type
String
'project'
'text'
'buildcfg'
Description
Makes an existing project in CCS IDE active
(current). You must include the
.pjt
extension in objectname
.
Makes the specified text file in CCS IDE the active document window. Include the file extension in objectname when you specify the file.
Makes the specified build configuration in CCS
IDE active. Note that build configuration is similar to project configuration.
To specify the project file, text file, or build configuration, objectname must contain the full project name with the
.pjt
extension, or the full path name and extension for the text file.
When you activate a build configuration, activate applies to the active project in CCS IDE. If the build configuration you specify in activate does not exist in the active project, MATLAB software returns an error that the specified configuration does not exist in the project. Fix this error by using activate to make the correct project active, then use activate again to select the desired build configuration.
Create two projects in CCS IDE and use activate to change the active project, build configuration, and document window.
cc=ticcs;
7-2
activate
See Also visible(cc,1)
Now make two projects in CCS IDE.
new(cc,'myproject1.pjt','project') new(cc,'myproject2.pjt')
In CCS IDE, myproject2 is now the active project, because you just created it. With two projects in CCS IDE, add a new build configuration to the second project.
new(cc,'Testcfg','buildcfg')
If you switch to CCS IDE, you see myproject2.pjt
in bold lettering in the project view, signaling it is the active project. When you check the active configuration list, you see three build configurations—
Debug
,
Release
, and
Testcfg
. Currently,
Testcfg is the active build configuration in myproject2
.
Finally, add a text file to myproject1 and make it the active document window in CCS IDE. In this case, you add the source file for the ADC block.
activate(cc,'myproject1.pjt','project') % Makes myproject1 the active project.
add(cc,'c6711dsk_adc.c') activate(cc,'c6711dsk_adc.c','text') build
, new
, remove
7-3
add
Purpose
Syntax
Description
Add files or new typedef to active project in CCS add(cc,'filename') info = add(cc.type,'typedefname','datatype')
Use add when you have an existing file to add to your active project in
CCS. You can have more than one CCS IDE open at the same time, such as C5000 and C6000 IDE instances.
cc identifies which CCS
IDE instance gets the file, and it identifies your board or processor.
Note that cc does not identify your project in CCS — it identifies only your hardware or simulator.
add puts the file specified by filename in the active project in CCS. Files you add must exist and be one of the supported file types shown in the next table.
When you add files, CCS puts the files in the appropriate folder in the project, such as putting source files with the
.c
extension in the
Source folder and adding .
lib files to the
Libraries folder. You cannot change the destination folder in your CCS project. Using add is identical to selecting Project > Add Files to Project in CCS IDE.
To specify the file to add, filename must be the full path name to the file, unless your file is in your CCS working directory or in a directory on your MATLAB environment path. Embedded IDE Link CC searches for files first in your CCS IDE working directory, then in directories on your MATLAB path.
You can add the following file types to a project through add
.
File Types and Extensions Supported by add and CCS IDE
File Type
C/C++ source files
Extensions
Supported
.c
,
.cpp
,
.cc
,
.ccx
,
.sa
Assembly source files
.a*
,
.s*
(excluding
.sa
, refer to C/C++ source files)
CCS Project Folder
Source
Source
7-4
Examples
File Types and Extensions Supported by add and CCS IDE
(Continued)
File Type
Object and library files
Extensions
Supported
.o*
,
.lib
Linker command file
.cmd
DSP/BIOS file .cdb*
Visual Linker Recipe rcp
CCS Project Folder
Libraries
Project Name
DSP/BIOS Config
Replaces the
.cmd
file, or goes under
Project Name
Use activate to change your active project in CCS IDE or switch to the
CCS IDE and change the active directory within CCS.
info = add(cc.type,'typedefname','datatype') adds the new type definition typedefname to the type class in cc
. Return value info contains the information about your custom data type. Your new data type typedefname has type datatype
. As long as the cc object exists, the information about your new typedef exists as well. Including the left side argument is an option. Omitting the left side argument does not prevent add from making additions to the type objects.
Create a new project. Add a source file and a build configuration. From
MATLAB software, use new to make your project in CCS IDE, and then use add to put the required files into your project.
cc=ticcs
TICCS Object:
API version
Processor type
Processor name
Running?
: 1.2
: TMS320C64127
: CPU_1
: No add
7-5
add
See Also
Board number : 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0 cc.visible(1) % Optional. Makes CCS IDE visible on your desktop.
new(cc,'myproject','project');
% Now add a C source file add(cc,'c6711dsk_adc.c'); % Adds the source file for the ADC block.
In CCS IDE, c6711dsk_adc.c
shows up in myproject
, in the
Source folder. Now add a new build configuration to myproject
. After you add the new configuration, you can see it on the configurations list in CCS
IDE, along with the usual
Debug and
Release configurations: new(cc,'Testcfg','buildcfg')
Adding a new type definition to the type object is straightforward: cc=ticcs; info = add(cc.type, 'mynew typedef','int32'); info = type: 'int32' size: 1 uclass: 'numeric' cc.type
Defined types : Void, Float, Double, Long, Int, Short, Char, mynewtypedef activate
, cd
, open
, remove
7-6
address
Purpose
Syntax
Description
Address and page for entry in symbol table in CCS IDE a = address(cc,' symbolstring ') a = address(cc,' symbolstring ') returns the memory address and page values for the symbol identified by ’ symbolstring
’ in CCS IDE.
address returns the symbol from the most recently loaded program in CCS IDE. In some instances this might not be the program loaded on the processor to which cc is linked. By returning the address and page values as a structure, your programs can use the values directly.
If you provide an output argument, the output a contains the 1-by-2 vector of
[address page]
. For address to work, symbolstring must represent a valid entry in the symbol table. To ensure that address returns information for the correct symbol, use the proper case when you enter symbolstring because symbol names are case-sensitive;
’ symbolstring
’ is not the same as ’
Symbolstring
’.
If address does not find a symbol table entry that matches symbolstring
, the first cell of a is returned empty. Notice that this function returns only the first matching symbol in the symbol table.
The output argument is a cell array where each row in a presents the symbol name and address in the table. Each returned symbol address comprises a two element vector with the symbol page as the second element. For example, this table shows a few possible elements of a
, and their interpretation.
a Array Element a{1} a{2}(1) a{2}(2)
Contents of the Element
String reflecting the symbol name. If address found a symbol that matches symbolstring
, this is the same as symbolstring
. Otherwise this is empty.
Address or value of symbol entry.
Memory page value. For TI’s C6000 processors, the page is 0.
7-7
address
Examples
See Also
After you load a program to your processor, address lets you read and write to specific entries in the symbol table for the program. For example, the following function reads the value of symbol ’ ddat
’ from the symbol table in CCS IDE.
ddatv = read(cc,address(cc,'ddat'),'double',4) ddat is an entry in the current symbol table.
address searches for the string ddat and returns a value when it finds a match.
read returns ddat to MATLAB software as a double-precision value as specified by the string ’ double
’.
To change values in the symbol table, use address with write
: write(cc,adddress(cc,'ddat'),double([pi 12.3 exp(-1)...
sin(pi/4)]))
After executing this write operation, ddat contains double-precision values for π, 12.3, e of ddat
:
-1 , and sin(π/4). Use read to verify the contents ddatv = read(cc,address(cc,'ddat'),'double',4)
MATLAB software returns ddatv =
0.7071
3.1416
12.3
load
, read
, symbol
, write
0.3679
7-8
animate
Purpose
Syntax
Description
See Also
Run application on processor to breakpoint animate(cc) animate(cc) starts the processor application, which runs until it encounters a breakpoint in the code. At the breakpoint, application execution halts and CCS Debugger returns data to CCS IDE to update all windows that are not connected to probe points. After updating the display, the application resumes execution and runs until it encounters another breakpoint. The run-break-resume process continues until you stop the application from MATLAB software with the halt function or from CCS IDE.
When you are running scripts or files in MATLAB software, you might find that animate provides a useful way to update the CCS IDE with information as your script or program runs.
Using animate with Multiprocessor Boards
When you use animate with a ticcs object cc that comprises more than one processor, such as an OMAP processor, the method applies to each processor in your cc object. This causes each processor to run a loaded program just as it does for the single processor case.
halt
, restart
, run
7-9
build
Purpose
Syntax
Description
Build active project in CCS IDE build(cc,timeout) build(cc) build(cc,' all ',timeout) build(cc,' all ')
[result,numwarns]=build(...) build(cc,timeout) incrementally rebuilds your active project in CCS
IDE. In an incremental build:
• Files that you have changed since your last project build process get rebuilt or recompiled.
• Source files rebuild when the time stamp on the source file is later than the time stamp on the object file created by the last build.
• Files whose time stamps have not changed do not rebuild or recompile.
This incremental build is identical to the incremental build in CCS IDE, available from the CCS IDE toolbar.
After building the files, CCS IDE relinks the files to create the program file with the
.out
extension. To determine whether to relink the output file, CCS IDE compares the time stamp on the output file to the time stamp on each object file. It relinks the output when an object file time stamp is later than the output file time stamp.
To reduce the compile and build time, CCS IDE keeps a build information file for each project. CCS IDE uses this file to determine which file needs to be rebuilt or relinked during the incremental build.
After each build, CCS IDE updates the build information file.
7-10
build
Note CCS IDE opens a Save As dialog box when the requested project build overwrites any files in the project. You must respond to the dialog box before CCS IDE continues the build. The dialog box may be hidden by open windows on your desktop and not visible. CCS IDE, MATLAB software, and other applications may appear to be frozen until you respond.
To limit the time that build spends performing the build, the optional argument timeout stops the process after timeout seconds.
timeout defines the number of seconds allowed to complete the required compile, build, and link operation. If the build process exceeds the timeout period, build returns an error in MATLAB software. Generally, build causes the processor to initiate a restart even when the period specified by timeout passes. Exceeding the allotted time for the operation usually indicates that confirmation that the build was finished was not received before the timeout period passed. If you omit the timeout option in the syntax, build defaults to the global timeout defined in cc
.
build(cc) is the same as build(cc,timeout) except that when you omit the timeout option, build defaults to the timeout for build
, 1000 s. This timeout value overrides the default timeout setting for cc
.
build(cc,' all ',timeout) completely rebuilds all of the files in the active project. This full build is identical to selecting Project >
Rebuild All from the CCS menu bar. After rebuilding all files in the project, build performs the link operation to create a new program file.
To limit the time that build spends performing the build, optional argument timeout stops the process after timeout seconds.
timeout defines the number of seconds allowed to complete the required compile, build, and link operation.
If the build process exceeds the timeout period, build returns an error in MATLAB software. Generally, build causes the processor to initiate a restart even when the period specified by timeout passes. Exceeding the allotted time for the operation usually indicates that confirmation that the build was finished was not received before the timeout period
7-11
build
Examples passed. If you omit the timeout option in the syntax, build defaults to the global timeout defined in cc
.
build(cc,' all ') is the same as build(cc,'all',timeout) except that when you omit the timeout option, build defaults to the timeout set for build only, 1000 s.
[result,numwarns]=build(...) returns two output values that report the results of the build operation. For a successful build, the output arguments are the following:
• result equal to
1 for the build
• numwarns reports the number of build warnings that occurred during the build.
When the build is not successful, build displays an error and a message that contains the build string in the MATLAB software Command
Window.
To demonstrate building a project from MATLAB software, use CCS
IDE to load a project from the Texas Instruments software tutorials.
For this example, open the project file volume.pjt
from the
Tutorial folder where you installed CCS IDE. (You can open any project you have for this example.)
Now use build to build the project: cc=ticcs
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.2
: TMS320C64127
: CPU_1
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
7-12
build
See Also
RTDX channels : 0 build(cc,'all',20)
You just completed a full build of the project in CCS IDE. On the Build pane in CCS IDE, you see the record of the build process and the results.
Now, make a change to a file in the project in CCS IDE and save the file. Then rebuild the project with an incremental build.
build(cc,20)
When you look at the Build pane in CCS IDE, the log shows that the build only occurred on the file or files that you changed and saved.
activate
, isrunning
, open
7-13
ccsboardinfo
Purpose
Syntax
Information about boards and simulators known to CCS IDE
Description
Installed Board
Configuration Data
Board number
Board name ccsboardinfo boards = ccsboardinfo ccsboardinfo returns configuration information about each board and processor installed and recognized by CCS. When you issue the function, ccsboardinfo returns the following information about each board or simulator.
Configuration
Item Name boardnum boardname
Description
The number that CCS assigns to the board or simulator. Board numbering starts at 0 for the first board. This is also a property used when you create a new link to CCS IDE.
The name assigned to the board or simulator.
Usually, the name is the board model name, such as TMS320C67xx evaluation module.
If you are using a simulator, the name tells you which processor the simulator matches, such as C67xx simulator. If you renamed the board during setup, your assigned name appears here.
7-14
ccsboardinfo
Installed Board
Configuration Data
Processor number
Processor name
Processor type
Configuration
Item Name procnum procname proctype
Description
The number assigned by CCS to the processor on the board or simulator. When the board contains more than one processor,
CCS assigns a number to each processor, numbering from 0 for the first processor on the first board. For example, when you have two recognized boards, and the second has two processors, the first processor on the first board is procnum
=0, and the first and second processors on the second board are procnum
=1 and procnum
=2. This is also a property used when you create a new link to CCS IDE.
Provides the name of the processor. Usually the name is CPU, unless you assign a different name.
Gives the processor model, such as
TMS320C6x1x for the C6xxx series processors.
Each row in the table that you see displayed represents one digital signal processor, either on a board or simulator. As a consequence, you use the information in the table in the function ticcs to identify a selected board in your PC.
boards = ccsboardinfo returns the configuration information about your installed boards in a slightly different manner. Rather than returning the table containing the information, you get a listing of the board names and numbers, where each board has an associated structure named proc that contains the information about each processor on the board. For example boards = ccsboardinfo
7-15
ccsboardinfo returns boards = name: 'C6xxx Simulator (Texas Instruments)' number: 0 proc: [1x1 struct] where the structure proc contains the processor information for the
C6xxx simulator board: boards.proc
ans = name: 'CPU' number: 0 type: 'TMS320C6200'
Reviewing the output from both function syntaxes shows that the configuration information is the same.
When you combine this syntax with the dot notation used to access the elements in a structure, the result is a way to determine which board to connect to when you construct a link to CCS IDE. For example, when you are creating a link to a board in your PC, the dot notation provides the means to set the board by issuing the command with the boardnum and procnum properties set to the entries in the structure boards
. For example, when you enter boards = ccsboardinfo; boards(1).name
boards(1).proc(2).name
the second board. To create a link to the second processor on the second board, use returns the name of your second installed board and returns the name of the second processor on cc = ticcs('boardnum',boards(1).number,'procnum',...
7-16
ccsboardinfo
Examples boards(1).proc(2).name);
On a PC with both a simulator and a DSP Starter Kit (DSK) board installed, ccsboardinfo returns something similar to the following table. Your display may differ slightly based on what you called your boards when you configured them in CCS Setup Utility:
Board Board
Num Name
Proc Processor Processor
Num Name Type
----------------------------------------------------
1 C6xxx Simulator (Texas Instrum ..0
CPU TMS320C6200
0 DSK (Texas Instruments) 0 CPU_3 TMS320C6x1x
When you have one or more boards that have multiple CPUs, ccsboardinfo returns the following table, or one similar to it:
Board Board
Num Name
Proc Processor
Num Name
Processor
Type
-------------------------------------------------------
2 C6xxx Simulator (Texas Instrum .0
CPU TMS320C6200
1 C6xxx EVM (Texas Instrum ...
1 C6xxx EVM (Texas Instrum ...
0 C64xx Simulator (Texas Instru...0
1
0
CPU_Primary
CPU_Secondary
CPU
TMS320C6200
TMS320C6200
TMS320C64xx
In this example, board number 1 returns two defined CPUs:
CPU_Primary and
CPU_Secondary
. The C6xxx does not in fact have two
CPUs; a second CPU is defined for this example.
To demonstrate the syntax boards = ccsboardinfo
, this example assumes a PC with two boards installed, one of which has three CPUs.
Enter ccsboardinfo
7-17
ccsboardinfo at the MATLAB desktop prompt. You get
Board Board
Num Name
Proc Processor Processor
Num Name Type
-------------------------------------------------
1 C6xxx Simulator (Texas Instrum .0
CPU TMS320C6211
0 C6211 DSK (Texas Instruments)
0 C6211 DSK (Texas Instruments)
0 C6211 DSK (Texas Instruments)
2
1
0
CPU_3
CPU_4_1
CPU_4_2
TMS320C6x1x
TMS320C6x1x
TMS320C6x1x
Now enter boards = ccsboardinfo
MATLAB software returns boards=
2x1 struct array with fields name number proc showing that you have two boards in your PC.
Use the dot notation to determine the names of the boards: boards.name
returns ans=
C6xxx Simulator (Texas Instruments) ans=
C6211 DSK (Texas Instruments)
To identify the processors on each board, again use the dot notation to access the processor information. You have two boards (numbered 0 and
7-18
ccsboardinfo
See Also
1). Board 0 has three CPUs defined for it. To determine the type of the second processor on board 0 (the board whose boardnum
=
0
), enter boards(2).proc(1) which returns ans= name: 'CPU_3' number: 1 type: 'TMS320C6x1x'
Recall that boards(2).proc
gives you this information about the board ans=
3x1 struct array with fields: name number type indicating that this board has three processors (the
3x1 array).
The dot notation is useful for accessing the contents of a structure when you create a link to CCS IDE. When you use ticcs to create your CCS link, you can use the dot notation to tell CCS IDE which processor you are using.
cc = ticcs('boardnum',boards(1).proc(1)) info
, ticcs
7-19
cd
Purpose
Syntax
Description
Examples
Change CCS IDE working directory cd(cc,' directory ’) wd = cd(c,'directory') cd(cc,pwd) cd(cc,' directory ’) changes the CCS IDE working directory to the directory identified by the string dir
. For the change to take effect, dir must refer to an existing directory. You can give the directory string either as a relative path name or an absolute path name including the drive letter. CCS IDE applies relative path names from the current working directory.
wd = cd(c,'directory') directory in wd
.
returns the current CCS IDE working
Using cc to change the CCS IDE working directory does not affect your
MATLAB environment working directory or any MATLAB environment paths. Use the following function syntax to set your CCS IDE working directory to match your MATLAB environment working directory.
cd(cc,pwd) where pwd calls the MATLAB function pwd that shows your present MATLAB working directory and changes your current CCS IDE working directory to match the path name returned by pwd
.
When you open a project in CCS IDE, the folder containing the project becomes the current working folder in CCS IDE. Try opening the tutorial project volume.mak
in CCS IDE.
volume.mak
is in the tutorial files from CCS IDE. When you check the working directory for CCS IDE in the MATLAB environment, you see something like the following result wd=cd(cc) wd =
D:\ticcs\c6000\tutorial\volume1
7-20
See Also where the drive letter
D may be different based on where you installed
CCS IDE.
Now check your MATLAB environment working directory: pwd ans =
J:\bin\win32
Your CCS IDE and MATLAB environment working directories are not the same. To make the directories the same, use the cd(cc,pwd) syntax: cd(cc,pwd) % Set CCS IDE to use your MATLAB working directory.
pwd % Check your MATLAB working directory.
ans =
J:\bin\win32 cd(cc) % Check your CCS IDE working directory.
ans =
J:\bin\win32
You have set CCS IDE and MATLAB environment to use the same working directory.
dir
, load
, open cd
7-21
clear
Purpose
Syntax
Description
See Also
Remove links to CCS IDE and RTDX interface, or clear type entries in type objects clear(cc) clear(' all ') clear(cc.type,' all ') clear(cc.type,typedefname) clear(cc) clears the link associated with cc
. This is the last step in any development effort that uses links. Clear links that you no longer need for your work to avoid unforeseen problems. Calling clear executes the object destructors that delete the link object and all associated memory and resources.
clear(' all ') clears all existing links to CCS IDE and RTDX interface.
This is the final step in any development process that uses links.
Clear links that you no longer need for your work to avoid unforeseen problems. Calling clear with the ’ all
’ option executes the object destructors to delete all the link objects and all associated memory and resources.
Note If a ticcs object exists when you close CCS IDE, the application does not close. Microsoft Windows ® software moves it to the background.
After you clear all open links to CCS IDE, or close MATLAB software,
CCS IDE actually closes the application. You can verify if CCS IDE is running by checking the Microsoft Windows Task Manager.
clear(cc.type,' all ') object obj
.
clears all user-defined type entries in the type clear(cc.type,typedefname) clears the information on the specified user-defined type entry typedefname in the type object obj
.
add
, ticcs
, close
, disable
7-22
close
Purpose Close CCS IDE files or RTDX channel
Note close(cc,filename,'text') produces an error.
Support for close(rx,...) on C5000 and C6000 processors will be removed in a future version.
Syntax
Description close(cc,'filename','type') close(rx, 'channel1' , 'channel2' ,...) close(rx, 'channel' ) close(cc,'filename','type') filename of type ’ type
’.
type closes the file in CCS IDE identified by identifies the type of file to close. This can be either project files when you use ’ project' for the type option, or text files when you use
'text' for the type option. To close a specific file in CCS IDE, filename must match exactly the name of the file to close. If you replace filename with
'all'
, close terminates every open file whose type matches the type option. File types recognized by close include these extensions.
type String
'project'
'text'
Affected files
Project files with the
.pjt
extension.
All files with these extensions —
.a*
,
.c
,
.cc
,
.ccx
,
.cdb
,
.cmd
,
.cpp
,
.lib
,
.o*
,
.rcp
, and
.s*
.
Note that
'text' does not close
.cfg
files.
When you replace filename with the null entry
[]
, close shuts the current active file window in CCS IDE. When you specify ’ project' for the type option, it closes the active project.
Note close does not save files before shutting them. Closing files can result in lost data if you have changed the files after you last saved them. Use save to preserve your changes before you close files.
7-23
close
Examples close(rx, 'channel1' , 'channel2' ,...) closes the channels specified by the strings channel1
, channel2
, and so on as defined in rx
.
close(rx, 'channel' ) channel closes the specified channel. When you set to
'all'
, this function closes all the open channels associated with rx
.
To avoid conflicts, do not name channels “all” or “ALL.”
Using close with Files and Projects
To clarify the different close options, here are six commands that close open files or projects in CCS IDE.
Command close(cc,'all','project') close(cc,'my.pjt','project') close(cc,[],project') close(cc,'all','text') close(cc,'my_source.cpp','text') close(cc,[],'text')
Result
Close all open projects in
CCS IDE.
Close the project my.pjt.
Close the active project.
Close all open text files.
This includes source file, libraries, command files, and others.
Close the text file my_source.cpp
.
Close the active file window.
Using close with RTDX
When you plan to use RTDX to communicate with a processor, you open and enable channels to the board and processor. For example, to communicate with the processor on your installed board, you use open to set up a channel, as follows: cc = ticcs('boardnum',1,'procnum',0)
7-24
See Also rx=cc.rtdx % Create an alias to the RTDX portion of this link.
open(rx,'ichan','w') % Open a channel for write access.
enable(rx,'ichan') % Enable the open channel for use.
After you finish using the open channel, you must close it to avoid difficulties later on.
close(rx,'ichan')
Or to close all open channels, you could use close(rx,'all') disable
, open close
7-25
configure
Purpose Define size and number of RTDX channel buffers
Note configure produces a warning on C5000 and C6000 processors and will be removed in a future version.
Syntax
Description
Examples configure(rx,length,num) configure(rx,length,num) sets the size of each main (host) buffer, and the number of buffers associated with rx
. Input argument length is the size in bytes of each channel buffer and num is the number of channel buffers to create.
Main buffers must be at least 1024 bytes, with the maximum defined by the largest message. On 16-bit processors, the main buffer must be four bytes larger than the largest message. On 32-bit processors, set the buffer to be eight bytes larger that the largest message. By default, configure num creates four, 1024-byte buffers. Independent of the value of
, CCS IDE allocates one buffer for each processor.
Use CCS to check the number of buffers and the length of each one.
Create a default link to CCS and configure six main buffers of 4096 bytes each for the link.
cc=ticcs % Create the CCS link with default values.
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
7-26
configure
See Also rx=cc.rtdx
RTDX channels : 0
% Create an alias to the rtdx portion.
configure(rx,4096,6) % Use the alias rx to configure the length
% and number of buffers.
After you configure the buffers, use the RTDX tools in CCS IDE to verify the buffers.
readmat
, readmsg
, write
, writemsg
7-27
datatypemanager
Purpose
Syntax
Description
Open Data Type Manager datatypemanager version.
produces a warning and will be removed in a future datatypemanager(cc) cc2 = datatypemanager(cc) datatypemanager(cc) opens the Data Type Manager (DTM) with data type information about the project to which cc refers. With the type manager open, you can add type definitions (typedefs) from your project to MATLAB software so it can interpret them. You add your typedefs because MATLAB software cannot determine or understand typedefs in your function prototypes remotely across the interface to CCS.
Each custom type definition in your prototype must appear on the
Typedef name (Equivalent data type) list before you can use the typedef from MATLAB software with a function object.
When the DTM opens, a variety of information and options displays in the Data Type Manager dialog box:
• Typedef name (Equivalent data type) — provides a list of default data types. When you create a typedef, it appears added to this list.
• Add typedef — opens the Add Typedef dialog box so you can add one or more typedefs to your project. Your added typedef appears on the Typedef name (Equivalent data type) list. Also, when you pass the cc object to the DTM, and then add a typedef, the command cc.type
returns a list of the data types in the object including the typedefs you added.
• Remove typedef — removes a selected typedef from the Typedef
name (Equivalent data type) list.
• Load session — loads a previously saved session so you can use the typedefs you defined earlier without reentering them.
7-28
datatypemanager
• Refresh list — updates the list in Typedef name (Equivalent
data type). Refreshing the list ensures the contents are current. If you changed your project data type content or loaded a new project, this updates the type definitions in the DTM.
• Close — closes the DTM and prompts you to save the session information. This is the only way to save your work in this dialog box. Saving the session creates an M-file you can reload into the
DTM later.
Clicking Close in the DTM prompts you to save your session. Saving the session creates an M-file that contains operations that create your final list of data types, identical to the data types in the Typedef
name list.
In the stored M-file, you find a function that includes the add and remove operations you used to create the list of data types in the
DTM. For each time you added a typedef in the DTM, the M-file contains an add command that adds the new type definition to the cc.type
property of the object. When you remove a data type, you see an equivalent clear command that removes a data type from the cc.type
object.
Note All operations that add and remove data types in the DTM during a session are stored in the generated M-file, including mistakes you make while creating or removing type definitions.
When you load your saved session into the DTM, you see the same error messages you saw during the session. Keep in mind that you have already corrected these errors.
The first line of the M-file is a function definition, where the name of the function is the filename of the session you saved.
cc2 = datatypemanager(cc) returns the cc2 ticcs object while it opens the DTM.
cc2 represents an alias to cc
. Objects cc and cc2 are not
7-29
datatypemanager independent objects. When you change a property of either cc or cc2
, the corresponding property in the other object changes as well.
Data Type Manager
When you create objects that access functions in a project, MATLAB software can recognize most data types that you use in your project.
However, if the functions use one or more custom type definitions,
MATLAB software cannot recognize the data type and cannot work with the function. To overcome this problem, the Data Type Manager provides the capability to define your typedefs to MATLAB software.
Entering datatypemanager(cc) at the MATLAB prompt opens the DTM.
7-30
datatypemanager
Before you add a type definition, the Typedef name (Equivalent data
type) list shows a number of data types already defined:
•
Void(void)
— void return argument for a function
•
Float(float)
— float data type used in a function input or return argument
•
Double(double)
— double data type used in a function input or return argument
•
Long(long)
— long data type used in a function input or return argument
•
Int(int)
— int data type used in a function input or return argument
7-31
datatypemanager
• Short(short)
— short data type used in a function input or return argument
• Char(char)
— character data type used in a function input or return argument
The lowercase versions of the data types appear because MATLAB software does not recognize the initial capital versions automatically. In the data type entry, the project data type with the initial capital letter is mapped to the lowercase MATLAB software data type.
Although not recommended, you can use mixed case typedef names, so long as the equivalent data type uses lowercase. In particular, typedefs that refer to other typedefs should resolve to a data type in lowercase.
Adding a type definition adds the new data type to the list of typedefs.
Remove any existing or new type definitions with the Remove typedef option.
7-32
datatypemanager
Add Typedef Dialog Box
Clicking Add typedef in the DTM opens the List of Known Data
Types dialog box. As shown in this figure, you add your custom type definitions here.
When you have used custom type definitions in your program or project, you must specify what they mean to MATLAB software. The Typedef option lets you enter the name of the typedef in your program and select an equivalent type from the Known Types list. By defining your type definitions in this dialog box, you enable MATLAB software to understand and work with them. For example, when you return the data to the MATLAB workspace or send data from the workspace to your project.
After you define each typedef, the Equivalent type option shows you the type you specified for each type definition, either when you enter it in the Typedef field or select it from the Known Types list.
7-33
datatypemanager
Options in this dialog box let you review the data types you are using or that are available in your projects. By selecting different data type categories from the Known Types list, you can see all of the supported data types.
7-34
From the list of known data types, choose one of the following data type categories:
• MATLAB Types
Data Type int8 uint8 int16 uint16 int32
Description
8-bit integer data
Unsigned 8-bit integer data
16-bit integer data
Unsigned 16-bit integer data
32-bit integer data
datatypemanager
Data Type uint32 int64 uint64 single double
•
TI C Types
Data Type char unsigned char signed char short unsigned short signed short int unsigned int signed int long unsigned long signed long float
Description
Unsigned 32-bit integer data
64-bit integer data
Unsigned 64-bit integer data
32-bit IEEE ® floating-point data
64-bit IEEE floating-point data
Description (For C6000 Compiler)
8-bit character data with a sign bit
8-bit character data
8-bit character data
16-bit numeric data
Unsigned 16-bit numeric data
16-bit numeric data with sign designation
32-bit integer numeric data
32-bit integer numerics without sign information
32-bit integer numerics with sign information
40-bit data with sign bit. Note that this is not the same as int
.
40-bit data without information about the sign of the number
40-bit data without information about the sign of the number represented
32-bit numeric data
7-35
datatypemanager
Data Type double long double
Description (For C6000 Compiler)
64-bit numeric data
On the C2000 and C5000 processors –
32-bit IEEE floating-point data
On the C6000 processors – 64-bit IEEE floating-point data
Numbers of bits change depending on the processor and compiler.
For more information about Texas Instruments data types and specific processors or compilers, refer to your compiler documentation from Texas Instruments processors.
•
TI Fixed-Point Types
Data Type
Q0.15
Q0.31
Description
Numeric data with 16-bit word length and
15-bit fraction length
32-bit word length numeric data with fraction length of 31 bits
• Struct, Union, Enum types
If the program you load on the processor includes one or more of struct
, union
, or enum data types, the type definitions show up on this list. Until you load a program on the processor, this list is empty and trying to access the list generates an error message.
Load a program, if you have not already done so, by clicking Load
CCS Program and selecting a .
out file to load on your processor.
• When the load process works, you see the name of the file you loaded in Loaded program. Otherwise you get an error message that the load failed.
Only programs that you load from this dialog box appear in Program
loaded. Programs that you already loaded on your processor do not
7-36
datatypemanager
Examples appear in the Loaded program option. MATLAB software cannot determine what program you have loaded.
• Others such as pointers and typedefs
Like struct
, union
, and enum data types, the
Others list is empty until you define one or more typedefs. Unlike the
Struct, Union,
Enum types list, loading a program does not populate this list with typedefs from the program. You must define them explicitly in this dialog box.
Custom type definitions can refer to other typedefs in your project.
Nesting typedefs works after you have define the necessary custom types. To create a typedef that uses another typedef, define the nested
(inner) definition, and then define the outer definition as a pointer to
the nested definition. Refer to Examples to see this in operation.
Program loaded — tells you the name of the program loaded on the processor, if you loaded the program from this dialog box. If not,
Program loaded does not report the program name.
Load CCS Program — opens the Load Program dialog box so you can select and load a .
out file to your processor.
This set of examples show how to create custom type definitions with the DTM. Each example shows the List of Known Data Types dialog box with the selections or entries needed to create the typedef.
Start the examples by creating a ticcs object: cc=ticcs;
Now start the DTM with the cc object. So far you have not loaded a file on the processor.
datatypemanager(cc);
With the DTM open, you can create a few custom data types.
7-37
datatypemanager
First Example
Create a typedef ( typedef1
) that uses a MATLAB software data type.
typedef1 uses the equivalent data type uint32
.
7-38
datatypemanager
Second Example
Create a second typedef ( typedef2
) that uses one of the
TI C data types. Define typedef2 to use the signed long data type.
7-39
datatypemanager
Third Example
Create a typedef ( typedef3
) that refers to another typedef ( typedef2
).
Call this a nested typedef.
Notice that the referenced typedef, typedef2
, is entered as a pointer
(indicated by the added asterisk). Using the pointer form lets MATLAB software recognize the data type that typedef2 represents. If you do not use the pointer, MATLAB software converts typedef3 to a default value equivalent data type, in this case, int
.
7-40
datatypemanager
The next figure shows typedef4 created to use typedef2 rather than typedef2* for a nested typedef. Under Equivalent type, typedef4 has an equivalent data type of typedef2
, as specified. But, when you look at the list of known data types in the Data Type Manager dialog box, you see that typedef4 maps to int
, not typedef2
, or eventually signed long
.
Here is the DTM after you create all the example custom data types.
Take note of typedef4 in this listing. You see typedef4 defaults to an equivalent data type int
, where typedef3
, also a nested type definition, retains the equivalent data type you assigned. Now you are ready to use a function that includes your custom type definitions in your hardware-in-the-loop development work.
7-41
datatypemanager
7-42
delete
Purpose
Syntax
Description
Remove debug points in addresses or source files in CCS delete(cc,addr, ' type ' ) delete(cc,addr,'type',timeout) delete(cc,addr) delete(cc,filename,line, ' type ' ) delete(cc,filename,line, ' type ' ,timeout) delete(cc,filename,line) delete(cc, 'all' ) delete(cc, 'all' , 'break' ,timeout) delete(cc,addr, ' type ' ) removes a debug point located at the memory address identified by addr for your processor digital signal processor.
Object cc identifies which processor has the debug point to delete.
CCS provides several types of debug points specified by type
. To learn more about the behavior of the various debugging points refer to your
CCS documentation. Options for type include the following to remove breakpoints and probe points:
• 'break'
— removes a breakpoint. This is the default.
• ' '
— same as
'break'
.
• 'probe'
— removes a probe point.
When you use it, delete operates in blocking mode, meaning that after you issue the delete command, you do not regain control in the MATLAB environment until the delete operation is completed successfully — you are blocked from further processing.
delete waits for the period defined by either timeout or cc.timeout
. If the delete operation does not get completed within the specified time period, delete returns an error and control.
Unlike deleting break and probe points in CCS, you cannot enter addr as a C function name, valid C expression, or a symbol name.
When the type you specify does not match the debug point type at the selected location, or no debug point exists, Embedded IDE Link CC
7-43
delete returns an error reporting that it could not find the specified debugging point.
delete(cc,addr,'type',timeout) timeout adds the optional input parameter that determines how long Embedded IDE Link CC waits for a response to the request to delete a breakpoint. If the response is not received before the timeout period expires, the deletion process fails with a timeout error. The timeout input argument is valid only when you are deleting a breakpoint. When you omit the timeout argument, delete uses the default value defined by cc.timeout
delete(cc,addr) is the same as the previous syntax except the function defaults to
'break' for removing a breakpoint.
delete(cc,filename,line, ' type ' ) lets you specify the line from which you are removing the debug point. Argument line specifies the line number in the source file file in CCS.
line
, in decimal notation, defines the line number of the debugging point to remove. To identify the source file, argument filename contains the name of the file in
CCS, entered as a string in single quotation marks. Do not include the path to the file.
delete ignores the path information.
type accepts one of two strings — break or probe
— as defined previously. When the type of debugging point you specify with the type string does not match the debug point type at the specified location, or no debug point exists, Embedded IDE Link CC returns an error that it could not find the debug point.
delete(cc,filename,line, ' type ' ,timeout) adds the optional input parameter timeout that determines how long Embedded IDE Link
CC waits for a response to the request to delete a breakpoint. If the response is not received before the timeout period expires, the deletion process fails with a timeout error. The timeout input argument is valid only when you are deleting a breakpoint. When you omit the timeout argument, delete uses the default value defined by cc.timeout
delete(cc,filename,line) defaults to ’ break
’ to remove a breakpoint.
delete(cc, 'all' ) removes all valid breakpoints in the project source files. This does not remove probe points and it does not remove invalid breakpoints..
7-44
delete
See Also delete(cc, 'all' , 'break' ,timeout) removes all of the valid breakpoints in the project source files. This command does not remove probe points and it does not remove invalid breakpoints. Note that you can use the optional input parameter timeout that determines how long Embedded IDE Link CC waits for a response to the request to delete all of the debug points. If the response is not received before the timeout period expires, the deletion process fails with a timeout error. When you omit the timeout argument, delete uses the default value defined by cc.timeout
.
address
, insert
, run
7-45
dir
Purpose
Syntax
Description
See Also
List files in current CCS IDE working directory dir(cc) dir(cc) lists the files and directories in the current CCS IDE working directory. This does not reflect your MATLAB software working directory or change the working directory.
Use cd to change your CCS IDE working directory.
cd
, open
7-46
disable
Purpose Disable RTDX interface, specified channel, or all RTDX channels
Note Support for disable on C5000 and C6000 processors will be removed in a future version.
Syntax
Description
Examples disable(rx,' channel ') disable(rx,' all ') disable(rx) disable(rx,' channel ') disables the open channel specified by the string channel
, for rx
. Input argument rx represents the RTDX portion of the associated link to CCS IDE.
disable(rx,' all ') disables all the open channels associated with rx
.
disable(rx) disables the RTDX interface for rx
.
Important Requirements for Using disable
On the processor side, disable depends on RTDX to disable channels or the interface. You must meet the following requirements to use disable
:
1
The processor must be running a program.
2
You enabled the RTDX interface.
3
Your processor program polls periodically.
When you have opened and used channels to communicate with a processor, you should disable the channels and RTDX before ending your session. Use disable to switch off open channels and disable
RTDX, as follows: disable(cc.rtdx,'all') % Disable all open RTDX channels.
disable(cc.rtdx) % Disable RTDX interface.
7-47
disable
See Also close
, enable
, open
7-48
display
Purpose Display properties of object that refers to CCS IDE or RTDX link
Note display(rx) produces a warning on C5000 and C6000 processors and will be removed in a future version.
Syntax
Description display(cc) display(rx) display(objectname) display(cc.type)
This function is similar to omitting the closing semicolon from an expression on the command line, except that display does not display the variable name.
display provides a formatted list of the property names and property values for a ticcs object. To return the configuration data, display calls the function disp
. To return a list of object properties, listed by the actual property names, use get with the object.
display(cc) returns the information about the cc object, listing the properties and values assigned to cc
.
display(rx) returns the information about the rtdx object that is part of a cc object, listing the properties and values assigned to cc.rtdx
.
display(objectname) objectname returns the properties and property values for
. This syntax supports all objects except cc
, rtdx
, and cc.type
.
display(cc.type) cc.type
returns the properties and property values for the object. Note that the properties associate with the cc object.
The following example illustrates the default display for a link to CCS
IDE: cc = ticcs; display(cc)
7-49
display
Examples
See Also
TICCS Object:
API version
Processor type
Processor name
Running?
Board number
: 1.0
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
Using display with Multiprocessor Hardware
To support boards that contain more than one processor, display behaves slightly differently when cc accesses multiprocessor boards.
The syntax display(cc) returns information about all of the members of the object. When the processor has multiple processors, the information returned includes the details of all of the available processors on the processor.
Try this example to see the display for an RTDX link to a processor: cc = ticcs; rx=(cc.rtdx) % Assign the RTDX portion of cc to rx.
: 0 RTDX channels display(rx)
RTDX channels : 0 get
7-50
enable
Purpose Enable RTDX interface, specified channel, or all RTDX channels
Note Support for enable on C5000 and C6000 processors will be removed in a future version.
Syntax
Description enable(rx,' channel ') enable(rx,' all ') enable(rx) enable(rx,' channel ') channel enables the open channel specified by the string
, for RTDX link rx
. The input argument rx represents the
RTDX portion of the associated link to CCS IDE.
enable(rx,' all ') enables all the open channels associated with rx
.
enable(rx) enables the RTDX interface for rx
.
Important Requirements for Using enable
On the processor side, enable depends on RTDX to enable channels.
You must meet the following requirements to use enable
:
1
The processor must be running a program when you enable the
RTDX interface. When the processor is not running, the state defaults to disabled.
2
You must enable the RTDX interface before you enable individual channels.
3
Channels must be open.
4
Your processor program must poll periodically.
5
Using code in the program running on the processor to enable channels overrides the default disabled state of the channels.
7-51
enable
Examples
See Also
To use channels to RTDX, you must both open and enable the channels: cc = ticcs; % Create a new connection to the IDE.
enable(cc.rtdx) % Enable the RTDX interface.
open(cc.rtdx,'inputchannel','w') % Open a channel for sending
% data to the processor.
enable(cc.rtdx,'inputchannel') % Enable the channel so you can use
% it.
disable
, open
7-52
flush
Purpose Flush data or messages from specified RTDX channels
Note flush support C5000 and C6000 processors will be removed in a future version.
Syntax
Description flush(rx,channel,num,timeout) flush(rx,channel,num) flush(rx,channel,[],timeout) flush(rx,channel) flush(rx,' all ') flush(rx,channel,num,timeout) removes num oldest data messages from the RTDX channel queue specified by channel in rx
. To determine how long to wait for the function to complete, flush uses timeout
(in seconds) rather than the global timeout period stored in rx
.
flush applies the timeout processing when it flushes the last message in the channel queue, because the flush function performs a read to advance the read pointer past the last message. Use this calling syntax only when you specify a channel configured for read access.
flush(rx,channel,num) removes the num oldest messages from the
RTDX channel queue in rx specified by the string channel
.
flush uses the global timeout period stored in rx to determine how long to wait for the process to complete. Compare this to the previous syntax that specifies the timeout period. Use this calling syntax only when you specify a channel configured for read access.
flush(rx,channel,[],timeout) removes all data messages from the
RTDX channel queue specified by channel in rx
. To determine how long to wait for the function to complete, flush uses timeout
(in seconds) rather than the global timeout period stored in rx
.
flush applies the timeout processing when it flushes the last message in the channel queue, because flush performs a read to advance the read pointer past the last message. Use this calling syntax only when you specify a channel configured for read access.
7-53
flush
Examples
See Also flush(rx,channel) removes all pending data messages from the
RTDX channel queue specified by channel in rx
. Unlike the preceding syntax options, you use this statement to remove messages for both read-configured and write-configured channels.
flush(rx,' all ') queues.
removes all data messages from all RTDX channel
When you use flush with a write-configured RTDX channel, Embedded
IDE Link CC sends all the messages in the write queue to the processor.
For read-configured channels, flush removes one or more messages from the queue depending on the input argument num you supply and disposes of them.
To demonstrate flush
, this example writes data to the processor over the input channel, then uses flush to remove a message from the read queue for the output channel: cc = ticcs; rx = cc.rtdx; open(rx,'ichan','w'); enable(rx,'ichan'); open(rx,'ochan','r'); enable(rx,'ochan'); indata = 1:10; writemsg(rx,'ichan',int16(indata)); flush(rx,'ochan',1);
Now flush the remaining messages from the read channel: flush(rx,'ochan','all'); enable
, open
7-54
Purpose
Syntax
Description
Examples
Access object properties get(cc,'propertyname') v = get(cc,'propertyname') get(rx,'propertyname') get(rx) v = get(rx) get(objname,'propertyname') get(cc,'propertyname') propertyname for link cc
.
returns the property value associated with v = get(cc,'propertyname') returns a structure v whose field names are the link cc property names and whose values are the current values of the corresponding properties.
cc must be a link. If you do not specify an output argument, MATLAB software displays the information on the screen.
get(rx,'propertyname') propertyname for link rx
.
returns the property value associated with get(rx) returns all the properties and property values identified by the link rx
.
v = get(rx) rx returns a structure v whose field names are the link property names and whose values are the current values of the corresponding properties.
rx must be a link. If you do not specify an output argument, MATLAB software displays the information on the screen.
get(objname,'propertyname') with propertyname for objname
.
returns the property value associated
After you create a connection for CCS IDE and RTDX, get provides a way to review the properties of the connection.
cc=ticcs
TICCS object: get
7-55
get
Processor type
Processor name
Running?
Board number
: C67
: CPU
: No
: 0
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0
RTDX channels : 0
RTDX links work slightly differently—they have more syntaxes available. Create an alias rx to the RTDX portion of cc
, then use the alias with get
: rx=cc.rtdx
RTDX channels get(rx) ans =
: 0 numChannels: 0
RtdxChannel: {'' [] ''} timeout: 10 v=get(rx) v = numChannels: 0
RtdxChannel: {'' [] ''} timeout: 10 v.timeout
ans =
10
7-56
Purpose
Syntax
Description
Examples
Terminate execution of process running on processor halt(cc,timeout) halt(cc) halt(cc,timeout) immediately stops program execution by the processor. After the processor stops, halt returns to the host.
timeout defines, in seconds, how long the host waits for the processor to stop running. To resume processing after you halt the processor, use run
.
Also, the read(cc,'pc') function can determine the memory address where the processor stopped after you use halt
.
timeout defines the maximum time the routine waits for the processor to stop. If the processor does not stop within the specified timeout period, the routine returns with a timeout error.
halt(cc) immediately stops program execution by the processor. After the processor stops, halt returns to the host. In this syntax, the timeout period defaults to the global timeout period specified in cc
. Use get(cc) to determine the global timeout period.
Using halt with Multiprocessor Boards
When you issue a halt from the command line, it applies to every processor that the cc object represents. Thus halt stops every running processor for the object.
Use one of the provided demonstration programs to show how halt works. From the CCS IDE demonstration programs, load and run volume.out
.
At the MATLAB software prompt create a link to CCS IDE cc = ticcs
Check whether the program volume.out
is running on the processor.
isrunning(cc) halt
7-57
halt
See Also ans =
1 cc.isrunning % Alternate syntax for checking the run status.
ans =
1 halt(cc) % Stop the running application on the processor.
isrunning(cc) ans =
0
Issuing the halt stopped the process on the processor. Checking in CCS
IDE shows that the process has stopped.
ticcs
, isrunning
, run
7-58
Purpose Information about processor
Note Support for info(rx) on C5000 and C6000 processors will be removed in a future version.
Syntax
Description info = info(cc) info = info(rx) info = info(cc) returns the property names and property values associated with the processor accessed by cc
.
info is a structure containing the following information elements and values:
Structure Element Data Type info.procname
String info.isbigendian
info.family
Boolean
Integer
Description
Processor name as defined in the CCS setup utility.
In multiprocessor systems, this name reflects the specific processor associated with cc
.
Value describing the byte ordering used by the processor. When the processor is big-endian, this value is
1
. Little-endian processors return
0
.
Three-digit integer that identifies the processor family, ranging from 000 to 999. For example, 320 for Texas Instruments digital signal processors.
info
7-59
info
Structure Element Data Type info.subfamily
Decimal info.timeout
Description
Decimal representation of the hexadecimal identification value that TI assigns to the processor to identify the processor subfamily. IDs range from 0x000 to 0x3822. Use dec2hex to convert the value in info.subfamily
to standard notation. For example dec2hex(info.subfamily)
Integer produces ’67’ when the processor is a member of the
67xx processor family.
Default timeout value MATLAB software uses when transferring data to and from CCS. All functions that use a timeout value have an optional timeout input argument. When you omit the optional argument,
MATLAB software uses this default value – 10s.
info = info(rx) returns info as a cell arraying containing the names of your open RTDX channels.
Using info with Multiprocessor Boards
Method info works with processors that have more than one processor by returning the information for each processor accessed by the cc object you created with ticcs
. The structure of information returned is identical to the single processor case, for every included processor.
Examples On a PC with a simulator configured in CCS IDE, info returns the configuration for the processor being simulated: info(cc) ans = procname: 'CPU' isbigendian: 0
7-60
See Also family: 320 subfamily: 103 timeout: 10
This example simulates the TMS320C6211 processor running in little-endian mode. When you use CCS Setup Utility to change the processor from little-endian to big-endian, info shows the change.
info(cc) ans = procname: 'CPU' isbigendian: 1 family: 320 subfamily: 103 timeout: 10
If you have two open channels, chan1 and chan2
, info = info(rx) returns info =
'chan1'
'chan2' where info is a cell array. You can dereference the entries in info to manipulate the channels. For example, you can close a channel by dereferencing the channel in info in the close function syntax.
close(rx.info{1,1}) ticcs
, dec2hex
, get info
7-61
insert
Purpose
Syntax
Description
Add debug point to source file or address in CCS insert(cc,addr, ' type ' ) insert(cc,addr, ' type ' ,timeout) insert(cc,addr) insert(cc,filename,line, ' type ' ) insert(cc,filename,line, ' type ' ,timeout) insert(cc,filename,line) insert(cc,addr, ' type ' ) adds a debug point located at the memory address identified by addr for your processor digital signal processor.
The link cc identifies which processor has the debug point to insert.
CCS provides several types of debug points specified by type
. Options for type include the following strings to define Breakpoints, Probe
Points, and Profile points:
• 'break'
— add a breakpoint. It defines a point at which program execution stops.
• ''
— same as
'break'
.
• 'probe'
— add a Probe Point that updates a CCS window during program execution. When CCS connects your probe point to a window, the window gets updated only when the executing program reaches the Probe Point.
• 'profile'
— add a point in an executing program at which CCS gathers statistics about events that occurred after encountering the previous profile point, or from the start of your program.
When you use it, insert operates in blocking mode, meaning that after you issue the insert command, you do not regain control in the MATLAB environment until the insert breakpoint operation is completed successfully—you are blocked from further processing.
insert waits for the period defined by either timeout or cc.timeout
. If the insert operation does not get completed within the specified time period, insert returns an error and control.
7-62
insert
When you use the line input argument to insert a breakpoint on a specified line, line must represent a valid line. If line does not specify a valid line, insert returns an error and does not insert the breakpoint.
Enter addr as a hexadecimal address, not as a ANSI C function name, valid ANSI C expression, or a symbol name.
To learn more about the behavior of the various debugging points refer to your CCS documentation.
insert(cc,addr, ' type ' ,timeout) adds the optional input parameter timeout that determines how long Embedded IDE Link CC waits for a response to a request to insert a breakpoint. If the response is not received before the timeout period expires, the insertion process fails with a timeout error. Adding the timeout input argument is valid only when you are inserting a breakpoint. When you omit the timeout argument, insert uses the default value defined by cc.timeout
insert(cc,addr) is the same as the previous syntax except the type string defaults to ’ break
’ for inserting a Breakpoint.
insert(cc,filename,line, ' type ' ) lets you specify the line where you are inserting the debug point.
line
, in decimal notation, specifies the line number in filename in CCS where you are adding the debug point.
To identify the source file, filename contains the name of the file in
CCS, entered as a string in single quotation marks. Do not include the path to the file.
insert ignores the file path information if you add it to filename
.
type accepts one of three strings— break
, probe
, or profile
—as defined previously.
When the line or file you specified does not exist, Embedded IDE Link
CC returns an error explaining that it could not insert the debug point.
insert(cc,filename,line, ' type ' ,timeout) adds the optional input parameter timeout that determines how long Embedded IDE Link CC waits for a response to a request to insert a breakpoint. If the response is not received before the timeout period expires, the insertion process fails with a timeout error. Adding the timeout input argument is valid only when you are inserting a breakpoint. When you omit the timeout
7-63
insert
Example insert(cc,filename,line) breakpoint.
defaults to type
'break' to insert a
Open a project in CCS IDE, such as volume.pjt
in the tutorial folder where you installed CCS IDE. Use Embedded IDE Link CC functions to open the project and activate the appropriate source file where you add the breakpoint. Remember to load the program file volume.out
so you can access symbols and their addresses.
cd (cc,'c:\ti\tutorial\sim62xx\volume1') % Default install; wd=cd(cc); wd = c:\ti\tutorial\sim62xx\volume1 open(cc,'volume.pjt'); build(cc, 30);
Now add a breakpoint and a probe point.
insert(cc,15424,'break') % Adds a breakpoint at symbol "main" insert(cc,'volume.c',47,'probe') % Adds a probe point on line 47
Switch to CCS IDE and open volume.c
. Note the blue diamond and red circle in the left margin of the volume.c
listing. Red circles indicate
Breakpoints and blue diamonds indicate Probe Points.
Use symbol to return a structure listing the symbols and their addresses for the current program file.
symbol returns a structure that contains all the symbols. To display all the symbols with addresses, use a loop construct like the following: for k=1:length(s),disp(k),disp(s(k)),end where structure s holds the symbols and addresses.
7-64
See Also address
, remove
, run insert
7-65
isenabled
Purpose Determine whether RTDX link is enabled for communications
Note Support for isenabled on C5000 and C6000 processors will be removed in a future version.
Syntax
Description isenabled(rx,'channel') isenabled(rx) isenabled(rx,'channel') returns ans=1 when the RTDX channel specified by string ’ channel
’ is enabled for read or write communications.
When
'channel' has not been enabled, isenabled returns ans=0
.
isenabled(rx) returns ans=1 when RTDX has been enabled, independent of any channel. When you have not enabled RTDX you get ans=0 back.
Important Requirements for Using isenabled
On the processor side, isenabled depends on RTDX to determine and report the RTDX status. Therefore the you must meet the following requirements to use isenabled
.
1
The processor must be running a program when you query the RTDX interface.
2
You must enable the RTDX interface before you check the status of individual channels or the interface.
3
Your processor program must be polling periodically for isenabled to work.
7-66
isenabled
Examples
See Also
Note For isenabled to return reliable results, your processor must be running a loaded program. When the processor is not running, isenabled returns a status that may not represent the true state of the channels or RTDX.
With a program loaded on your processor, you can determine whether
RTDX channels are ready for use. Restart your program to be sure it is running. The processor must be running for isenabled to work, as well as for enabled to work. This example creates a ticcs object cc to begin.
cc.restart
cc.run('run'); cc.rtdx.enable('ichan'); cc.rtdx.isenabled('ichan')
MATLAB software returns 1 indicating that your channel
'ichan' is enabled for RTDX communications. To determine the mode for the channel, use cc.rtdx
to display the properties of object cc.rtdx
.
clear
, disable
, enable
7-67
isreadable
Purpose Determine whether MATLAB software can read specified memory block
Note Support for isreadable(rx,'channel') on C5000 and C6000 processors will be removed in a future version.
Syntax
Description isreadable(cc,address, 'datatype' ,count) isreadable(cc,address, 'datatype' ) isreadable(rx,'channel') isreadable(cc,address, 'datatype' ,count) returns 1 if the processor referred to by cc can read the memory block defined by the address
, count
, and datatype input arguments. When the processor cannot read any portion of the specified memory block, isreadable returns 0.
You use the same memory block specification for this function as you use for the read function.
The data block being tested begins at the memory location defined by address
.
count determines the number of values to be read.
datatype defines the format of data stored in the memory block.
isreadable uses the datatype string to determine the number of bytes to read per stored value. For details about each input parameter, read the following descriptions.
address
— isreadable uses address to define the beginning of the memory block to read. You provide values for address as either decimal or hexadecimal representations of a memory location in the processor.
The full address at a memory location consists of two parts: the offset and the memory page, entered as a vector [ location
, page
], a string, or a decimal value.
When the processor has only one memory page, as is true for many digital signal processors, the page portion of the memory address is 0.
By default, ticcs sets the page to
0 at creation if you omit the page property as an input argument. For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using the memory location without the page value.
7-68
isreadable
Examples of Address Property Values
Property
Value
’1F’
10
[18,1]
Address Type Interpretation
String Location is 31 decimal on the page referred to by cc.page
Decimal Address is 10 decimal on the page referred to by cc.page
Vector Address location 10 decimal on memory page 1 ( cc.page = 1
)
To specify the address in hexadecimal format, enter the address property value as a string.
isreadable interprets the string as the hexadecimal representation of the desired memory location. To convert the hex value to a decimal value, the function uses hex2dec
. Note that when you use the string option to enter the address as a hex value, you cannot specify the memory page. For string input, the memory page defaults to the page specified by cc.page
.
count
— a numeric scalar or vector that defines the number of datatype values to test for being readable. To assure parallel structure with read
, count can be a vector to define multidimensional data blocks.
This function always tests a block of data whose size is the product of the dimensions of the input vector.
datatype
— a string that represents a MATLAB software data type.
The total memory block size is derived from the value of count and the datatype you specify.
datatype determines how many bytes to check for each memory value.
isreadable supports the following data types: datatype
String
'double'
Number of
Bytes/Value Description
8 Double-precision floating point values
7-69
isreadable datatype
String
'int8'
'int16'
'int32'
'single'
'uint8'
'uint16'
'uint32'
Number of
Bytes/Value Description
1 Signed 8-bit integers
2 Signed 16-bit integers
4 Signed 32-bit integers
4 Single-precision floating point data
1 Unsigned 8-bit integers
2 Unsigned 16-bit integers
4 Unsigned 32-bit integers
Like the iswritable
, write
, and read functions, isreadable checks for valid address values. Illegal address values would be any address space larger than the available space for the processor – 2
C6xxx processor family and 2 16
32 for the for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
isreadable(cc,address, 'datatype' ) returns 1 if the processor referred to by cc can read the memory block defined by the address
, and datatype input arguments. When the processor cannot read any portion of the specified memory block, isreadable returns 0. Notice that you use the same memory block specification for this function as you use for the read function. The data block being tested begins at the memory location defined by address
. When you omit the count option, count defaults to one.
isreadable(rx,'channel') returns a 1 when the RTDX channel specified by the string channel
, associated with link rx
, is configured for read operation. When channel is not configured for reading, isreadable returns 0.
Like the iswritable
, read
, and write functions, isreadable checks for valid address values. Illegal address values are address spaces larger than the available space for the processor – 2 32 for the C6xxx processor
7-70
isreadable
Examples
See Also family and 2 16 for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
Note isreadable relies on the memory map option in CCS IDE. If you did not properly define the memory map for the processor in CCS
IDE, isreadable does not produce useful results. Refer to your Texas
Instruments’ Code Composer Studio documentation for information on configuring memory maps.
When you write scripts to run models in the MATLAB environment and
CCS IDE, the isreadable function is very useful. Use isreadable to check that the channel from which you are reading is configured properly.
cc = ticcs; rx = cc.rtdx;
% Define read and write channels to the processor linked by cc.
open(rx,'ichannel','r');s open(rx,'ochannel','w'); enable(rx,'ochannel'); enable(rx,'ichannel'); isreadable(rx,'ochannel') ans=
0 isreadable(rx,'ichannel') ans=
1
Now that your script knows that it can read from ichannel
, it proceeds to read messages as required.
hex2dec
, iswritable
, read
7-71
isrtdxcapable
Purpose Determine whether processor supports RTDX
Note Support for isrtdxcapable on C5000 and C6000 processors will be removed in a future version.
Syntax
Description
Examples b=isrtdxcapable(cc) b=isrtdxcapable(cc) returns b=1 when the processor referenced by object cc supports RTDX. When the processor does not support RTDX, isrtdxcapable returns b=0
.
Using isrtdxcapable with Multiprocessor Boards
When your board contains more than one processor, isrtdxcapable checks each processor on the processor, as defined by the cc object, and returns the RTDX capability for each processor on the board. In the returned variable b
, you find a vector that contains the information for each accessed processor.
Create a link to your C6711 DSK. Test to see if the processor on the board supports RTDX. It should.
cc=ticcs; %Assumes you have one board and it is the C6711 DSK.
b=isrtdxcapable(cc) b =
1
7-72
isrunning
Purpose
Syntax
Description
Examples
Determine whether processor is executing process isrunning(cc) isrunning(cc) returns
1 when the processor is executing a program.
When the processor is halted, isrunning returns
0
.
Using isrunning with Multiprocessor Boards
When your board contains more than one processor, isrunning checks each processor on the processor, as defined by the cc object, and returns the state for each processor on the board. In the returned variable b
, you find a vector that contains the information for each accessed processor.
By providing a return variable, as shown here, b = isrunning(cc) b contains a vector that holds the information about the state of all processors accessed by cc
.
isrunning lets you determine whether the processor is running. After you load a program to the processor, use isrunning to be sure the program is running before you enable RTDX channels.
cc = ticcs; isrunning(cc) ans =
0
% Load a program to the processor.
run(cc) isrunning(cc) ans =
7-73
isrunning
See Also
1 halt(cc) isrunning(cc) ans =
0 halt
, restart
, run
7-74
isvisible
Purpose
Syntax
Description
Examples
Determine whether CCS IDE is running isvisible(cc) isvisible(cc) determines whether CCS IDE is running on the desktop and the window is open. If CCS IDE window is open, isvisible returns
1. Otherwise, the result is 0 indicating that CCS IDE is either not running or is running in the background.
Test to see if CCS IDE is running. Start CCS IDE. Then open MATLAB software. At the prompt, enter cc=ticcs
TICCS Object:
API version = 1.0
Processor type = C67
Processor name = CPU
Running?
= No
Board number = 0
Processor number= 0
Default timeout = 10.00 secs
RTDX Object:
Timeout: 10.00 secs
Number of open channels: 0
MATLAB software creates a link to CCS IDE and leaves CCS IDE visible on your desktop.
isvisible(cc) ans =
1
Now, change the visibility state to 0, or invisible, and check the state.
7-75
isvisible
See Also visible(cc,0) isvisible(cc) ans =
0
Notice that CCS IDE is not visible on your desktop. Recall that
MATLAB software did not open CCS IDE. When you close MATLAB software with CCS IDE in this invisible state, CCS IDE remains running in the background. To close it, do one of the following.
• Open MATLAB software. Create a new link to CCS IDE. Use the new link to make CCS IDE visible. Close CCS IDE.
• Open Microsoft Windows Task Manager. Click Processes. Find and highlight cc_app.exe
. Click End Task.
info
, visible
7-76
iswritable
Purpose Determine whether MATLAB software can write to specified memory block
Note Support for iswritable(rx,'channel') on C5000 and C6000 processors will be removed in a future version.
Syntax
Description iswritable(cc,address,' datatype ’,count) iswritable(cc,address, 'datatype' ) iswritable(rx,'channel') iswritable(cc,address,' datatype ’,count) returns 1 if MATLAB software can write to the memory block defined by the address
, count
, and datatype input arguments on the processor referred to by cc
. When the processor cannot write to any portion of the specified memory block, iswritable returns 0. You use the same memory block specification for this function as you use for the write function.
The data block being tested begins at the memory location defined by address
.
count determines the number of values to write.
datatype defines the format of data stored in the memory block.
iswritable uses the datatype parameter to determine the number of bytes to write per stored value. For details about each input parameter, read the following descriptions.
address
— iswritable uses address to define the beginning of the memory block to write to. You provide values for address as either decimal or hexadecimal representations of a memory location in the processor. The full address at a memory location consists of two parts: the offset and the memory page, entered as a vector [ location
, page
], a string, or a decimal value. When the processor has only one memory page, as is true for many digital signal processors, the page portion of the memory address is 0. By default, ticcs sets the page to
0 at creation if you omit the page property as an input argument.
7-77
iswritable
For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using the memory location without the page value.
Examples of Address Property Values
Property
Value
1F
10
[18,1]
Address Type
String
Decimal
Vector
Interpretation
Location is 31 decimal on the page referred to by cc.page
Address is 10 decimal on the page referred to by cc.page
Address location 10 decimal on memory page 1 ( cc.page
= 1
)
To specify the address in hexadecimal format, enter the address property value as a string.
iswritable interprets the string as the hexadecimal representation of the desired memory location. To convert the hex value to a decimal value, the function uses hex2dec
. Note that when you use the string option to enter the address as a hex value, you cannot specify the memory page. For string input, the memory page defaults to the page specified by cc.page
.
count
— a numeric scalar or vector that defines the number of datatype values to test for being writable. To assure parallel structure with write
, count can be a vector to define multidimensional data blocks.
This function always tests a block of data whose size is the total number of elements in matrix specified by the input vector. If count is the vector [10 10 10] iswritable(cc,31,[10 10 10]) iswritable writes 1000 values (10*10*10) to the processor. For a two-dimensional matrix defined with count as iswritable(cc,31,[5 6])
7-78
iswritable iswritable writes 30 values to the processor.
datatype
— a string that represents a MATLAB data type. The total memory block size is derived from the value of count and the specified datatype
.
datatype determines how many bytes to check for each memory value.
iswritable supports the following data types: datatype
String
'double'
'int8'
'int16'
'int32'
'single'
'uint8'
'uint16'
'uint32'
Description
Double-precision floating point values
Signed 8-bit integers
Signed 16-bit integers
Signed 32-bit integers
Single-precision floating point data
Unsigned 8-bit integers
Unsigned 16-bit integers
Unsigned 32-bit integers iswritable(cc,address, 'datatype' ) returns
1 if the processor referred to by cc can write to the memory block defined by the address
, and count input arguments. When the processor cannot write any portion of the specified memory block, iswritable returns
0
. Notice that you use the same memory block specification for this function as you use for the write function. The data block tested begins at the memory location defined by address
. When you omit the count option, count defaults to one.
Note iswritable relies on the memory map option in CCS IDE. If you did not properly define the memory map for the processor in CCS
IDE, this function does not produce useful results. Refer to your Texas
Instruments’ Code Composer Studio documentation for information on configuring memory maps.
7-79
iswritable
Examples
See Also
Like the isreadable
, read
, and write functions, iswritable checks for valid address values. Illegal address values would be any address space larger than the available space for the processor – 2
C6xxx processor family and 2 16
32 for the for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
iswritable(rx,'channel') returns a Boolean value signifying whether the RTDX channel specified by channel and rx
, is configured for write operations.
When you write scripts to run models in MATLAB software and CCS
IDE, the iswritable function is very useful. Use iswritable to check that the channel to which you are writing to is indeed configured properly.
cc = ticcs; rx = cc.rtdx;
% Define read and write channels to the processor linked by cc.
open(rx,'ichannel','r'); open(rx,'ochannel','w'); enable(rx,'ochannel'); enable(rx,'ichannel'); iswritable(rx,'ochannel') ans=
1 iswritable(rx,'ichannel') ans=
0
Now that your script knows that it can write to
'ichanne'l
, it proceeds to write messages as required.
hex2dec
, isreadable
, read
7-80
Purpose
Syntax
Description
Information listings from CCS list(ff,varname) infolist = list(cc,' type ') infolist = list(cc,' type ', typename )
Note list(cc,type) produces an error.
list(ff,varname) lists the local variables associated with the function accessed by function object ff
. Compare to list(cc,'variable','varname') which works the same way to return variables from ticcs object cc
.
Note list does not recognize or return information about variables that you declare in your code but that are not used or initialized.
Some restrictions apply when you use list with function objects.
list generates an error in the following circumstances:
• When varname is not a valid input argument for the function accessed by ff
For example, if your function declaration is int foo(int a) but you request information about input argument b
, which is not defined list(ff,'b')
MATLAB software returns an error.
• When varname is the same as a variable assigned by MATLAB software. Usually this happens when you use declare to pass list
7-81
list a function declaration to MATLAB software and the declaration string does not match the declaration for ff as determined when you created ff
.
In an example that demonstrates this problem, the function declaration has a name for the first input, a
. In the declare call, the declaration string does not provide a name for the first input, just a data type, int
. When you issue the declare call, MATLAB software names the first input
ML_Input1
. If you try to use list to get information about the input named
ML_Input
, list returns an error.
Here is the code, starting with the function declaration in your code: int foo(int a) % Function declaration in your source code declare(ff,'decl','int foo(int)')
% MATLAB generates a warning that it has assigned the name
% ML_Input to the first input argument list(ff,'ML_Input') % list returns an error for this call
• When varname does not match the input name in the function declaration provided in your source code, as compared to the declaration string you used in a declare operation.
Assume your source code includes a function declaration for foo
: int foo(int a);
Now pass a declaration for foo to MATLAB software: declare(ff,'decl','int foo(int b)')
MATLAB software issues a warning that the input names do not match. When you use list on the input argument b
, list(ff,'b') list returns an error.
7-82
• When varname is an input to a library function.
list always fails in this case. It does not matter whether you use declare to provide the declaration string for the library function.
Note When you call list for a variable in a function object list(ff,varname) the address field may contain an incorrect address if the program counter is not within the scope of the function that includes varname when you call list
.
infolist = list(cc, type
) reads information about your CCS session and returns it in infolist
. Different types of information and return formats apply depending on the input arguments you supply to the list function call. The type argument specifies which information listing to return. To determine the information that list returns, use one of the following as the type parameter string:
• project
— Tell list to return information about the current project in CCS.
• variable
— Tell list to return information about one or more embedded variables.
• globalvar
— Tell list to return information about one or more global embedded variables.
• function
— Tell list to return details about one or more functions in your project.
• type
— Tell list to return information about one or more defined data types, including struct
, enum
, and union
. ANSI C data type typedefs are excluded from the list of data types.
Note, the list function returns dynamic CCS information that can be altered by the user. Returned listings represent snapshots of the current CCS configuration only. Be aware that earlier copies of infolist might contain stale information.
list
7-83
list
Also, list may report incorrect information when you make changes to variables from MATLAB software. To report variable information, list uses the CCS API, which only knows about variables in CCS. Your changes from MATLAB software, such as changing the data type of a variable, do not appear through the API and list
. For example, the following operations return incorrect or old data information from list
.
Suppose your original prototype is unsigned short tgtFunction7(signed short signedShortArray1[]);
After creating the function object fcnObj
, perform a declare operation with this string to change the declaration: unsigned short tgtFunction7(unsigned short signedShortArray1[]);
Now try using list to return information about signedShortArray1
.
list(fcnObj,'signedShortArray1') address: [3442 1] location: [1x66 char] size: 1 type: 'short *' bitsize: 16 reftype: 'short' referent: [1x1 struct] member_pts_to_same_struct: 0 name: 'signedShortArray1'
The type field reports the original data type short
.
You get this is because list uses the CCS API to query information about any particular variable. As far as the API is concerned, the first input variable is a short*
. Changing the declaration does not change anything.
7-84
infolist = list(cc,'project'
) returns a vector of structures containing project information in the format shown here when you specify option type as project
.
infolist Structure Element infolist(1).name
infolist(1).type
infolist(1).processortype
infolist(1).srcfiles
infolist(1).buildcfg
Description
Project file name (with path).
Project type — project
, projlib
, or projext
, refer to new
String description of processor
CPU
Vector of structures that describes project source files. Each structure contains the name and path for each source file — infolist(1).srcfiles.name
Vector of structures that describe build configurations, each with the following entries: infolist(2)....
infolist(n)....
• infolist(1).buildcfg.name
— the build configuration name
• infolist(1).buildcfg.outpath
— the default directory for storing the build output.
...
...
infolist = list(cc, 'variable
’) returns a structure of structures that contains information on all local variables within scope. The list also includes information on all global variables. Note, however, that if a local variable has the same symbol name as a global variable, list returns the information about the local variable.
list
7-85
list infolist = list(cc,' variable
’, varname
) returns information about the specified variable varname
.
infolist = list(cc,
’ variable
’, varnamelist
) returns information about variables in a list specified by varnamelist
. The information returned in each structure follows the format below when you specify option type as variable
: infolist Structure Element infolist.varname(1).name
infolist.varname(1).isglobal
infolist.varname(1).location
infolist.varname(1).size
infolist.varname(1).uclass
infolist.varname(1).bitsize
infolist.(varname1).type
infolist.varname(2)....
infolist.varname(n)....
Description
Symbol name
Indicates whether symbol is global or local
Information about the location of the symbol
Size per dimension ticcs object class that matches the type of this symbol
Size in bits. More information is added to the structure depending on the symbol type.
data type of symbol
...
...
list uses the variable name as the field name to refer to the structure information for the variable.
infolist = list(cc,' globalvar ' information on all global variables.
) returns a structure that contains infolist = list(cc,' globalvar '
, varname
) returns a structure that contains information on the specified global variable.
infolist = list(cc,' globalvar '
, varnamelist
) returns a structure that contains information on global variables in the list. The
7-86
returned information follows the same format as the syntax infolist
= list(cc,'variable',...)
.
infolist = list(cc,' function '
) returns a structure that contains information on all functions in the embedded program.
infolist = list(cc,' function '
, functionname
) returns a structure that contains information on the specified function functionname
.
infolist = list(cc,' function '
, functionnamelist
) returns a structure that contains information on the specified functions in functionnamelist
. The returned information follows the format below when you specify option type as function
: infolist Structure Element infolist.functionname(1).name
infolist.functionname(1).filename
infolist.functionname(1).address
infolist.functionname(1).funcvar
infolist.functionname(1).uclass
infolist.functionname(1).funcdecl
infolist.functionname(1).islibfunc
Description
Function name
Name of file where function is defined
Relevant address information such as start address and end address
Variables local to the function ticcs object class that matches the type of this symbol — function
Function declaration
— where information such as the function return type is contained
Is this a library function?
list
7-87
list infolist Structure Element infolist.functionname(1).linepos
infolist.functionname(1).funcinfo
infolist.functionname(2)...
infolist.functionname(n)...
Description
Start and end line positions of function
Miscellaneous information about the function
...
...
To refer to the function structure information, list uses the function name as the field name.
infolist = list(cc,' type ') returns a structure that contains information on all defined data types in the embedded program. This method includes struct, enum and union data types and excludes typedefs. The name of a defined type is its ANSI C struct tag, enum tag or union tag. If the ANSI C tag is not defined, it is referred to by the
CCS compiler as
'$faken' where n is an assigned number.
infolist = list(cc,' type ', typename ) returns a structure that contains information on the specified defined data type.
infolist = list(cc,' type '
, typenamelist
) returns a structure that contains information on the specified defined data types in the list.
The returned information follows the format below when you specify option type as type
: infolist Structure Element infolist.typename(1).type
infolist.typename(1).size
infolist.typename(1).uclass
Description
Type name
Size of this type ticcs object class that matches the type of this symbol. Additional information is added depending on the type
7-88
Examples infolist Structure Element infolist.typename(2)....
infolist.typename(n)....
Description
...
...
For the field name, list uses the type name to refer to the type structure information.
The following list provides important information about variable and field names:
• When a variable name, type name, or function name is not a valid
MATLAB software structure field name, list replaces or modifies the name so it becomes valid.
• In field names that contain the invalid dollar character $
, list replaces the
$ with
DOLLAR
.
• Changing the MATLAB software field name does not change the name of the embedded symbol or type.
This first example shows list used with a variable, providing information about the variable varname
. Notice that the invalid field name
_with_underscore gets changed to
Q_with_underscore
. To make the invalid name valid, list inserts the character
Q before the name.
varname1 = '_with_underscore'; % invalid fieldname list(cc,'variable',varname1); ans =
Q_with_underscore : [varinfo] ans. Q_with_underscore ans= name: '_with_underscore' isglobal: 0 location: [1x62 char] size: 1 list
7-89
list
See Also uclass: 'numeric' type: 'int' bitsize: 16
To demonstrate using list with a defined C type, variable typename1 includes the type argument. Because valid field names cannot contain the
$ character, list changes the
$ to
DOLLAR
.
typename1 = '$fake3'; % name of defined C type with no tag list(cc,'type',typename1); ans =
DOLLARfake0 : [typeinfo] ans.DOLLARfake0= type: 'struct $fake0' size: 1 uclass: 'structure' sizeof: 1 members: [1x1 struct]
When you request information about a project in CCS, you see a listing like the following that includes structures containing details about your project.
projectinfo=list(cc,'project') projectinfo = name: 'D:\Work\c6711dskafxr_c6000_rtw\c6711dskafxr.pjt' type: 'project' processortype: 'TMS320C67XX' srcfiles: [69x1 struct] buildcfg: [3x1 struct] info
7-90
load
Purpose
Syntax
Description
Transfer program file (*.
out
, *.
obj
) to processor in active project load(cc, 'filename' ,timeout) load(cc, 'filename' ) load(cc,'gelfilename',timeout) load(cc, 'filename' ,timeout) loads the file specified by filename into the processor.
filename can include a full path to a file, or just the name of a file that resides in the CCS working directory. Use cd to check or modify the working directory. Only use load with program files that are created by the CCS build process.
timeout defines the upper limit on how long MATLAB software waits for the load process to be complete. If this period is exceeded, load returns immediately with a timeout error.
load(cc, 'filename' ) loads the file specified by filename into the processor.
filename can include a full path to a file, or just the name of a file that resides in the CCS working directory. Use cd to check or modify the working directory. Only use load with program files that are created by the CCS build process.
timeout defaults to the global value you set when you created link cc
.
Note load disables all open channels. Open channels revert to disabled
.
load(cc,'gelfilename',timeout) loads and opens the general extension language (GEL) file named gelfilename into CCS, in the active project.
gelfilename needs to be the full path to the file, or just the file name if the file already shows up in your CCS workspace or project. load adds the GEL file to the active project only. To make a different project active so you can add your GEL file to it, use activate
.
The timeout option is not required, as is true for most methods in the product. Using load to add a GEL file is identical to using the File
> Load GEL option in CCS IDE. Your loaded GEL file appears in the
7-91
load
Examples
See Also
GEL files folder in CCS. To remove GEL files, use remove
. You can load any GEL file — you must be sure the GEL file is the correct one.
load does not attempt to verify whether the GEL file is appropriate for your hardware or project.
Taken from the CCS link tutorial, this code prepares for and loads an object file filename.out
to a processor.
projfile =...
fullfile(matlabroot,'directoryname','directoryname','filename') projpath = fileparts(projfile) open(cc,projfile) % Open project file cd(cc,projpath) % Change Code Composer working directory
Now use CCS IDE to build your file. Select Project > Build from the menu bar in CCS IDE.
With the project build complete, load your .
out file by entering load(cc,'filename.out') cd
, dir
, open
7-92
msgcount
Purpose Number of messages in read-enabled channel queue
Note Support for msgcount on C5000 and C6000 processors will be removed in a future version.
Syntax
Description
Examples
See Also msgcount(rx,' channel ') msgcount(rx,' channel ') returns the number of unread messages in the read-enabled queue specified by channel for the RTDX interface rx
.
You cannot use msgcount on channels configured for write access.
If you have created and loaded a program to the processor, you can write data to the processor, then use msgcount to determine the number of messages in the read queue.
1
Create and load a program to the processor.
2
Write data to the processor from MATLAB software.
indata=1:100; writemsg(cc.rtdx,'ichannel', int32(indata));
3
Use msgcount to determine the number of messages available in the queue.
num_of_msgs = msgcount(cc.rtdx,'ichannel') read
, readmat
, readmsg
7-93
new
Purpose Create and open text file, project, or build configuration in CCS IDE
Note new(cc,objectname,'text') produces an error.
Syntax
Description new(cc,'objectname','type') new(cc,'objectname') new(cc,'objectname','type') type creates and opens an empty object of named objectname in the active project in CCS IDE. The new object can be a text file, a project, or a build configuration. String objectname specifies the name of the new object. When you create new text files or projects, objectname can include a full path description.
When you save your new project or file, CCS IDE stores the file at the processor of the full path.
If you do not provide a full path for your file, new stores the file in the
CCS IDE working directory when you save it. New files open as active windows in CCS IDE; they are not placed in the active project folders based on their file extension (compare to add
).
New build configurations always become part of the active project in
CCS IDE. Because build configurations always become part of a project, you only need to enter a name to distinguish your new configuration from existing configurations in the project, such as Debug and Release.
To specify the text file or project to create, objectname must be the full path name to the file, unless your file is in a directory on your MATLAB software path, or the file is in your CCS working directory. Also, when you create new text files or projects, you must include the file extension in objectname
.
type accepts one of the strings or entries listed in the following table.
type String
'text'
Description
Create a new text file in the active project.
7-94
type String
'project'
'projext'
'projlib'
[]
'buildcfg'
Description
Create a new project.
Create a new CCS external make project.
Using this option indicates that your project uses and external makefile. Refer to your CCS documentation for more information about external projects.
Create a new library project with the
.lib
file extension. Refer to your CCS documentation for more information about library projects.
Create a new project. The
[] indicate that you are creating a .
pjt file.
Create a new build configuration in the active project.
Use new to create the file types listed in the following table.
File Types and Extensions Supported by new and CCS IDE
File Type to Create
C/C++ source files
Assembly source files type String Used
'text'
'text'
Supported
Extensions
.c
,
.cpp
,
.cc
,
.ccx
,
.sa
.a*
,
.s*
(excluding
.sa
, refer to C/C++ source files)
.o*
,
.lib
Object and Library files
Build configuration
'text'
Linker command file
'text'
Project file
'project'
'buildcfg'
.cmd
.pjt
No extension new
7-95
new
Examples
See Also
Caution After you create an object in CCS IDE, save the file in CCS
IDE.
new does not automatically save the file, and you lose your changes when you close CCS IDE.
new(cc,'objectname') creates a project in CCS IDE, making it the active project. When you omit the type option, new assumes you are creating a new project and appends the .
pjt extension to objectname to create the project objectname.pjt
. The .
pjt extension is the only extension new recognizes.
When you need a new project, create a link to CCS IDE and use the link to make a new project in CCS IDE.
cc=ticcs; cc.visible(1) % Make CCS IDE visible on your desktop (optional).
new(cc,'my_new_project.pjt','project');
New files of various types result from using new to create new active windows in CCS IDE. For instance, make a new ANSI C source file in
CCS IDE with the following command: new(cc,'new_source.c','text');
In CCS IDE you see your new file as the active window.
activate
, close
, save
7-96
open
Purpose Open channel to processor or load file into CCS IDE
Note Support for open(rx,...) on C5000 and C6000 processors will be removed in a future version.
open(cc,filename,'text') produces an error.
open(cc,filename,'workspace') produces an error.
open(cc,filename,'program') produces an error. Use load instead.
Syntax
Description open(rx,'channel1','mode1','channel2','mode2',...) open(rx,channel,mode) open(cc,filename,filetype,timeout) open(cc,filename,filetype) open(cc,filename) open(rx,'channel1','mode1','channel2','mode2',...) opens new
RTDX channels associated with the link rx
. Each new channel uses the string name channel1, channel2, and so on. For each channel, open configures the channel according to the associated mode string.
Channel1 are either: uses mode1
; channel2 uses mode2
, and so forth. Mode strings
• r
— Configure the channel to read data from the processor.
• w
— Configure the channel for writing data to the processor.
open(rx,channel,mode) opens a new channel to the processor associated with the link rx
. The new channel uses the channel string and is configured for reading or writing according to the mode string.
open(cc,filename,filetype,timeout) filename loads filename into CCS IDE.
can be the full path to the file or, if the file is in the current
7-97
open
CCS IDE working directory, you can use a relative path, such as the name of the file.
Note Program files (.
out extension) and project files (.
mak extension) are loaded on the processor referenced by your ticcs object. Workspace files are coupled to a specific processor. As a result, open loads workspace files to the processor that was active when you created the workspace file. This may not be the processor referred to by the object.
Use cd to determine or change the CCS IDE working directory. You use the filetype option to override the default file extension. Four filetype strings work in this function syntax, shown in the following table.
filetype String program project text workspace
.
Extension out
.
c
, .
a*
, .
s*
, .
o*
, .
lib
,
.
cmd,.mak
any
.
wks
Description
Executable programs for the processor
CCS IDE project files
All text files
CCS IDE workspace files
Note When you have one or more handles to CCS in MATLAB software, opening a new CCS workspace from MATLAB software or directly in CCS, causes your existing handles to become invalid.
MATLAB software returns an error when you try to connect to your new workspace. To continue your work, clear each of your existing handles to CCS and create new handles for the new workspace.
To determine how long MATLAB software waits for open to load the file into CCS IDE, timeout sets the upper limit, in seconds, for the
7-98
open
Examples period MATLAB software waits for the load. If MATLAB software waits more than timeout seconds, load returns immediately with a timeout error. Returning a timeout error does not suspend the operation; it stops MATLAB software from waiting for confirmation for the operation completion.
open(cc,filename,filetype) loads filename into CCS IDE.
filename can be the full path to the file or, if the file is in the current CCS IDE working directory, you can use a relative path, such as the name of the file. Use the cd function to determine or change your CCS IDE working directory. You use the filetype option to override the default file extension. Refer to the previous syntax for more information about filetype
. When you omit the timeout option in this syntax, MATLAB software uses the global timeout set in cc
.
open(cc,filename) loads filename into CCS IDE.
filename can be the full path to the file or, if the file is in the current CCS IDE working directory, you can use a relative path, such as the name of the file. Use the cd function to determine or change the CCS IDE working directory.
You use the filetype option to override the default file extension. Refer to the previous syntax for more information about filetype
. When you omit the filetype and timeout options in this syntax, MATLAB software uses the global timeout set in cc, and derives the file type from the extension in filename
. Refer to the previous syntax descriptions for more information on the input options.
Note You cannot write to or read from channels that you opened but did not enable.
For RTDX use, open forms part of the function pair you use to open and enable a communications channel between MATLAB software and your processor.
cc = ticcs; rx = cc.rtdx; open(rx,'ichannel','w');
7-99
open
See Also enable(rx,'ichannel');
When you are working with CCS IDE, open adopts a different operational form based on your input arguments for filename and the optional arguments filetype and timeout
. In the CCS IDE variant, loads the specified file into CCS IDE. For example, to load the open
tutorial program used in Getting Started with Automation Interface,
use the following syntax cc = ticcs; cc.load(tutorial_6xevm.out); cd
, dir
, load
7-100
profile
Purpose Code execution and stack usage profile report
Note The tic and raw profile report options that depend on DSP/BIOS will be removed in a future release. Use report for all profiling.
Syntax
Description ps=profile(cc, execution ,'format',timeout) ps=profile(cc,' execution ','format') profile(cc,' stack ','action') ps=profile(cc, execution ,'format',timeout) returns execution profile measurements from the generated code. Structure ps contains the information in either raw form or filtered and formatted into fields.
To use profile to assess how your program executes in real-time, complete the following tasks with a Simulink model:
1
Enable real-time execution profiling in the configuration parameters and build your model.
2
Select whether to profile by task or subsystem.
3
Build your model.
4
Download your program to the processor.
5
Run the program on the processor.
6
Stop the running program.
7
Use profile at the MATLAB command prompt to access the profiling reports.
If your project uses DSP/BIOS, the profiling system uses CLK and STS objects to profile your project. STS objects buffer statistics data accesses by statistics functions in the operating system. The objects are a service provided by the DSP/BIOS real-time kernel. For details about STS
7-101
profile objects and DSP/BIOS, refer to your Texas Instruments documentation that came with CCS IDE.
Note Profiling works with and without enabling DSP/BIOS in your project. To use DSP/BIOS, you must install Target Support Package
TC6.
To define how to return the profiling information, set the format input argument.
format String raw report tic
Description
Returns an unformatted list of the timing objects (profiling) information. Returns and formats all time-based objects.
Returns the same data as the raw option, formatted into an HTML report. Works only on projects that include DSP/BIOS.
If you own Target Support Package TC6 software, profile(cc,'report') provides more information about code you generate from
Simulink software models.
Returns a formatted list of the STS timing objects information. Filters out some of the information returned with the raw option. To be returned by this format, the object must be time-based. Does not return user-defined objects. Use raw to see user-defined objects.
Entries in the next table explain when you can use raw
, report
, and tic with your projects—whether the format applies to task or atomic subsystem profiling and whether the format applies with DSP/BIOS.
7-102
profile format
String raw report tic
Profiling by
Parameter
Task
Atomic
Subsystem
Task
Atomic
Subsystem
Task
Atomic
Subsystem
DSP/BIOS
Project
No
Yes
No
Yes
No
Yes
Non-DSP/BIOS
Project
No
No
Yes
Yes
No
No
The following examples show the different report formats that raw
, report
, and tic provide:
• raw cpuload: 0 error: 0 avgperiod: 1000 rate: 1000 obj: [4x1 struct] for k=1:length(ps.obj),disp(k),disp(ps.obj(k)),end;
1 name: 'KNL_swi' units: 'Hi Time' max: 1564 total: 10644 avg: 367.0345
pdfactor: 0.0075
count: 29
7-103
profile
2 name: 'processing_SWI' units: 'Hi Time' max: 1528 total: 3052 avg: 1526 pdfactor: 0.0075
count: 2
3 name: 'TSK_idle' units: 'Hi Time' max: -2.1475e+009 total: 0 avg: 0 pdfactor: 0.0075
count: 0
4 name: 'IDL_busyObj' units: 'User Def' max: -2.1475e+009 total: 0 avg: 0 pdfactor: 0 count: 0
• report
(without DSP/BIOS)
Sample task profiling report
• report
(with DSP/BIOS)
Sample subsystem profiling report
• tic
7-104
cpuload: 0 obj: [3x1 struct] ps.obj(1) ans = name: 'KNL_swi' units: 'Hi Time' max: 1.1759e-005 avg: 2.7597e-006 count: 29 for k=1:length(ps.obj),disp(k),disp(ps.obj(k)),end;
1 name: 'KNL_swi' units: 'Hi Time' max: 1.1759e-005 avg: 2.7597e-006 count: 29
2 name: 'processing_SWI' units: 'Hi Time' max: 1.1489e-005 avg: 1.1474e-005 count: 2
3 name: 'TSK_idle' units: 'Hi Time' max: -16.1465
avg: 0 count: 0 profile
7-105
profile
When you choose raw
, returned variable ps contains an undocumented list of the information provided by CCS IDE. The tic option provides the same information in ps
, as a collection of fields.
Fields in ps ps.cpuload
ps.obj
ps.obj(n).name
ps.obj(n).units
ps,obj(n).max
ps.obj(n).avg
ps.obj(n).count
Description
Execution time in percent of total time spent out of the idle task.
Vector of defined STS objects in the project.
User-defined name for an STS object sts(n)
. Value for n ranges from 1 to the number of defined STS objects.
Either
Hi Time or
Low Time
. Describes the timer applied by this STS object, high- or low- resolution time based.
Maximum measured profile period for sts(n)
, in seconds.
Average measured profile period for sts(n)
, in seconds.
Number of STS measurements taken while executing the program.
Note When you enable DSP/BIOS in your project, your CLK and STS must be configured correctly for the profiling information to be accurate.
Use the DSP/BIOS configuration file to add and configure CLK and
STS objects for your project.
With projects that you generate that use DSP/BIOS, the report option creates a report that contains all of the information provided by the other options, plus additional data that comes from DSP/BIOS
7-106
profile instrumentation in the project. You enable the DSP/BIOS report capability with the Profile performance at atomic subsystem
boundaries option on the
Target Support Package C6 pane on the
Real-Time Workshop pane of the Simulink Configuration Parameters dialog box.
ps=profile(cc,' execution ','format') specified in the ticcs object cc
.
defaults to the timeout period profile(cc,' stack ','action') returns the CPU stack usage from your application.
action defines the stack use profile operation and accepts one of the strings in the following table.
action String setup report
Description
Initializes the CPU stack with known patterns. Writes 0xA5 to the stack addresses on C6000 processors and 0xA5A5 on C2000 and C5000 processors.
Returns the report of the stack usage from running your application.
The MATLAB output from profiling the system stack has the elements described in the following table.
Report Entry
System Stack name startAddress
Units
Minimum Addressable
Unit (MAU)
String for the stack name
Decimal address and page
Description
Maximum number of
MAUs used and the total MAUs allocated for the stack.
Lists the name assigned to the stack.
Lists the address of the stack start and the memory page.
7-107
profile
Report Entry endAddress stackSize growthDirection
Units
Decimal address and page
Addresses
Not applicable
Description
Lists the address of the end of the stack and the memory page.
Reports number of address locations, in
MAUs, allocated for the stack.
Reports whether the stack grows from the lower address to the higher address
( ascending
) or from higher to lower
( descending
).
To use profile to assess how your program uses the stack, complete the following tasks with a Simulink model or manually written code:
1
Build your model with real-time execution profiling enabled in the configuration parameters. Skip this step for custom code.
2
Download your program to the processor.
3
Run the program on the processor.
4
Stop the running program.
5
Use profile at the MATLAB command prompt to access the profiling reports.
For more information about using stack profiling, refer to “System
Stack Profiling” on page 4-19.
7-108
profile
Examples
Using Profiling
The following items affect your ability to profile project execution and stack usage:
Execution profiling works on code you generate from a Simulink model. You cannot profile manually written code that you provide in your project.
Stack profiling works with both model-generated code and your custom code.
Stack profiling does not work when your project uses DSP/BIOS. You get an error when you profile the system stack with DSP/BIOS enabled.
To use DSP/BIOS, you must install Target Support Package TC6 software.
For more information about enabling and using execution profiling,
refer to “Real-Time Execution Profiling” on page 4-11.
This example presents two forms of the data returned by profile
— tic and raw
. The generated code did not includeDSP/BIOS.
Running profile returns structure ps containing profiling data gathered while your program ran. Stop the running program before you request the profile data.
ps=profile(cc,'execution','tic') ps = cpuload: 0 obj: [3x1 struct] ps.obj(1) ans = name: 'KNL_swi'
7-109
profile units: 'Hi Time' max: 1.1759e-005 avg: 2.7597e-006 count: 29 for k=1:length(ps.obj),disp(k),disp(ps.obj(k)),end;
1 name: 'KNL_swi' units: 'Hi Time' max: 1.1759e-005 avg: 2.7597e-006 count: 29
2 name: 'processing_SWI' units: 'Hi Time' max: 1.1489e-005 avg: 1.1474e-005 count: 2
3 name: 'TSK_idle' units: 'Hi Time' max: -16.1465
avg: 0 count: 0
Omitting the format option caused profile to return the data fully formatted and slightly filtered. Adding the raw option to profile returns the same information without filtering any of the returned data.
ps=profile(cc,'execution','raw') ps =
7-110
cpuload: 0 error: 0 avgperiod: 1000 rate: 1000 obj: [4x1 struct] for k=1:length(ps.obj),disp(k),disp(ps.obj(k)),end;
1 name: 'KNL_swi' units: 'Hi Time' max: 1564 total: 10644 avg: 367.0345
pdfactor: 0.0075
count: 29
2 name: 'processing_SWI' units: 'Hi Time' max: 1528 total: 3052 avg: 1526 pdfactor: 0.0075
count: 2
3 name: 'TSK_idle' units: 'Hi Time' max: -2.1475e+009 total: 0 avg: 0 pdfactor: 0.0075
count: 0 profile
7-111
profile
4 name: 'IDL_busyObj' units: 'User Def' max: -2.1475e+009 total: 0 avg: 0 pdfactor: 0 count: 0
Your results can differ from this example depending on your computer and processor. The raw-format data in this example includes one extra timing object—
IDL_busyObj
. As defined in the
.cdb
file, this object is not time based (Units is
'User Def'
). Specifying tic does not return the
IDL_busyObj object.
The following example demonstrates setting up and profiling the system stack. The ticcs object cc must exist in your MATLAB workspace and your application must be loaded on your processor. This example comes from a C6713 simulator.
profile(cc,'stack','setup') % Set up processor stack--write 0xA5 to stack addresses.
Maximum stack usage:
System Stack: 0/1024 (0%) MAUs used.
name: System Stack startAddress: [512 0] endAddress: [1535 stackSize: 1024 MAUs
0] growthDirection: ascending run(cc) halt(cc)
7-112
See Also profile(cc,'stack','report') % Request stack use report.
Maximum stack usage:
System Stack: 356/1024 (34.77%) MAUs used.
name: System Stack startAddress: [512 0] endAddress: [1535 stackSize: 1024 MAUs
0] growthDirection: ascending ticcs profile
7-113
read
Purpose
Syntax
Description
Data from memory on processor or in CCS mem = read(cc,address,'datatype',count,timeout) mem = read(cc,address,'datatype',count) mem = read(cc,address,'datatype') ticcs Object Syntaxes mem = read(cc,address,'datatype',count,timeout) returns data from the processor referred to by cc.
The address
, count
, and datatype input arguments define the memory block to be read. The data block to read begins at the memory location defined by address
.
count determines the number of values to read, starting at address
.
datatype defines the format of the raw data stored in the referenced memory block.
To check values in memory on a running processor, such as values that change during processing, insert one or more breakpoints in the project code and perform the read operation while the processor code is paused at one of the breakpoints. After you read the data, release the breakpoint.
Note
Do not attempt to read data from the processor while it is running.
Reading data from a running process can produce incorrect values.
read uses the datatype parameter to determine the number of bytes to read per stored value.
timeout is an optional input argument you use to specify when to terminate long read processes and data transfers.
For details about each input parameter, read the following descriptions.
address
— read uses address to define the beginning of the memory block to read. You provide values for address as either decimal or hexadecimal representations of a memory location in the processor. The full address at a memory location consists of two parts: the offset and the memory page, entered as a vector [ location
, page
], a string, or a
7-114
read decimal value. When the processor has only one memory page, as is true for many digital signal processors, the value of the page portion of the memory address is 0. By default, ticcs sets the page to
0 at creation if you omit the page property as an input argument.
For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using the memory location without the page value.
Examples of Address Property Values
Property
Value
1F
10
[18,1]
Address Type
String
Decimal
Vector
Interpretation
Offset is 31 decimal on the page referred to by cc.page
Offset is 10 decimal on the page referred to by cc.page
Offset is 18 decimal on memory page 1 ( cc.page = 1
)
To specify the address in hexadecimal format, enter the address property value as a string.
read interprets the string as the hexadecimal representation of the desired memory location. To convert the hex value to a decimal value, the function uses hex2dec
. Note that when you use the string option to enter the address as a hex value, you cannot specify the memory page. For string input, the memory page defaults to the page specified by cc.page
.
count
— a numeric scalar or vector that defines the number of datatype values to read. Entering a scalar for count causes read to return mem as a column vector which has count elements.
count can be a vector to define multidimensional data blocks. The elements of count define the dimensions of the data matrix returned in mem
. The following table shows examples of input arguments to count and how read responds.
7-115
read
Input n
Response
Read n values into a column vector. Return the vector in mem
.
[m,n]
Read ( m
* n
) values from memory into an m
-byn matrix in column major order. Return the matrix in mem
.
[m,n,p,...]
Read ( m*n*p*...
) values from the processor memory in column major order. Return the data in an m
-byn
-byp
-by... multidimensional matrix and return the matrix in mem
.
datatype
— a string that represents a MATLAB data type. The total memory block size is derived from the value of count and the specified datatype
.
datatype determines how many bytes to check for each memory value.
read supports the following data types: datatype String
'double'
'int8'
'int16'
'int32'
'single'
'uint8'
'uint16'
'uint32'
Description
Double-precision floating point values
Signed 8-bit integers
Signed 16-bit integers
Signed 32-bit integers
Single-precision floating point data
Unsigned 8-bit integers
Unsigned 16-bit integers
Unsigned 32-bit integers
To limit the time that read spends transferring data from the processor, the optional argument timeout tells the data transfer process to stop after timeout seconds.
timeout is defined as the number of seconds allowed to complete the read operation. You might find this useful for limiting prolonged data transfer operations. If you omit the timeout option in the syntax, read defaults to the global timeout defined in cc
.
7-116
read
Working with Negative Values
Writing a negative value causes the data written to be saturated because char is unsigned on the processor. Hence, a 0 (a NULL) is written instead. A warning results as well, as this example shows.
cc = ticcs; ff = createobj(cc,'g_char'); % Where g_char is in the code.
write(ff,-100);
Warning: Underflow: Saturation was required to fit the data into an addressable unit.
When you try to read the data you wrote, the character being read is
0 (NULL) — so there seems to be nothing returned by the read function.
You can demonstrate this by the following code, after writing a negative value as shown in the previous example.
readnumeric(x) ans =
0 read(x) % Reads the NULL character ans = % Apparently nothing is returned.
double(read(x)) % Read the numeric equivalent of NULL.
ans = % Again, appears not to return a value.
mem = read(cc,address,'datatype',count) reads data from memory on the processor referred to by cc and defined by the address
, and datatype input arguments. The data block being read begins at the memory location defined by address
.
count determines the number of values to be read. When you omit the timeout option, timeout defaults to the value specified by the timeout property in cc
.
mem = read(cc,address,'datatype') reads the memory location defined by the address input argument from the processor memory referred to by cc
. The data block being read begins at the memory location defined by address
. When you omit the count option, count
7-117
read
Examples defaults to a value of 1. This syntax reads one memory location of datatype
.
Note To ensure seamless read operation, use address to extract address values that are compatible with the alignment required by your processor.
read does not force data type alignment in your processor memory.
Certain combinations of address and datatype are difficult for some processors to use. To ensure seamless read operation, use the address function to extract address values that are compatible with the alignment required by your processor.
Like the isreadable
, iswritable
, and write functions, read checks for valid address values. Illegal address values are any address space larger than the available space for the processor — 2 processor family and 2 16
32 for the C6xxx for the C5xxx series. When read identifies an illegal address, it returns an error message stating that the address values are out of range.
read reads data that you wrote to the processor.
cc = ticcs; indata = 1:25; write(cc,0,indata,30); outdata=read(cc,0,'double',25,10) outdata =
Columns 1 through 13
1 2 3
Columns 14 through 25
4 5 6 7 8 9 10 11 12 13
7-118
read
See Also
14 15 16 17 18 19 20 21 22 23 24 25 outdata now contains the values in indata
, returned from the processor.
As a further demonstration of read
, try the following functions after you create a link cc and load an appropriate program to your processor. To perform the first example, var must exist in the symbol table loaded in CCS.
• Read one 16-bit integer at the location of processor symbol var
.
mlvar = read(cc,address(cc,'var'),'int16')
• Read 100 32-bit integers from address f000
(hexadecimal) and plot the data.
mlplt = read(cc,'f000','int32',100) plot(double(mlplt))
• Increment the integer value stored at address 10 (decimal) of the processor.
cc = ticcs; ainc = 10 mlinc = read(cc,ainc,'int32') mlinc = int32(double(mlinc)+1) cc.write(ainc,mlinc) isreadable
, symbol
, write
7-119
readmat
Purpose Matrix of data from RTDX channel
Note Support for readmat on C5000 and C6000 processors will be removed in a future version.
Syntax
Description data = readmat(rx,channelname,'datatype',siz,timeout) data = readmat(rx,channelname,'datatype',siz) data = readmat(rx,channelname,'datatype',siz,timeout) reads a matrix of data from an RTDX channel configured for read access.
datatype defines the type of data to read, and channelname specifies the queue to read.
readmat reads the desired data from the RTDX link specified by rx
.
Before you read from a channel, open and enable the channel for read access.
Replace channelname with the string you specified when you opened the desired channel.
channelname must identify a channel that you defined in the program loaded on the processor.
You cannot read data from a channel you have not opened and configured for read access. If necessary, use the RTDX tools provided in
CCS IDE to determine which channels exist for the loaded program.
data contains a matrix whose dimensions are given by the input argument vector siz
, where siz can be a vector of two or more elements.
To operate properly, the number of elements in the output matrix data must be an integral number of channel messages.
When you omit the timeout input argument, readmat reads messages from the specified channel until the output matrix is full or the global timeout period specified in rx elapses.
7-120
readmat
Examples
Caution If the timeout period expires before the output data matrix is fully populated, you lose all the messages read from the channel to that point.
MATLAB software supports reading five data types with readmat
: datatype String
'double'
'int16'
'int32'
'single'
'uint8'
Data Format
Double-precision floating point values. 64 bits.
16-bit signed integers
32-bit signed integers
Single-precision floating point values. 32 bits.
Unsigned 8-bit integers data = readmat(rx,channelname,'datatype',siz) reads a matrix of data from an RTDX channel configured for read access.
datatype defines the type of data to read, and channelname specifies the queue to read.
readmat reads the desired data from the RTDX link specified by rx
.
In this data read and write example, you write data to the processor through the CCS IDE. You can then read the data back in two ways — either through read or through readmsg
.
To duplicate this example you need to have a program loaded on the processor. The channels listed in this example, ichannel and ochannel
, must be defined in the loaded program. If the current program on the processor defines different channels, replace the listed channels with your current ones.
cc = ticcs; rx = cc.rtdx; open(rx,'ichannel','w'); enable(rx,'ichannel');
7-121
readmat
See Also open(rx,'ochannel','r'); enable(rx,'ochannel'); indata = 1:25; % Set up some data.
write(cc,0,indata,30); outdata=read(cc,0,'double',25,10) outdata =
Columns 1 through 13
1 2 3 4 5 6 7 8 9 10 11 12 13
Columns 14 through 25
14 15 16 17 18 19 20 21 22 23 24 25
Now use RTDX to read the data into a 5-by-5 array called out_array
.
out_array = readmat('ochannel','double',[5 5]) readmsg
, writemsg
7-122
readmsg
Purpose Read messages from specified RTDX channel
Note Support for readmsg on C5000 and C6000 processors will be removed in a future version.
Syntax
Description data = readmsg(rx,channelname,'datatype',siz,nummsgs,timeout) data = readmsg(rx,channelname,'datatype',siz,nummsgs) data = readmsg(rx,channelname,datatype,siz) data = readmsg(rx,channelname,datatype,nummsgs) data = readmsg(rx,channelname,datatype) data = readmsg(rx,channelname,'datatype',siz,nummsgs,timeout) reads nummsgs from a channel associated with rx
.
channelname identifies the channel queue, which must be configured for read access.
Each message is the same type, defined by datatype
.
nummsgs can be an integer that defines the number of messages to read from the specified queue, or all to read all the messages present in the queue when you call the readmsg function.
Each read message becomes an output matrix in data
, with dimensions specified by the elements in vector siz
. For example, when siz is [ m n
], reading 10 messages ( nummsgs equal 10) creates 10 m
-byn matrices in data
. Each output matrix in data must have the same number of elements ( m x n
) as the number of elements in each message.
You must specify the type of messages you are reading by including the datatype argument.
datatype supports strings that define the type of data you are expecting, as shown in the following table.
datatype
'double'
'int16'
'int32'
String Specified Data Type
Floating point data, 64-bits
(double-precision).
Signed 16-bit integer data.
Signed 32-bit integers.
7-123
readmsg datatype
'single'
'uint8'
String Specified Data Type
Floating-point data, 32-bits
(single-precision).
Unsigned 8-bit integers.
When you include the timeout input argument in the function, readmsg reads messages from the specified queue until it receives nummsgs
, or until the period defined by timeout expires while readmsg waits for more messages to be available.
When the desired number of messages is not available in the queue, readmsg enters a wait loop and stays there until more messages become available or timeout seconds elapse. The timeout argument overrides the global timeout specified when you create rx
.
data = readmsg(rx,channelname,'datatype',siz,nummsgs) nummsgs from a channel associated with rx
.
channelname reads identifies the channel queue, which must be configured for read access. Each message is the same type, defined by datatype
.
nummsgs can be an integer that defines the number of messages to read from the specified queue, or all to read all the messages present in the queue when you call the readmsg function.
Each read message becomes an output matrix in data
, with dimensions specified by the elements in vector siz
. When siz is [ m n
], reading 10 messages ( nummsgs equal 10) creates 10 n
-bym matrices in data
.
Each output matrix in data must have the same number of elements ( m x n
) as the number of elements in each message.
You must specify the type of messages you are reading by including the datatype argument.
datatype of data you are expecting.
supports six strings that define the type data = readmsg(rx,channelname,datatype,siz) reads one data message because nummsgs defaults to one when you omit the input argument.
readmsgs returns the message as a row vector in data
.
7-124
readmsg
Examples data = readmsg(rx,channelname,datatype,nummsgs) reads the number of messages defined by nummsgs
.
data becomes a cell array of row matrices, data
=
{msg1,msg2,...,msg(nummsgs)}
, because siz defaults to
[1,nummsgs]
; each returned message becomes one row matrix in the cell array.
Each row matrix contains one element for each data value in the current message msg# = [element(1), element(2),...,element(l)] where l is the number of data elements in message. In this syntax, the read messages can have different lengths, unlike the previous syntax options.
data = readmsg(rx,channelname,datatype) reads one data message, returning a row vector in data
. All of the optional input arguments— nummsgs
, siz
, and timeout
—use their default values.
In all calling syntaxes for readmsg
, you can set siz and nummsgs to empty matrices, causing them to use their default values— nummsgs
= 1 and siz
= [1,l], where l is the number of data elements in the read message.
Caution If the timeout period expires before the output data matrix is fully populated, you lose all the messages read from the channel to that point.
cc = ticcs; rx = cc.rtdx; open(rx,'ichannel','w'); enable(rx,'ichannel'); open(rx,'ochannel','r'); enable(rx,'ochannel'); indata = 1:25; % Set up some data.
write(cc,0,indata,30); outdata=read(cc,0,'double',25,10) outdata =
7-125
readmsg
See Also
Columns 1 through 13
1 2 3 4 5 6 7 8 9 10 11 12 13
Columns 14 through 25
14 15 16 17 18 19 20 21 22 23 24 25
Now use RTDX to read the messages into a 4-by-5 array called out_array
.
number_msgs = msgcount(rx,'ochannel') % Check number of msgs
% in read queue.
out_array = cc.rtdx.readmsg('ochannel','double',[4 5]) read
, readmat
, writemsg
7-126
regread
Purpose
Syntax
Description
Value from processor register reg = regread(cc,'regname','represent',timeout) reg = regread(cc,'regname','represent') reg = regread(cc,'regname') reg = regread(cc,'regname','represent',timeout) reads the data value in the regname register of the processor and returns the value in reg as a double-precision value. For convenience, regread converts each return value to the MATLAB software double datatype.
Making this conversion lets you manipulate the data in MATLAB software. String regname specifies the name of the source register on the processor.
ticcs object cc defines the processor to read from. Valid entries for regname depend on your processor. Register names are not case-sensitive — a0 is the same as
A0
.
For example, the TMS320C6xxx processor family provides the following register names that are valid entries for regname
:
Register Names
A0
B0
,
A1
,
A2
,...,
A15
,
B1
,
B2
,...,
B15
PC
,
ISTP
,
IFR
,
IRP
,
NRP
,
AMR
,
CSR
A1:A0
,
A2:A1
,...,
B15:B14
Register Contents
General purpose A registers
General purpose B registers
Other general purpose 32-bit registers
64-bit general purpose register pairs
Other processors provide other register sets. Refer to the documentation for your processor to determine the registers for the processor.
Note Use read
(called a direct memory read) to read memory-mapped registers.
7-127
regread
The represent input argument defines the format of the data stored in regname
. Input argument represent takes one of three input strings: represent String Description
'2scomp'
Source register contains a signed integer value in two’s complement format. This is the default setting when you omit the represent argument.
'binary'
Source register contains an unsigned binary integer.
'ieee' Source register contains a floating point 32-bit or
64-bit value in IEEE floating-point format. Use this only when you are reading from 32 and 64 bit registers on the processor.
To limit the time that regread spends transferring data from the processor, the optional argument timeout tells the data transfer process to stop after timeout seconds.
timeout is defined as the number of seconds allowed to complete the read operation. You might find this useful for limiting prolonged data transfer operations. If you omit the timeout option in the syntax, defined in cc
.
regread defaults to the global timeout reg = regread(cc,'regname','represent') timeout value. The timeout value in cc applies.
does not set the global reg = regread(cc,'regname') in regname
.
does not define the format of the data
Reading and Writing Register Values
Register variables can be difficult to read and write because the registers which hold their value are not dedicated to storing just the variable values.
Registers are used as temporary storage locations at any time during execution. When this temporary storage process occurs, the value of the variable is temporarily stored somewhere on the stack and returned
7-128
regread
Examples later. Therefore, getting the values of register variables during program execution may return unexpected answers.
Values that you write to register variables during intermediate times in program operation may not get reflected in the register.
This is true for local variables as well.
One way to see this is to write a line of code that uses the variable and see if the result is consistent.
register int a = 100; int b;
...
b = a + 2;
Reading the register assigned to a may return an incorrect value for a but if b returns the expected 102 result, nothing is wrong with the code or Embedded IDE Link CC software.
For the C5xxx processor family, most registers are memory-mapped and consequently are available using read and write
. However, use regread to read the PC register. The following command demonstrates how to read the PC register. To identify the processor, cc is a link for
CCS IDE.
cc.regread('PC','binary')
To tell MATLAB software what datatype you are reading, the string binary indicates that the unsigned binary integer.
PC register contains a value stored as an
In response, MATLAB software displays ans =
33824
7-129
regread
See Also
For processors in the C6xxx family, regread lets you access processor registers directly. To read the value in general purpose register A0, type the following function.
treg = cc.regread('A0','2scomp'); treg in
A0
.
now contains the two’s complement representation of the value
Now read the value stored in register B2 as an unsigned binary integer, by typing cc.regread('B2','binary'); read
, regwrite
, write
7-130
regwrite
Purpose
Syntax
Description
Write data values to registers on processor regwrite(cc,'regname',value,'represent',timeout) regwrite(cc,'regname',value,'represent') regwrite(cc,'regname',value,) regwrite(cc,'regname',value,'represent',timeout) writes the data in value to the regname register of the processor.
regwrite converts value from its representation in the MATLAB workspace to the representation specified by represent
. The represent input argument defines the format of the data when it is stored in regname
.
Input argument represent takes one of three input strings: represent String
'2scomp'
'binary'
'ieee'
Description
Write value to the destination register as a signed integer value in two’s complement format. This is the default setting when you omit the represent argument.
Write value to the destination register as an unsigned binary integer.
Write value to the destination registers as a floating point 32-bit or 64-bit value in IEEE floating-point format. Use this only when you are writing to 32- and 64-bit registers on the processor.
Note Use write
(called a direct memory write) to write memory-mapped registers.
String regname specifies the name of the destination register on the processor.
cc defines the processor to write value to. Valid entries for regname depend on your processor. Register names are not case-sensitive — a0 is the same as
A0
. For example, the C6xxx
7-131
regwrite processor family provides the following register names that are valid entries for regname
:
Register Names
A0
,
A1
,
A2
,...,
A15
B0
,
B1
,
B2
,...,
B15
PC
,
ISTP
,
IFR
,
IRP
,
NRP
,
AMR
,
CSR
A1:A0
,
A2:A1
,...,
B15:B14
Register Contents
General purpose A registers
General purpose B registers
Other general purpose 32-bit registers
64-bit general purpose register pairs
Other processors provide other register sets. Refer to the documentation for your processor to determine the registers for the processor.
To limit the time that regwrite spends transferring data to the processor, the optional argument timeout tells the data transfer process to stop after timeout seconds.
timeout is defined as the number of seconds allowed to complete the write operation. You might find this useful for limiting prolonged data transfer operations.
If you omit the timeout input argument in the syntax, regwrite defaults to the global timeout defined in cc
. If the write operation exceeds the time specified, regwrite returns with a timeout error.
Generally, timeout errors do not stop the register write process. The write process stops while waiting for CCS IDE to respond that the write operation is complete.
regwrite(cc,'regname',value,'represent') omits the timeout input argument and does not change the timeout value specified in cc
.
regwrite(cc,'regname',value,) omits the represent input argument. Writing the data does not reformat the data written to regname
.
7-132
regwrite
Examples
Reading and Writing Register Values
Register variables can be difficult to read and write because the registers which hold their value are not dedicated to storing just the variable values.
Registers are used as temporary storage locations at any time during execution. When this temporary storage process occurs, the value of the variable is temporarily stored somewhere on the stack and returned later. Therefore, getting the values of register variables during program execution may return unexpected answers.
Values that you write to register variables during intermediate times in program operation may not get reflected in the register.
This is true for any local variables as well.
One way to see this is to write a line of code that uses the variable and see if result is consistent.
register int a = 100; int b;
...
b = a + 2;
Reading the register assigned to a may return an incorrect value for a but if b returns the expected 102 result, nothing is wrong with the code or Embedded IDE Link CC software.
To write a new value to the PC register on a C5xxx family processor, enter regwrite(cc,'pc',hex2dec('100'),'binary') specifying that you are writing the value 256 (the decimal value of
0x100) to register pc as binary data.
To write a 64-bit value to a register pair, such as B1:B0, the following syntax specifies the value as a string, representation, and processor registers.
7-133
regwrite
See Also regwrite(cc,'b1:b0',hex2dec('1010'),'ieee')
Registers
B1:B0 now contain the value 4112 in double-precision format.
read
, regread
, write
7-134
reload
Purpose
Syntax
Description
Examples
Reload most recent program file to processor signal processor s = reload(cc,timeout) s = reload(cc) s = reload(cc,timeout) resends the most recently loaded program file to the processor. If you have not loaded a program file in the current session (so there is no previously loaded file), reload returns the null entry
[] in s indicating that it could not load a file to the processor. Otherwise, s contains the full path name to the program file.
After you reset your processor or after any event produces changes in your processor memory, use reload to restore the program file to the processor for execution.
To limit the time CCS IDE spends trying to reload the program file to the processor, timeout specifies how long the load process can take. If the load process exceeds the timeout limit, CCS IDE stops trying to load the program file and returns an error stating that the time period expired. Exceeding the allotted time for the reload operation usually indicates that the reload was successful but CCS IDE did not receive confirmation before the timeout period passed.
s = reload(cc) timeout reloads the most recent program file, using the value set when you created link cc
, the global timeout setting.
Using reload with Multiprocessor Boards
When your board contains more than one processor, reload calls the reloading function for each processor represented by cc
, reloading the most recently loaded program on each processor.
This is the same as calling reload for each processor individually through ticcs objects for each one.
After you create an object that connects to CCS, use the available methods to reload your most recently loaded project. If you have not loaded a project in this session, reload returns an error and an empty value for s
. Loading a project eliminates the error.
7-135
reload
See Also cc=ticcs; s=reload(cc,23)
Warning: No action taken - load a valid Program file before you reload...
s =
'' open(cc,'D:\ti\tutorial\sim62xx\gelsolid\hellodsp.pjt',...
'project') build(cc) load(cc,'hellodsp.pjt') halt(cc) s=reload(cc,23) s =
D:\ti\tutorial\sim62xx\gelsolid\Debug\hellodsp.out
cd
, load
, open
7-136
remove
Purpose
Syntax
Description
Examples
See Also
Remove file from active CCS IDE project remove(cc,'filename') remove(cc,'gelfilename') remove(cc,'filename') deletes the file specified by filename from the active project in CCS IDE. You can remove files that exist in the active project only.
filename must match the name of an existing file exactly to remove the file.
remove(cc,'gelfilename') deletes the file specified by gelfilename from the active project in CCS IDE. You can remove files that exist in the active project only.
gelfilename must match the name of an existing file exactly to remove the file.
After you have a project in CCS IDE, you can delete files from it using remove from the MATLAB software command line. For example, build a project and load the resulting .
out file. With the project build complete, load your .
out file by typing load(cc,'filename.out')
Now remove one file from your project, such as the GEL file.
remove(cc,'gelfilename')
You see in CCS IDE that the GEL file no longer appears in the
GEL files folder in CCS.
activate
, add
, cd
, open
7-137
reset
Purpose
Syntax
Description
See Also
Reset processor reset(cc,timeout) reset(cc) reset(cc,timeout) stops program execution on the processor and asynchronously performs a processor reset, returning all processor register contents to their power up settings. The reset function returns after the processor halts.
To allow you to determine how long reset waits for the processor to halt, input option timeout lets you set the waiting period in seconds.
After you use reset
, the routine returns after the processor halts or after timeout seconds elapses, whichever comes first.
reset(cc) stops program execution on the processor and asynchronously performs a processor reset, returning all processor register contents to their power up settings. The reset function returns after the processor halts.
reset uses the global timeout value defined in cc to determine how long to wait for the processor to halt before returning. Use get to examine the global timeout value for the link.
Use run to restart the program loaded on the processor.
Compare to halt which does not reset the processor after the program stops running.
Using reset with Multiprocessor Boards
When your board contains more than one processor, reset calls the processor resetting function for each processor represented by cc
, resetting each processor.
This is the same as calling reset for each processor individually through ticcs objects for each one.
Note that the run and halt methods still apply as mentioned earlier in this section.
halt
, restart
, run
7-138
restart
Purpose
Syntax
Description
Examples
Restore program counter to entry point for current program restart(cc,timeout) restart(cc) restart(cc,timeout) halts the processor immediately and resets the program counter (PC) to the program entry point for the loaded program. Use run to execute the program after you use restart
.
restart does not execute the program after resetting the PC.
timeout allows you to specify how long restart waits for the processor to stop and return the PC to the program entry point. Specify the value for timeout in seconds. After you use restart
, the restart routine returns after resetting the PC or after timeout seconds elapse, whichever comes first. If the timeout period expires, restart returns a timeout error.
restart(cc) halts the processor immediately and resets the PC to the program entry point for the loaded program. Use run to execute the program after you use restart
.
restart does not execute the program after resetting the PC. When you omit the timeout argument, restart uses the global default timeout period defined in cc to determine how long to wait for the processor to stop and the PC to be reset to the program entry point.
Using restart with Multiprocessor Boards
When your board contains more than one processor, restart calls the processor restarting function for each processor represented by cc
, restarting the program loaded on each processor.
This is the same as calling restart for each processor individually through ticcs objects for each one.
When you are developing algorithms for your processor, restart becomes a particularly useful function. Rather than resetting the processor after each algorithm test, use the restart function to return the program counter to the program entry point. Because restart restores your local variables to their initial settings, but does not reset the processor, you are ready to rerun your algorithm with new values.
7-139
restart
See Also
When your process gets lost or halts, restart is a quick way to restore your program.
halt
, isrunning
, run
7-140
Purpose
Syntax
Description
Execute program loaded on processor run(cc,'state',timeout) run(cc,'main') run(cc,'tofunc','functionname') run(cc,'state',timeout) starts to execute the program loaded on the processor referred to by cc
. Program execution starts from the location of the program counter. After starting program execution, the input argument state determines when you regain program control.
To define the action of run
, state accepts strings that set the state of the processor: state String
'main'
'run'
'runtohalt'
Run Action
Reset the program counter then run the program until the PC reaches main
. Stop at main
.
Start to execute the program. Wait until the program is running, then return. The program continues to run. If you omit the option argument, run defaults to this setting. Sets the processor to the running state and returns.
This is useful when you want to continue to work in MATLAB software while the processor executes a program.
Start to execute the program. Wait to return until the program encounters a breakpoint or the program execution terminates. Sets the processor to the running state and returns when the processor halts.
run
7-141
run state String
'tofunc'
'tohalt'
Run Action
Run the program from the current position of the program counter to the start of a specified function functionname
.
Changes the state of a running process to runtohalt
, and waits for the processor to halt before returning. Use this when you want to stop a running process cleanly. If the processor is already stopped when you use this state setting, run returns immediately.
To allow you to specify how long run waits for the processor to start executing the loaded program before returning, the input argument timeout lets you set the waiting period in seconds.
After you use run
, the routine returns after confirming that the program started to execute, or after timeout seconds elapses, whichever comes first. If the timeout period expires, run returns a timeout error.
run(cc,'main') resets the program counter in your project then runs the program linked to cc until the counter reaches the start of main
.
run(cc,'tofunc','functionname') runs the program from the current position of the program counter until the counter reaches the function functionname
. Compare this to run(cc,'main') which resets the program counter before executing the program. Using the tofunc option does not reset the program counter.
Using run with Multiprocessor Boards
When your board contains more than one processor, run calls the program running function for each processor represented by cc
, running the program loaded on each processor.
This is the same as calling run for each processor individually through ticcs objects for each one. The other information about run on a single processor applies to each processor in the multiple processor cases.
7-142
Examples After you build and load a program to your processor, use run to start execution.
cc = ticcs('boardnum',0,'procnum',0); % Create a link to CCS
% IDE.
cc.load('tutorial_6xevm.out'); % Load an executable file to the
% processor.
cc.rtdx.configure(1024,4); % Configure four buffers for data
% transfer needs.
cc.rtdx.open('ichan','w'); % Open RTDX channels for read and
% write.
cc.rtdx.enable('ichan'); cc.rtdx.open('ochan','r'); cc.rtdx.enable('ochan'); cc.restart; % Return the PC to the beginning of the current
% program.
cc.run('run'); % Run the program to completion.
This example uses a tutorial program included with Embedded IDE
Link CC. Set your CCS IDE working directory to be the one that holds your project files. The load function uses the current working directory unless you provide a full path name in the input arguments.
Rather than using the dot notation to access the RTDX functions, you can create an alias to the cc link and use the alias in later commands.
Thus, if you add the line rx = cc.rtdx; to the program, you can replace cc.rtdx.configure(1024,4); with run
7-143
run
See Also configure(rx,1024,4); halt
, isrunning
, restart
7-144
save
Purpose Save files and projects in CCS IDE
Note save(cc,filename,'text') produces an error.
Syntax
Description
Examples save(cc,'filename','type') save(cc,'filename','type') filename save the file in CCS IDE identified by of type ’ type
’.
type identifies the type of file to save, either project files when you use ’ project' for type, or text files when you use
'text' for the type option. To save a specific file in CCS IDE, filename must match the name of the file to save exactly. If you replace filename with
'all'
, save writes every open file whose type matches the type option. File types recognized by save include these extensions.
type String
'project'
'text'
Affected files
Project files with the .
pjt extension.
All files with these extensions — a*
, .
c
, .
cc
, .
ccx
,
.
cdb
, .
cmd
, .
cpp
, .
lib
, .
o*
, .
rcp
, and .
s*
. Note that
'text' does not save .
cfg files.
When you replace filename with the null entry
[]
, save writes to storage the current active file window in CCS IDE, or the active project when you specify project for the type option.
To clarify the different save options, here are commands that save open files or projects in CCS IDE.
Command save(cc,'all','project') save(cc,'my.pjt','project') save(cc,[],project')
Result
Save all open projects in
CCS IDE.
Save the project my.pjt.
Save the active project.
7-145
save
See Also
Command save(cc,'all','text') save(cc,'my_source.cpp','text') save(cc,[],'text')
Result
Save all open text files.
Includes source files, libraries, command files, and others.
Save the text file my_source.cpp
.
Save the active file window.
add
, cd
, close
, open
7-146
symbol
Purpose
Syntax
Description
Examples
Program symbol table from CCS IDE s = symbol(cc) s = symbol(cc) returns the symbol table for the program loaded in
CCS IDE.
symbol only applies after you load a processor program file.
s is an array of structures where each row in s presents the symbol name and address in the table. Therefore, s has two columns; one is the symbol name, and the other is the symbol address and symbol page.
For example, this table shows a few possible elements of s
, and their interpretation.
s Structure Field s(1).name
s(1).address(1) s(1).address(2)
Contents of the Specified Field
String reflecting the symbol entry name.
Address or value of symbol entry.
Memory page for the symbol entry. For TI
C6xxx processors, the page is 0.
You can use field address in s as the address input argument to read and write
.
It you use symbol and the symbol table does not exist, s returns empty and you get a warning message.
Symbol tables are a portion of a COFF object file that contains information about the symbols that are defined and used by the file.
When you load a program to the processor, the symbol table resides in
CCS IDE. While CCS IDE may contain more than one symbol table at a time, symbol accesses the symbol table belonging to the program you last loaded on the processor.
Demonstrating this function requires that you load a program file to your processor. In this example, build and load Embedded IDE Link
CC demo program c6711dskafxr
. Start by entering c6711dskafxr at the MATLAB software prompt.
7-147
symbol
See Also c6711dskafxr;
Now set the simulation parameters for the model and build the model to your processor. With the model loaded on your processor, use symbol to return the entries stored in the symbol table in CCS IDE.
cc = ticcs; s = symbol(cc); s contains all the symbols and their addresses, in a structure you can display with the following code: for k=1:length(s),disp(k),disp(s(k)),end;
MATLAB software lists the symbols from the symbol table in a column.
load
, run
7-148
ticcs
Purpose
Syntax
Description
Object ticcs
Create object that refers to CCS IDE cc = ticcs cc = ticcs(' propertyname ’,' propertyvalue ’,...) cc = ticcs returns a ticcs object in cc that MATLAB software uses to communicate with the default processor. In the case of no input arguments, ticcs constructs the object with default values for all properties. CCS IDE handles the communications between MATLAB software and the selected CPU. When you use the function, ticcs starts
CCS IDE if it is not running. If ticcs opened an instance of the CCS
IDE when you issued the ticcs function, CCS IDE becomes invisible after Embedded IDE Link CC creates the new object.
Note When ticcs creates the object cc
, it sets the working directory for
CCS IDE to be the same as your MATLAB software working directory.
When you create files or projects in CCS IDE, or save files and projects, this working directory affects where you store the files and projects.
Each object that accesses CCS IDE comprises two objects—a ticcs object and an rtdx object—that include the following properties.
Property Name Property
'apiversion'
Default
API version N/A
'proctype'
'procname'
Processor
Type
Processor
Name
N/A
CPU
Description
Defines the API version used to create the link
Specifies the kind of processor on the board
Name given to the processor on the board to which this object links
7-149
ticcs
Object Property Name Property
'status'
Running
Default
No
'boardnum'
'procnum'
'timeout'
Board
Number
Processor number
Default timeout
0
0
10.0 s
Description
Status of the program currently loaded on the processor
Number that CCS assigns to the board. Used to identify the board
Number the CCS assigns to a processor on a board
Specifies how long
MATLAB software waits for a response from CCS after issuing a request.
This also applies when you try to construct a ticcs object. The create process waits for this timeout period for the connection to the processor to complete. If the timeout period expires, you get an error message that the connection to the processor failed and MATLAB software could not create the ticcs object.
7-150
ticcs
Object rtdx type
Property Name
'timeout'
Property
Timeout
Default
10.0 s
Description
Specifies how long CCS waits for a response from the processor after requesting data
The number of open channels using this link
'numchannels' type
Number of open channels
Defined types in the object
0
Void,
Float,
Double,
Long,
Int,
Short,
Char
List of the C data types in the project
Use add cc accesses.
to include your
C type definitions to the list cc = ticcs(' propertyname ’,' propertyvalue ’,...) returns a handle in cc that MATLAB software uses to communicate with the specified processor. CCS handles the communications between the MATLAB environment and the CPU.
MATLAB software treats input parameters to ticcs as property definitions. Each property definition consists of a property name/property value pair.
Two properties of the ticcs object are read only after you create the object:
• 'boardnum'
— the identifier for the installed board selected from the active boards recognized by CCS. If you have one board, use the default property value 0 to access the board.
• 'procnum'
— the identifier for the processor on the board defined by boardnum
. On boards with more than one processor, use this value to specify the processor on the board. On boards with one processor, use the default property value 0 to specify the processor.
7-151
ticcs
Given these two properties, the most common forms of the ticcs method are cc = ticcs('boardnum',value) cc = ticcs('boardnum',value,'procnum',value) cc = ticcs(...,'timeout',value) which specify the board, and processor in the second example, as the processor.
The third example adds the timeout input argument and value to allow you to specify how long MATLAB software waits for the connection to the processor or the response to a command to return completed.
Note The output argument name you provide for ticcs cannot begin with an underscore, such as
_cc
.
You do not need to specify the boardnum and procnum properties when you have one board with one processor installed. The default property values refer correctly to the processor on the board.
Note Simulators are considered boards. If you defined both boards and simulators in CCS IDE, specify the boardnum and procnum properties to connect to specific boards or simulators. Use ccsboardinfo to determine the values for the boardnum and procnum properties.
Because these properties are read only after you create the handle, you must set these property values as input arguments when you use ticcs
. You cannot change these values after the handle exists. After you create the handle, use the get function to retrieve the boardnum and procnum property values.
7-152
ticcs
Using ticcs with Multiple Processor Boards
When you create ticcs objects that access boards that contain more than one processor, such as the OMAP1510 platform, ticcs behaves a little differently.
For each of the ticcs syntaxes above, the result of the method changes in the multiple processor case, as follows.
cc = ticcs cc = ticcs('propertyname',propertyvalue) cc = ticcs('propertyname',propertyvalue,'propertyname',...
propertyvalue)
In the case where you do not specify a board or processor: cc = ticcs
Array of TICCS Objects:
API version
Board name
: 1.2
: OMAP 3.0 Platform Simulator [Texas
Instruments]
Board number : 0
Processor 0 (element 1): TMS470R2127 (MPU, Not Running)
Processor 1 (element 2): TMS320C5500 (DSP, Not Running)
Where you choose to identify your processor as an input argument to ticcs
, for example, when your board contains two processors: cc = ticcs('boardnum',2)
Array of TICCS Objects:
API version
Board name
: 1.2
: OMAP 3.0 Platform Simulator [Texas Instruments]
Board number : 2
Processor 0 (element 1) : TMS470R2127 (MPU, Not Running)
Processor 1 (element 2) : TMS320C5500 (DSP, Not Running) cc returns a two element object handle with cc(1) corresponding to the first processor and cc(2) corresponding to the second.
7-153
ticcs
You can include both the board number and the processor number in the ticcs syntax, as shown here: cc = ticcs('boardnum',2,'procnum',[0 1])
Array of TICCS Objects:
API version
Board name
: 1.2
: OMAP 3.0 Platform Simulator [Texas
Instruments]
Board number : 2
Processor 0 (element 1) : TMS470R2127 (MPU, Not Running)
Processor 1 (element 2) : TMS320C5500 (DSP, Not Running)
Enter procnum as either a single processor on the board (a single value in the input arguments to specify one processor) or a vector of processor numbers, as shown in the example, to select two or more processors.
Support Coemulation and OMAP
Coemulation, defined by Texas Instruments to mean simultaneous debugging of two or more CPUs, allows you to coordinate your debugging efforts between two or more processors within one device. Efficient development with OMAP™ hardware requires coemulation support.
Instead of creating one cc object when you issue the following command cc = ticcs or your hardware that has multiple processors, the resulting cc object comprises a vector of cc objects cc(1)
, cc(2)
, and so on, each of which accesses one processor on your device, say an OMAP1510. When your processor has one processor, cc is a single object. With a multiprocessor board, the cc object returns the new vector of objects. For example, for board 2 with two processors, cc = ticcs returns the following information about the board and processors: cc = ticcs('boardnum',2)
Array of TICCS Objects:
7-154
ticcs
Examples
API version
Board name
: 1.2
: OMAP 3.0 Platform Simulator [Texas
Instruments]
Board number : 2
Processor 0 (element 1) : TMS470R2127 (MPU, Not Running)
Processor 1 (element 2) : TMS320C5500 (DSP, Not Running)
Checking the existing boards shows that board 2 does have two processors: ccsboardinfo
2
1
0
Board Board
Num Name
Proc Processor
Num Name
Processor
Type
2
----------------------------------------------------
OMAP 3.0 Platform Simulator [T ... 0 MPU TMS470R2x
OMAP 3.0 Platform Simulator [T ... 1
MGS3 Simulator [Texas Instruments] 0
ARM925 Simulator [Texas Instru ... 0
DSP
CPU
CPU
TMS320C550
TMS320C5500
TMS470R2x
On a system with three boards, where the third board has one processor and the first and second boards have two processors each, the following function: cc = ticcs('boardnum',1,'procnum',0); returns an object that accesses the first processor on the second board.
Similarly, the function cc = ticcs('boardnum',0,'procnum',1); returns an object that refers to the second processor on the first board.
To access the processor on the third board, use cc = ticcs('boardnum',2);
7-155
ticcs
See Also which sets the default property value procnum
= 0 to connect to the processor on the third board.
cc = ticcs
TICCS Object:
API version
Processor type
Processor name
Running?
: 1.2
: TMS320C6711
: CPU_1
: No
Board number : 1
Processor number : 0
Default timeout : 10.00 secs
RTDX channels : 0 cc.type
% Returns information about the type object
Defined types : Void, Float, Double, Long, Int, Short, Char get
, ccsboardinfo
, set
7-156
visible
Purpose
Syntax
Description
Set whether CCS IDE window is visible while CCS runs visible(cc,state) visible(cc,state) sets CCS IDE to be visible or not visible on the desktop. Input argument state accepts either
0 or
1 to set the visibility.
Setting state equal to
0 makes CCS IDE not visible on the desktop.
However, the CCS IDE process runs in the background while the window is not visible.
Running CCS IDE without making it visible lets you use the CCS IDE functions from MATLAB software, without interacting with CCS IDE.
If you need to interact with CCS IDE, set state equal to
1
. This makes
CCS IDE visible and you can use the features of the user window.
An important feature of visible is that it creates a new link to CCS
IDE when you change the IDE visibility. As a result, after you use visible(cc,state) to make CCS IDE show on your desktop, the MATLAB software clear all function does not remove the visibility handle. You must remove the handle explicitly before you use clear
.
To see the visibility difference, open CCS and use Microsoft Windows
Task Manager to look at the applications and processes running on your computer. When CCS IDE is visible (the normal startup and operating mode for the IDE), CCS IDE appears listed on the Applications page of Task Manager. And the process cc_app.exe
shows up on the
Processes page as a running process. When you set CCS IDE to not visible ( state equal
0
), CCS IDE disappears from the Applications page, but remains on the Processes page, with a process ID (PID), using CPU and memory resources.
Note When you close MATLAB software while CCS IDE is not visible,
MATLAB software closes CCS if it started the IDE.
7-157
visible
Examples
See Also
For more information about visibility and CCS, refer to “Running Code
Composer Studio Software on Your Desktop — Visibility” on page 2-6.
Test to see whether CCS IDE is running. Then change the visibility and check again. Start CCS IDE. Then open MATLAB software and at the prompt, enter cc=ticcs;
MATLAB software creates a link to CCS IDE and leaves CCS IDE visible on your desktop.
isvisible(cc) ans =
1
Now, change the visibility state to 0, or invisible, and check the state.
visible(cc,0) isvisible(cc) ans =
0
Notice that CCS IDE is not visible on your desktop. Recall that
MATLAB software did not open CCS IDE. When you close MATLAB software with CCS IDE in this invisible state, CCS IDE remains running in the background. To close it, do one of the following operations.
• Start MATLAB software. Create a new link to CCS IDE. Use the new link to make CCS IDE visible. Close CCS IDE.
• Open Microsoft Windows Task Manager. Click Processes. Find and highlight cc_app.exe
. Click End Task.
isvisible
, load
7-158
write
Purpose
Syntax
Description
Write data to memory on processor write(cc,address,data,timeout) write(cc,address,data) ticcs Object Syntaxes write(cc,address,data,timeout) sends a block of data to memory on the processor referred to by cc.
The address and data input arguments define the memory block to write—where the memory starts and what data is being written. The memory block to write to begins at the memory location defined by address
.
data is the data to write, and can be a scalar, a vector, a matrix, or a multidimensional array.
Data get written to memory in column-major order.
timeout is an optional input argument you use to terminate long write processes and data transfers. For details about each input parameter, read the following descriptions.
To update values in memory on a running processor, such as values to change during processing, insert one or more breakpoints in the project code and perform the write operation while the processor code is paused at one of the breakpoints. After you read the data, release the breakpoint.
Note
Do not attempt to write data to the processor while it is running.
Writing data to a running process can result in incorrect data in memory or in program use.
address
— write uses address to define the beginning of the memory block to write to. You provide values for address as either decimal or hexadecimal representations of a memory location in the processor.
The full address at a memory location consists of two parts: the offset and the memory page, entered as a vector [ location
, page
], a string, or a decimal value.
7-159
write
When the processor has only one memory page, as is true for many digital signal processors, the value of the page portion of the memory address is 0. By default, ticcs sets the page value to
0 at creation if you omit page as an input argument.
For processors that have one memory page, setting the page value to 0 lets you specify all memory locations in the processor using the memory location without the page value.
Examples of Address Property Values
Property Value
1F
10
[18,1]
Address Type
String
Decimal
Vector
Interpretation
Offset is 31 decimal on the page referred to by cc.page
Offset is 10 decimal on the page referred to by cc.page
Offset is 18 decimal on memory page 1
( cc.page = 1
)
To specify the address in hexadecimal format, enter the address property value as a string.
write interprets the string as the hexadecimal representation of the desired memory location. To convert the hex value to a decimal value, the write uses hex2dec
. When you use the string option to enter the address as a hex value, you cannot specify the memory page. For string input, the memory page defaults to the page specified by cc.page.
.
data
— the scalar, vector, or array of values that are written to memory on the processor.
write supports the following data types:
Datatypes double int8
Description
Double-precision floating point values
Signed 8-bit integers
7-160
write
Datatypes int16 int32 single uint8 uint16 uint32
Description
Signed 16-bit integers
Signed 32-bit integers
Single-precision floating point data
Unsigned 8-bit integers
Unsigned 16-bit integers
Unsigned 32-bit integers
To limit the time that write spends transferring data from the processor, the optional argument timeout tells the data transfer process to stop after timeout seconds.
timeout out is defined as the number of seconds allowed to complete the write operation. You may find this useful for limiting prolonged data transfer operations. If you omit the timeout option in the syntax, write defaults to the global timeout defined in cc
.
write(cc,address,data) sends a block of data to memory on the processor referred to by cc.
The address and data input arguments define the memory block to be written—where the memory starts and what data is being written. The memory block to be written to begins at the memory location defined by address
.
data is the data to be written, and can be a scalar, a vector, a matrix, or a multidimensional array.
Data get written to memory in column-major order. Refer to the preceding syntax for details about the input arguments. In this syntax, timeout defaults to the global timeout period defined in cc.timeout
.
Use get to determine the default timeout value.
Like the isreadable
, iswritable
, and read functions, write checks for valid address values. Illegal address values would be any address space larger than the available space for the processor – 2
C6xxx processor family and 2 16
32 for the for the C5xxx series. When the function identifies an illegal address, it returns an error message stating that the address values are out of range.
7-161
write
Examples
Writing Negative Values
Writing a negative value causes the data written to be saturated because char is unsigned on the processor. Hence, a 0 (a NULL) is written instead. A warning results as well, as this example shows.
cc = ticcs; ff = createobj(cc,'g_char'); % Where g_char is in the code.
write(ff,-100);
Warning: Underflow: Saturation was required to fit the data into an addressable unit.
When you try to read the data you wrote, the character being read is
0 (NULL) — so there seems to be nothing returned by the read function.
You can demonstrate this by the following code, after writing a negative value as shown in the previous example.
readnumeric(x) ans =
0 read(x) % Reads the NULL character.
ans = % Apparently nothing is returned.
double(read(x)) % Read the numeric equivalent of NULL.
ans = % Again, appears not to return a value.
The following examples demonstrate how to use write
.
cc is a ticcs object.
Connect to a processor and write data to it. In this example, CCS IDE recognizes one board having one processor.
cc = ticcs; cc.visible(1); write(cc,'50',1:250); mem = read(cc,0,'double',50) % Returns 50 values as a column
% vector in mem.
7-162
write
See Also
It may be more convenient to return the data in an array. If you enter a vector for count
, mem contains a matrix of dimensions the same as vector count
.
write(cc,10,1:100); mem=read(cc,10,'double',[10 10]) mem =
9
10
7
8
5
6
3
4
1
2
15
16
17
18
11
12
13
14
19
20
25
26
27
28
21
22
23
24
29
30
35
36
37
38
31
32
33
34
39
40
45
46
47
48
41
42
43
44
49
50
55
56
57
58
51
52
53
54
59
60
65
66
67
68
61
62
63
64
69
70
75
76
77
78
71
72
73
74
79
80
85
86
87
88
81
82
83
84
89
90
95
96
97
98
91
92
93
94
99
100
Write an array of 16–bit integers at the location of target symbol data
.
write(cc,address(h,'data'),int16([1:100]))
Write a single-precision, IEEE floating-point value (32-bits) at address
FF00
(Hex).
write(cc,'FF00',single(23.5))
Write a 2-D array of integers in row-major (C-style) format at address
65280
(decimal).
mlarr = int32([1:10; 101:110]) write(cc,65280,mlarr') read
, symbol
7-163
writemsg
Purpose Write messages to specified RTDX channel
Note Support for writemsg on C5000 and C6000 processors will be removed in a future version.
Syntax
Description
Examples data = writemsg(rx, channelname ,data) data = writemsg(rx, channelname ,data) data = writemsg(rx, channelname ,data) writes data to a channel associated with rx
.
channelname identifies the channel queue, which must be configured for write access. All messages must be the same type for a single write operation.
writemsg takes the elements of matrix data in column-major order.
To limit the time that writemsg spends transferring messages from the processor, the optional argument timeout tells the message transfer process to stop after timeout seconds.
timeout is defined as the number of seconds allowed to complete the write operation. You may find this useful for limiting prolonged data transfer operations. If you omit the timeout option in the syntax, write defaults to the global timeout period defined in cc
.
writemsg single supports the following data types: uint8
, int16
, int32
,
, and double
.
data = writemsg(rx, channelname ,data) uses the global timeout setting assigned to cc when you create the link.
After you load a program to your processor, configure a link in RTDX for write access and use writemsg to write data to the processor. Recall that the program loaded on the processor must define ichannel and the channel must be configured for write access.
cc=ticcs; rx = cc.rtdx; open(rx,'ichannel','w'); % Could use rx.open('ichannel','w')
7-164
writemsg
See Also enable(rx,'ichannel'); inputdata(1:25); writemsg(rx,'ichannel',int16(inputdata));
As a further illustration, the following code snippet writes the messages in matrix indata to the write-enabled channel specified by ichan
.
Note again that this example works only when ichan is defined by the program on the processor and enabled for write access.
indata = [1 4 7; 2 5 8; 3 6 9]; writemsg(cc.rtdx,'ichan',indata);
The matrix indata is written by column to ichan
. The preceding function syntax is equivalent to writemsg(cc.rtdx,'ichan',[1:9]); readmat
, readmsg
, write
7-165
writemsg
7-166
Block Reference
8
8
Block Reference
C280x/C28x3x DSP Chip Support (ccslinklib_c280x)
C280x/C28x3x Hardware Interrupt
Interrupt Service Routine to handle hardware interrupt on
C280x/C28x3x processors
C281x DSP Chip Support (ccslinklib_c281x)
Interrupt Service Routine to handle hardware interrupt
C5xxx DSP Chip Support (ccslinklib_c5xxx)
Interrupt Service Routine to handle hardware interrupt on C5000 and
C6000 processors
C6xxx DSP Chip Support (ccslinklib_c6xxx)
Interrupt Service Routine to handle hardware interrupt on C5000 and
C6000 processors
8-2
Core Support (ccslinklib_core)
Core Support (ccslinklib_core)
Create free-running task
Allocate memory section
Copy to and from memory section
Target Preferences (ccslinklib_tgtpref)
Configure model for Texas
Instruments processor
8-3
8
Block Reference
8-4
Blocks — Alphabetical List
9
C280x/C28x3x Hardware Interrupt
Purpose
Library
Description
Interrupt Service Routine to handle hardware interrupt on
C280x/C28x3x processors ccslinklib_c280x in Embedded IDE Link CC
For many systems, an execution scheduling model based on a timer interrupt is not sufficient to ensure a real-time response to external events. The C280x/C28x3x Hardware Interrupt block addresses this problem by allowing asynchronous processing of interrupts triggered by events managed by other blocks in the C280x/C28x3x DSP Chip
Support Library.
The following C280x/C28x3x blocks that can generate an interrupt for asynchronous processing are available in Target Support Package TC2.
• C280x ADC
• C280x eCAN Receive
• C280x SCI Receive
• C280x SCI Transmit
• C280x SPI Receive
• C280x SPI Transmit
Only one Hardware Interrupt block can be used in a model. To handle multiple interrupts, place a Demux block at the output of the Hardware
Interrupt block to direct function calls to the appropriate function-call subsystems.
Vectorized Output
The output of this block is a function call. The size of the function call line equals the number of interrupts the block is set to handle. Each interrupt is represented by four parameters shown on the dialog box of the block. These parameters are a set of four vectors of equal length.
Each interrupt is represented by one element from each parameter (four elements total), one from the same position in each of these vectors.
9-2
C280x/C28x3x Hardware Interrupt
Each interrupt is described by:
• CPU interrupt numbers
• PIE interrupt numbers
• Task priorities
• Preemption flags
So one interrupt is described by a CPU interrupt number, a PIE interrupt number, a task priority, and a preemption flag.
The CPU and PIE interrupt numbers together uniquely specify a single interrupt for a single peripheral or peripheral module. The following table maps CPU and PIE interrupt numbers to these peripheral interrupts.
9-3
C280x/C28x3x Hardware Interrupt
9-4
Dialog
Box
C280x/C28x3x Hardware Interrupt
The task priority indicates the relative importance tasks associated with the asynchronous interrupts. If an interrupt triggers a higher-priority task while a lower-priority task is running, the execution of the lower-priority task will be suspended while the higher-priority task is executed. The lowest value represents the highest priority. The default priority value of the base rate task is 40, so the priority value for each asynchronously triggered task must be less than 40 for these tasks to suspend the base rate task.
The preemption flag determines whether a given interrupt is preemptable. Preemption overrides prioritization, such that a preemptable task of higher priority can be preempted by a non-preemptable task of lower priority.
CPU interrupt numbers
Enter a vector of CPU interrupt numbers for the interrupts you want to process asynchronously.
9-5
C280x/C28x3x Hardware Interrupt
References
See the table of C280x Peripheral Interrupt Vector Values for a
mapping of CPU interrupt number to interrupt names.
PIE interrupt numbers
Enter a vector of PIE interrupt numbers for the interrupts you want to process asynchronously.
See the table of C280x Peripheral Interrupt Vector Values for a
mapping of CPU interrupt number to interrupt names.
Simulink task priorities
Enter a vector of task priorities for the interrupts you want to process asynchronously.
See the discussion of this block’s “Vectorized Output” on page 9-2
for an explanation of task priorities.
Preemption flags
Enter a vector of preemption flags for the interrupts you want to process asynchronously.
See the discussion of this block’s “Vectorized Output” on page 9-2
for an explanation of preemption flags.
Enable simulation input
Select this check box if you want to be able to test asynchronous interrupt processing in the context of your Simulink software model.
Note Select this check box to enable you to test asynchronous interrupt processing behavior in Simulink software.
Detailed information about interrupt processing is in TMS320x280x
DSP System Control and Interrupts Reference Guide, Literature
Number SPRU712B, available at the Texas Instruments Web site.
9-6
C280x/C28x3x Hardware Interrupt
See Also The following links refer to block reference pages that require the
Target Support Package TC2 software.
C280x/C28x3x Software Interrupt Trigger,Idle Task
9-7
C281x Hardware Interrupt
Purpose
Library
Description
Interrupt Service Routine to handle hardware interrupt ccslinklib_c281x in Embedded IDE Link CC
For many systems, an execution scheduling model based on a timer interrupt is not sufficient to ensure a real-time response to external events. The C281x Hardware Interrupt block addresses this problem by allowing for the asynchronous processing of interrupts triggered by events managed by other blocks in the C281x DSP Chip Support
Library.
The following C281x blocks that can generate an interrupt for asynchronous processing are available fromTarget Support Package
TC2:
• C281x ADC
• C281x CAP
• C281x eCAN Receive
• C281x Timer
• C281x SCI Receive
• C281x SCI Transmit
• C281x SPI Receive
• C281x SPI Transmit
Only one Hardware Interrupt block can be used in a model. To handle multiple interrupts, place a Demux block at the output of the Hardware
Interrupt block to direct function calls to the appropriate function-call subsystems.
Vectorized Output
The output of this block is a function call. The size of the function call line equals the number of interrupts the block is set to handle. Each interrupt is represented by four parameters shown on the dialog box of the block. These parameters are a set of four vectors of equal length.
9-8
C281x Hardware Interrupt
Each interrupt is represented by one element from each parameter (four elements total), one from the same position in each of these vectors.
Each interrupt is described by:
• CPU interrupt numbers
• PIE interrupt numbers
• Task priorities
• Preemption flags
So one interrupt is described by a CPU interrupt number, a PIE interrupt number, a task priority, and a preemption flag.
The CPU and PIE interrupt numbers together uniquely specify a single interrupt for a single peripheral or peripheral module. The following table maps CPU and PIE interrupt numbers to these peripheral interrupts.
9-9
C281x Hardware Interrupt
9-10
Dialog
Box
C281x Hardware Interrupt
The task priority indicates the relative importance tasks associated with the asynchronous interrupts. If an interrupt triggers a higher-priority task while a lower-priority task is running, the execution of the lower-priority task will be suspended while the higher-priority task is executed. The lowest value represents the highest priority. Note that the default priority value of the base rate task is 40, so the priority value for each asynchronously triggered task must be less than 40 for these tasks to actually cause the suspension of the base rate task.
The preemption flag determines whether a given interrupt is preemptable or not. Preemption overrides prioritization, such that a preemptable task of higher priority can be preempted by a non-preemptable task of lower priority.
9-11
C281x Hardware Interrupt
CPU interrupt numbers
Enter a vector of CPU interrupt numbers for the interrupts you want to process asynchronously.
See the table of C281x Peripheral Interrupt Vector Values for a
mapping of CPU interrupt number to interrupt names.
PIE interrupt numbers
Enter a vector of PIE interrupt numbers for the interrupts you want to process asynchronously.
See the table of C281x Peripheral Interrupt Vector Values for a
mapping of CPU interrupt number to interrupt names.
Simulink task priorities
Enter a vector of task priorities for the interrupts you want to process asynchronously.
See the discussion of this block’s “Vectorized Output” on page 9-8
for an explanation of task priorities.
Preemption flags
Enter a vector of preemption flags for the interrupts you want to process asynchronously.
See the discussion of this block’s “Vectorized Output” on page 9-8
for an explanation of preemption flags.
Enable simulation input
Select this check box if you want to be able to test asynchronous interrupt processing in the context of your Simulink software model.
Note Use this check box to enable you to test asynchronous interrupt processing behavior in Simulink software.
9-12
C281x Hardware Interrupt
References
See Also
Detailed information interrupt processing is in TMS320x281x DSP
System Control and Interrupts Reference Guide, Literature Number
SPRU078C, available at the Texas Instruments Web site.
The following links to block reference pages require that Target Support
Package TC2 is installed.
C281x Software Interrupt Trigger,C281x Timer, Idle Task
9-13
Hardware Interrupt
Purpose
Library
Description
Interrupt Service Routine to handle hardware interrupt on C5000 and
C6000 processors
C5000 DSP Chip Support in Embedded IDE Link CC
C6000 DSP Chip Support in Embedded IDE Link CC
Create interrupt service routines (ISR) in the software generated by the build process. When you incorporate this block in your model, code generation results in ISRs on the processor that run the processes that are downstream from the this block or a Task block connected to this block.
Dialog
Box
9-14
Interrupt numbers
Specify an array of interrupt numbers for the interrupts to install.
The following table provides the valid range for C5xxx and C6xxx processors:
Hardware Interrupt
Processor Family
C5xxx
C6xxx
Valid Interrupt Numbers
2
4
,
3
,
5
-
21
,
23
-
15
The width of the block output signal corresponds to the number of interrupt numbers specified here. Combined with the Simulink
task priorities that you enter and the preemption flag you enter for each interrupt, these three values define how the code and processor handle interrupts during asynchronous scheduler operations.
Simulink task priorities
Each output of the Hardware Interrupt block drives a downstream block (for example, a function call subsystem). Simulink software task priority specifies the Simulink priority of the downstream blocks. Specify an array of priorities corresponding to the interrupt numbers entered in Interrupt numbers.
Simulink task priority values are required to generate the proper rate transition code (refer to Rate Transitions and Asynchronous
Blocks). The task priority values are also required to ensure absolute time integrity when the asynchronous task needs to obtain real time from its base rate or its caller. Typically, you assign priorities for these asynchronous tasks that are higher than the priorities assigned to periodic tasks.
Preemption flags preemptable – 1, non-preemptable – 0
Higher priority interrupts can preempt interrupts that have lower priority. To allow you to control preemption, use the preemption flags to specify whether an interrupt can be preempted.
Entering
1 indicates that the interrupt can be preempted.
Entering
0 indicates the interrupt cannot be preempted. When
Interrupt numbers contains more than one interrupt priority, you can assign different preemption flags to each interrupt by entering a vector of flag values, corresponding to the order of
9-15
Hardware Interrupt the interrupts in Interrupt numbers. If Interrupt numbers contains more than one interrupt, and you enter only one flag value in this field, that status applies to all interrupts.
In the default settings
[0 1]
, the interrupt with priority
5 in Interrupt numbers is not preemptible and the priority
8 interrupt can be preempted.
Enable simulation input
When you select this option, Simulink software adds an input port to the Hardware Interrupt block. This port is used in simulation only. Connect one or more simulated interrupt sources to the simulation input.
9-16
Idle Task
Purpose
Library
Description
Create free-running task
Cxxxx DSP Chip Support in Embedded IDE Link CC
The Idle Task block, and the subsystem connected to it, specify one or more functions to execute as background tasks. All tasks executed through the Idle Task block are of the lowest priority, lower than that of the base rate task.
Vectorized Output
The block output comprises a set of vectors—the task numbers vector and the preemption flag or flags vector. Any preemption-flag vector must be the same length as the number of tasks vector unless the preemption flag vector has only one element. The value of the preemption flag determines whether a given interrupt (and task) is preemptible. Preemption overrides prioritization. A lower-priority nonpreemptible task can preempt a higher-priority preemptible task.
When the preemption flag vector has one element, that element value applies to all functions in the downstream subsystem as defined by the task numbers in the task number vector. If the preemption flag vector has the same number of elements as the task number vector, each task defined in the task number vector has a preemption status defined by the value of the corresponding element in the preemption flag vector.
9-17
Idle Task
Dialog
Box
9-18
Task numbers
Identifies the created tasks by number. Enter as many tasks as you need by entering a vector of integers. The default values are
[1,2] to indicate that the downstream subsystem has two functions.
The values you enter determine the execution order of the functions in the downstream subsystem, while the number of values you enter corresponds to the number of functions in the downstream subsystem.
Enter a vector containing the same number of elements as the number of functions in the downstream subsystem. This vector can contain no more than 16 elements, and the values must be from 0 to 15 inclusive.
The value of the first element in the vector determines the order in which the first function in the subsystem is executed, the value of the second element determines the order in which the second function in the subsystem is executed, and so on.
Idle Task
For example, entering [2,3,1] in this field indicates that there are three functions to be executed, and that the third function is executed first, the first function is executed second, and the second function is executed third. After all functions are executed, the Idle Task block cycles back and repeats the execution of the functions in the same order.
Preemption flags
Higher-priority interrupts can preempt interrupts that have lower priority. To allow you to control preemption, use the preemption flags to specify whether an interrupt can be preempted.
Entering
1 indicates that the interrupt can be preempted.
Entering
0 indicates the interrupt cannot be preempted. When
Task numbers contains more than one task, you can assign different preemption flags to each task by entering a vector of flag values, corresponding to the order of the tasks in Task numbers.
If Task numbers contains more than one task, and you enter only one flag value here, that status applies to all tasks.
In the default settings
[0 1]
, the task with priority
1 in Task
numbers is not preemptible, and the priority
2 task can be preempted.
Enable simulation input
When you select this option, Simulink software adds an input port to the Idle Task block. This port is used in simulation only. Connect one or more simulated interrupt sources to the simulation input.
Note Select this check box to test asynchronous interrupt processing behavior in Simulink software.
9-19
Memory Allocate
Purpose
Library
Description
Dialog
Box
Allocate memory section
Cxxxx DSP Chip Support in Embedded IDE Link CC
On C2xxx, C5xxx, or C6xxx processors, this block directs the TI compiler to allocate memory for a new variable you specify. Parameters in the block dialog box let you specify the variable name, the alignment of the variable in memory, the data type of the variable, and other features that fully define the memory required.
The block does not verify whether the entries for your variable are valid, such as checking the variable name, data type, or section. You must ensure that all variable names are valid, that they use valid data types, and that all section names you specify are valid as well.
The block does not have input or output ports. It only allocates a memory location. You do not connect it to other blocks in your model.
The block dialog box comprises multiple tabs:
• Memory — Allocate the memory for storing variables. Specify the data type and size.
• Section — Specify the memory section in which to allocate the variable.
The dialog box images show all of the available parameters enabled.
Some of the parameters shown do not appear until you select one or more other parameters.
9-20
Memory Allocate
The following sections describe the contents of each pane in the dialog box.
9-21
Memory Allocate
Memory Parameters
9-22
You find the following memory parameters on this tab.
Variable name
Specify the name of the variable to allocate. The variable is allocated in the generated code.
Memory Allocate
Specify variable alignment
Select this option to direct the compiler to align the variable in
Variable name to an alignment boundary. When you select this option, the Memory alignment boundary parameter appears so you can specify the alignment. Use this parameter and Memory
alignment boundary when your processor requires this feature.
Memory alignment boundary
After you select Specify variable alignment, this option enables you to specify the alignment boundary in bytes. If your variable contains more than one value, such as a vector or an array, the elements are aligned according to rules applied by the compiler.
Data type
Defines the data type for the variable. Select from the list of types available.
Specify data type qualifier
Selecting this enables Data type qualifier so you can specify the qualifier to apply to your variable.
Data type qualifier
After you select Specify data type qualifier, you enter the desired qualifier here.
Volatile is the default qualifier. Enter the qualifier you need as text. Common qualifiers are static and register
. The block does not check for valid qualifiers.
Data dimension
Specifies the number of elements of the type you specify in Data
type. Enter an integer here for the number of elements.
Initialize memory
Directs the block to initialize the memory location to a fixed value before processing.
Initial value
Specifies the initialization value for the variable. At run time, the block sets the memory location to this value.
9-23
Memory Allocate
Section Parameters
9-24
Parameters on this pane specify the section in memory to store the variable.
Specify memory section
Selecting this parameter enables you to specify the memory section to allocate space for the variable. Enter either one of the
Memory Allocate
See Also standard memory sections or a custom section that you declare elsewhere in your code.
Memory section
Identify a specific memory section to allocate the variable in
Variable name. Verify that the section has sufficient space to store your variable. After you specify a memory section by selecting Specify memory section and entering the section name in Memory section, use Bind memory section to bind the memory section to a location.
Bind memory section
After you specify a memory section by selecting Specify memory
section and entering the section name in Memory section, use this parameter to bind the memory section to the location in memory specified in Section start address. When you select this, you enable the Section start address parameter.
The new memory section specified in Memory section is defined when you check this parameter.
Note Do not use Bind memory section for existing memory sections.
Section start address
Specify the address to which to bind the memory section. Enter the address in decimal form or in hexadecimal with a conversion to decimal as shown by the default value hex2dec('8000')
. The block does not verify the address—verify that the address exists and can contain the memory section you entered in Memory
section.
Memory Copy
9-25
Memory Copy
Purpose
Library
Description
Copy to and from memory section
Cxxx DSP Chip Support in Embedded IDE Link CC
In generated code, this block copies variables or data from and to processor memory as configured by the block parameters. Your model can contain as many of these blocks as you require to manipulate memory on your processor.
Each block works with one variable, address, or set of addresses provided to the block. Parameters for the block let you specify both the source and destination for the memory copy, as well as options for initializing the memory locations.
Using parameters provided by the block, you can change options like the memory stride and offset at run time. In addition, by selecting various parameters in the block, you can write to memory at program initialization, at program termination, and at every sample time. The initialization process occurs once, rather than occurring for every read and write operation.
With the custom source code options, the block enables you to add custom ANSI C source code before and after each memory read and write (copy) operation. You can use the custom code capability to lock and unlock registers before and after accessing them. For example, some processors have registers that you may need to unlock and lock with EALLOW and EDIS macros before and after your program accesses them.
If your processor or board supports quick direct memory access (QDMA) the block provides a parameter to check that implements the QDMA copy operation, and enables you to specify a function call that can indicate that the QDMA copy is finished. Only the C621x, C64xx, and
C671x processor families support QDMA copy.
Block Operations
This block performs operations at three periods during program execution—initialization, real-time operations, and termination. With the options for setting memory initialization and termination, you
9-26
Dialog
Box
Memory Copy control when and how the block initializes memory, copies to and from memory, and terminates memory operations. The parameters enable you to turn on and off memory operations in all three periods independently.
Used in combination with the Memory Allocate block, this block supports building custom device drivers, such as PCI bus drivers or codec-style drivers, by letting you manipulate and allocate memory.
This block does not require the Memory Allocate block to be in the model.
In a simulation, this block does not perform any operation. The block output is not defined.
Copy Memory
When you employ this block to copy an individual data element from the source to the destination, the block copies the element from the source in the source data type, and then casts the data element to the destination data type as provided in the block parameters.
The block dialog box contains multiple tabs:
• Source — Identifies the sequential memory location to copy from.
Specify the data type, size, and other attributes of the source variable.
• Destination — Specify the memory location to copy the source to.
Here you also specify the attributes of the destination.
• Options — Select various parameters to control the copy process.
The dialog box images show many of the available parameters enabled.
Some parameters shown do not appear until you select one or more other parameters. Some parameters are not shown in the figures, but the text describes them and how to make them available.
9-27
Memory Copy
9-28
Sections that follow describe the parameters on each tab in the dialog box.
Source Parameters
Memory Copy
Copy from
Select the source of the data to copy. Choose one of the entries on the list:
• Input port
— This source reads the data from the block input port.
9-29
Memory Copy
• Specified address
— This source reads the data at the specified location in Specify address source and Address.
• Specified source code symbol
— This source tells the block to read the symbol (variable) you enter in Source code
symbol. When you select this copy from option, you enable the
Source code symbol parameter.
Note If you do not select Input port for Copy from, change
Data type from the default
Inherit from source to one of the data types on the Data type list. If you do not make the change, you receive an error message that the data type cannot be inherited because the input port does not exist.
Depending on the choice you make for Copy from, you see other parameters that let you configure the source of the data to copy.
Specify address source
This parameter directs the block to get the address for the variable either from an entry in Address or from the input port to the block. Select either
Specify via dialog or
Input port from the list. Selecting
Specify via dialog activates the Address parameter for you to enter the address for the variable.
When you select
Input port
, the port label on the block changes to
&src
, indicating that the block expects the address to come from the input port. Being able to change the address dynamically lets you use the block to copy different variables by providing the variable address from an upstream block in your model.
Source code symbol
Specify the symbol (variable) in the source code symbol table to copy. The symbol table for your program must include this symbol. The block does not verify that the symbol exists and uses valid syntax. Enter a string to specify the symbol exactly as you use it in your code.
9-30
Memory Copy
Address
When you select Specify via dialog for the address source, you enter the variable address here. Addresses should be in decimal form. Enter either the decimal address or the address as a hexadecimal string with single quotations marks and use hex2dec to convert the address to the proper format. The following example converts
Ox1000 to decimal form.
4096 = hex2dec('1000');
For this example, you could enter either
4096 or hex2dec('1000') as the address.
Data type
Use this parameter to specify the type of data that your source uses. The list includes the supported data types, such as int8
, uint32
, and
Boolean
, and the option
Inherit from source for inheriting the data type from the block input port.
Data length
Specifies the number of elements to copy from the source location.
Each element has the data type specified in Data type.
Use offset when reading
When you are reading the input, use this parameter to specify an offset for the input read. The offset value is in elements with the assigned data type. The Specify offset source parameter becomes available when you check this option.
Specify offset source
The block provides two sources for the offset —
Input port and
Specify via dialog
. Selecting
Input port configures the block input to read the offset value by adding an input port labeled src ofs
. This port enables your program to change the offset dynamically during execution by providing the offset value as an input to the block. If you select
Specify via dialog
, you enable the Offset parameter in this dialog box so you can enter the offset to use when reading the input data.
9-31
Memory Copy
Offset
Offset tells the block whether to copy the first element of the data at the input address or value, or skip one or more values before starting to copy the input to the destination. Offset defines how many values to skip before copying the first value to the destination. Offset equal to one is the default value and Offset accepts only positive integers of one or greater.
Stride
Stride lets you specify the spacing for reading the input. By default, the stride value is one, meaning the generated code reads the input data sequentially. When you add a stride value that is not equal to one, the block reads the input data elements not sequentially, but by skipping spaces in the source address equal to the stride. Stride must be a positive integer.
The next two figures help explain the stride concept. In the first figure you see data copied without any stride. Following that figure, the second figure shows a stride value of two applied to reading the input when the block is copying the input to an output location. You can specify a stride value for the output with parameter Stride on the Destination pane. Compare stride with offset to see the differences.
9-32
Memory Copy
9-33
Memory Copy
9-34
Destination Parameters
Memory Copy
Copy to
Select the destination for the data. Choose one of the entries on the list:
• Output port
— Copies the data to the block output port. From the output port the block passes data to downstream blocks in the code.
• Specified address
— Copies the data to the specified location in Specify address source and Address.
9-35
Memory Copy
• Specified source code symbol
— Tells the block to copy the variable or symbol (variable) to the symbol you enter in Source
code symbol. When you select this copy to option, you enable the Source code symbol parameter.
Depending on the choice you make for Copy from, you see other parameters that let you configure the source of the data to copy.
Specify address source
This parameter directs the block to get the address for the variable either from an entry in Address or from the input port to the block. Select either
Specify via dialog or
Input port from the list. Selecting
Specify via dialog activates the Address parameter for you to enter the address for the variable.
When you select
Input port
, the port label on the block changes to
&dst
, indicating that the block expects the destination address to come from the input port. Being able to change the address dynamically lets you use the block to copy different variables by providing the variable address from an upstream block in your model.
Source code symbol
Specify the symbol (variable) in the source code symbol table to copy. The symbol table for your program must include this symbol. The block does not verify that the symbol exists and uses valid syntax.
Address
When you select Specify via dialog for the address source, you enter the variable address here. Addresses should be in decimal form. Enter either the decimal address or the address as a hexadecimal string with single quotations marks and use hex2dec to convert the address to the proper format. This example converts
Ox2000 to decimal form.
8192 = hex2dec('2000');
9-36
Memory Copy
For this example, you could enter either
8192 or hex2dec('2000') as the address.
Data type
Use this parameter to specify the type of data that your variable uses. The list includes the supported data types, such as int8
, uint32
, and
Boolean
, and the option inherit from source for inheriting the data type for the variable from the block input port.
Specify offset source
The block provides two sources for the offset—
Input port and
Specify via dialog
. Selecting
Input port configures the block input to read the offset value by adding an input port labeled src ofs
. This port enables your program to change the offset dynamically during execution by providing the offset value as an input to the block. If you select
Specify via dialog
, you enable the Offset parameter in this dialog box so you can enter the offset to use when writing the output data.
Offset
Offset tells the block whether to write the first element of the data to be copied to the first destination address location, or skip one or more locations at the destination before writing the output.
Offset defines how many values to skip in the destination before writing the first value to the destination. One is the default offset value and Offset accepts only positive integers of one or greater.
Stride
Stride lets you specify the spacing for copying the input to the destination. By default, the stride value is one, meaning the generated code writes the input data sequentially to the destination in consecutive locations. When you add a stride value not equal to one, the output data is stored not sequentially, but by skipping addresses equal to the stride. Stride must be a positive integer.
This figure shows a stride value of three applied to writing the input to an output location. You can specify a stride value for the input with parameter Stride on the Source pane. As shown in
9-37
Memory Copy the figure, you can use both an input stride and output stride at the same time to enable you to manipulate your memory more fully.
9-38
Sample time
Sample time sets the rate at which the memory copy operation occurs, in seconds. The default value
Inf tells the block to use a constant sample time. You can set Sample time to
-1 to direct the block to inherit the sample time from the input, if there is one,
Memory Copy or the Simulink software model (when there are no input ports on the block). Enter the sample time in seconds as you need.
9-39
Memory Copy
Options Parameters
9-40
Memory Copy
Set memory value at initialization
When you check this option, you direct the block to initialize the memory location to a specific value when you initialize your program at run time. After you select this option, use the Set
memory value at termination and Specify initialization
value source parameters to set your desired value. Alternately, you can tell the block to get the initial value from the block input.
Specify initialization value source
After you check Set memory value at initialization, use this parameter to select the source of the initial value. Choose either
• Specify constant value
— Sets a single value to use when your program initializes memory. Enter any value that meets your needs.
• Specify source code symbol
— Specifies a variable (a symbol) to use for the initial value. Enter the symbol as a string.
Initialization value (constant)
If you check Set memory value at initialization and choose
Specify constant value for Specify initialization value
source, enter the constant value to use in this field. Any real value that meets your needs is acceptable.
Initialization value (source code symbol)
If you check Set memory value at initialization and choose
Specify source code symbol for Specify initialization value
source, enter the symbol to use in this field. Any symbol that meets your needs and is in the symbol table for the program is acceptable. When you enter the symbol, the block does not verify whether the symbol is a valid one. If it is not valid you get an error when you try to compile, link, and run your generated code.
Apply initialization value as mask
You can use the initialization value as a mask to manipulate register contents at the bit level. Your initialization value is treated as a string of bits for the mask.
9-41
Memory Copy
Checking this parameter enables the Bitwise operator parameter for you to define how to apply the mask value.
To use your initialization value as a mask, the output from the copy has to be a specific address. It cannot be an output port, but it can be a symbol.
Bitwise operator
To use the initialization value as a mask, select one of the entries on the following table from the Bitwise operator list to describe how to apply the value as a mask to the memory value.
Bitwise
Operator List
Entry bitwise AND bitwise OR bitwise exclusive OR left shift right shift
Description
Apply the mask value as a bitwise AND to the value in the register.
Apply the mask value as a bitwise OR to the value in the register.
Apply the mask value as a bitwise exclusive
OR to the value in the register.
Shift the bits in the register left by the number of bits represented by the initialization value. For example, if your initialization value is 3, the block shifts the register value to the left 3 bits. In this case, the value must be a positive integer.
Shift the bits in the register to the right by the number of bits represented by the initialization value. For example, if your initialization value is 6, the block shifts the register value to the right 6 bits. In this case, the value must be a positive integer.
9-42
Memory Copy
Applying a mask to the copy process lets you select individual bits in the result, for example, to read the value of the fifth bit by applying the mask.
Set memory value at termination
Along with initializing memory when the program starts to access this memory location, this parameter directs the program to set memory to a specific value when the program terminates.
Set memory value only at initialization/termination
This block performs operations at three periods during program execution—initialization, real-time operations, and termination.
When you check this option, the block only does the memory initialization and termination processes. It does not perform any copies during real-time operations.
Insert custom code before memory write
Select this parameter to add custom ANSI C code before the program writes to the specified memory location. When you select this option, you enable the Custom code parameter where you enter your ANSI C code.
Custom code
Enter the custom ANSI C code to insert into the generated code just before the memory write operation. Code you enter in this field appears in the generated code exactly as you enter it.
Insert custom code after memory write
Select this parameter to add custom ANSI C code immediately after the program writes to the specified memory location. When you select this option, you enable the Custom code parameter where you enter your ANSI C code.
Custom code
Enter the custom ANSI C code to insert into the generated code just after the memory write operation. Code you enter in this field appears in the generated code exactly as you enter it.
9-43
Memory Copy
See Also
Use QDMA for copy (if available)
For processors that support quick direct memory access (QDMA), select this parameter to enable the QDMA operation and to access the blocking mode parameter.
If you select this parameter, your source and destination data types must be the same or the copy operation returns an error.
Also, the input and output stride values must be one.
Enable blocking mode
If you select the Use QDMA for copy parameter, select this option to make the memory copy operations blocking processes.
With blocking enabled, other processing in the program waits while the memory copy operation finishes.
Memory Allocate
9-44
Target Preferences
Purpose
Library
Description
Configure model for Texas Instruments processor
Target Preferences in Embedded IDE Link CC
Options on the block dialog box let you set features of code generation for your custom C2xxx, F28xx, C5xxx, and C6xxx processor-based board. Adding this block to your Simulink software model provides access to the processor hardware settings you need to configure when you generate a project from a Simulink software model or you generate code from Real-Time Workshop software to run on a processor or board.
Any model that you use to generate a project or that you develop for custom hardware must include this block. Simulink or Real-Time
Workshop software returns an error message if a target preferences block is not present in your model when you try to generate projects or code.
Note This block must be in your model at the top level and not in a subsystem. It does not connect to any other blocks, but stands alone to set the processor preferences for the model. Simulink software returns an error when your model does not include a Target Preferences block or has more than one.
The processor and processor options you specify on this block are:
• Processor and board information
• Memory mapping and layout
• Allocation of the various code sections, such as compiler, DSP/BIOS, and custom sections
• Operating parameters for peripherals on c280x and c281x processors
Setting the options included in this dialog box results in identifying your processor to Real-Time Workshop software, Embedded IDE Link
CC, and Simulink software. Setting the options also, configures the
9-45
Target Preferences
Dialog
Box memory map for your processor. Both steps are essential for generating code for any board that is custom or explicitly supported, such as the
C6711 DSK or the DM642 EVM.
Unlike most other blocks, you cannot open the block dialog box until you add the block to a model. When you open the block dialog, the block attempts to connect to your processor. It cannot make the connection when the block is in the library and returns an error message.
Note If you do not have Texas Instruments’ Code Composer Studio software installed, you cannot open this block.
Generating Code from Model Subsystems
Real-Time Workshop software provides the ability to generate code from a selected subsystem in a model. To generate code for custom
C2xxx, C5xxx, or C6xxx processor-based hardware from a subsystem, the subsystem model must include a Target Preferences block.
This reference page section contains the following subsections:
• “Board Info Pane” on page 9-48
• “Physical Memory Options” on page 9-54
• “Sections Pane” on page 9-58
• “DSP/BIOS Pane” on page 9-62
• “Peripherals Pane” on page 9-65
• “New Processor Dialog Box” on page 9-107
9-46
Target Preferences
Target Preferences block dialog boxes provide tabbed access to the following panes with options you set for the processor and board:
• Board info — Select the processor, set the clock speed, and identify the processor. In addition, Add new on this pane opens the New
Processor dialog box.
• Memory — Set the memory allocation and layout on the processor
(memory mapping).
9-47
Target Preferences
• Sections — Determine the arrangement and location of the sections on the processor such as where to put the DSP/BIOS and compiler information.
• DSP/BIOS — (Optional) Specify how to configure tasking features of DSP/BIOS.
• Peripherals — (Only for C2xxx family processors) Specify how to configure the peripherals provided by C2xxx processors, such as the
SPI_A, SPI_B, GPIO, or eCAP peripherals.
Board Info Pane
The following options appear on the Board Info pane for the C6000
Target Preferences dialog box.
Board type
Lets you enter the type of board you are processoring with the model. You can enter
Custom to support any board that uses one of the processors on the Processor list, or enter the name of one of the supported boards, such as
C6711DSK
. If you are using one of the explicitly supported boards, choose the Target Preferences block for that board and this field shows the proper board type.
Processor
Lets you select the type of processor to use from the list. The processor you select determines the contents and setting for options on the Memory and Sections panes in this dialog box.
This selection controls the Operating system option. Selecting a processor that supports DSP/BIOS, such as a C6416, enables
Operating system. If your processor does not support DSP/BIOS, such as the C2xxx processors, Operating system is disabled.
Add new
Clicking Add new opens a new dialog box where you specify configuration information for a processor that is not on the
Processor list. Use Add new to create a profile and memory map for chips that are not on the Processor list. The profile includes information such as processor class and CPU clock speed.
9-48
Target Preferences
Adding the new processor puts the processor on the Processor list for all Target Preferences blocks, not just this one.
The new processor and configuration become available for all models that include a Target Preferences block.
For details about the New Processor dialog box, refer to New
Processor Dialog Box.
Edit
Edit the configuration for the processor you select on the
Processor list.
Delete
Delete a processor that you added to the Processor list. You cannot delete processors that you did not add.
CPU Clock Speed (MHz)
Shows the clock speed of the processor on your processor. When you enter a value, you are not changing the CPU clock rate. You are reporting the actual rate. If the value you enter does not match the rate on the processor, your model’s real-time results may be wrong, and the code profiling results are not correct.
Enter the actual clock rate the board uses. The rate you enter in this field does not change the rate on the board. Setting CPU
clock speed to the actual board rate allows the code you generate to run correctly according to the actual clock rate of the hardware.
When you generate code for C6xxx processors from Simulink software models, you may encounter the software timer. The timer is invoked automatically to handle and create interrupts to drive your model when either of the following conditions occur:
• Your model does not include ADC or DAC blocks
• When the processing rates in your model change (the model is multirate)
9-49
Target Preferences
Correctly generating interrupts for your model depends on the clock rate of the CPU on your processor. You can change the rate with the DIP switches on the board or from one of the Texas
Instruments software utilities.
For the timer software to calculate the interrupts correctly,
Embedded IDE Link CC needs to know the actual clock rate of your processor as you configured it. CPU clock speed lets you tell the timer the rate at which your processor CPU runs, which is the rate to use to match the CPU rate.
The timer uses the CPU clock rate you specify in CPU clock
speed to calculate the time for each interrupt. For example, if your model includes a sine wave generator block running at 1 kHz feeding a signal into an FIR filter block, the timer needs to create interrupts to generate the sine wave samples at the proper rate.
Using the clock rate you choose,
100 MHz for example, the timer calculates the sine generator interrupt period as follows for the sine block:
• Sine block rate = 1 kHz, or 0.001 s/sample
• CPU clock rate = 100 MHz, or 0.000000001 s/sample
To create sine block interrupts at 0.001 s/sample requires:
100,000,000/1000 = 1 Sine block interrupt per 100,000 clock ticks
Thus, you must report the correct clock rate, or the interrupts come at the wrong times and the results are incorrect.
Simulator
Select this option when you are developing for a simulator rather than a hardware processor. You must select Simulator to processor your code to a C6xxx simulator.
9-50
Target Preferences
Enable High-Speed RTDX
Select this option to tell the code generation process to enable high-speed RTDX for this model.
Operating System
Specify whether to use a real-time operating system (RTOS) with your model. Choose
DSP/BIOS from the list to add the
DSP/BIOS RTOS features to your project. Select
None to disable the DSP/BIOS features.
You must have Target Support Package TC6 software installed to access this option.
Board Custom Code
Entries in this group specify the locations of custom source files or libraries or other functions. Options provide access to text areas where you enter files and file paths:
• Source files
— Enter the full paths to source code files to use with this processor. By default there are no entries in this parameter.
• Include paths
— If you require additional files on your path, add them by typing the path into the text area. The default setting does not include additional paths.
• Libraries
— These entries identify specific libraries that the processor requires. They appear on the list by default if required. Add more by entering the full path to the library with the library file in the text area. No additional libraries appear here in the default configuration.
• Initialize functions
— If your project requires an initialize function, enter it in this field. By default, this parameter is empty.
• Terminate functions
— Enter a function to run when a program terminates. The default setting is not to include a specific termination function.
9-51
Target Preferences
Note When you enter a file path, library, or function, the block does not verify that the path or function exists or is valid. Invalid or incorrect entries in these fields may cause errors during code generation.
To enter a path to a file, library, or other custom code, use the following string in the path to refer to the CCS installation directory.
$(install_dir)
Enter new paths or files (custom code items) one entry per line.
Include the full path to the file for libraries and source code.
Board custom code options do not support functions that use return arguments or values. Only functions of type void fname void are valid as entries in these parameters.
Board name
Contains a list of all the boards defined in CCS Setup. From the list of available boards, select the one that you are processoring.
Processor name
Lists the processors on the board you selected for processoring in
Board name. In most cases, only one name appears because the board has one processor. In the multiprocessor case, select the processor by name from the list.
Memory Pane
When you processor any board, you need to specify the layout of the physical memory on your processor and board to determine how use it for your program. For supported boards, the board-specific Target
Preferences blocks set the default memory map.
9-52
Target Preferences
The Memory pane contains memory options for three kinds of memory:
• Physical Memory — Specifies the processor and board memory map
• Heap — Specifies whether you use a heap and determines the size in words
• Cache Configuration — Select a cache configuration where available, such as L2 cache, and select one of the corresponding configuration options, such as
32kb
.
9-53
Target Preferences
Be aware that these options may affect the options on the Sections pane. You can make selections here that change how you configure options on the Sections pane.
Most of the information about memory segments and memory allocation is available from the online help system for CCS.
Physical Memory Options
This list shows the physical memory segments available on the board and processor. By default, Target Preferences blocks show the memory segments found on the selected processor. In addition, the Memory pane on preconfigured Target Preferences blocks shows the memory segments available on the board, but external to the processor. Target
Preferences blocks set default starting addresses, lengths, and contents of the default memory segments.
The default memory segments for each processor and board are different. For example:
• Custom boards based on C670x processors provide IPRAM and
IDRAM memory segments by default.
• C671x processors provide IRAM memory segment by default.
Name
When you highlight an entry on the Memory bank list list, the name of the entry appears in this field. To change the name of the existing memory segment, select it on Memory bank list and then type the new name in this field.
Note You cannot change the names of default processor memory segments. You can change the attributes of memory segments.
To add a new physical memory segment to the list, click Add, replace the temporary label in Name with the one to use, and press Return. Your new segment appears on the list.
9-54
Target Preferences
After you add the segment, you can configure the starting address, length, and contents for the new segment. New segments start with code and data as the type of content that can be stored in the segment (refer to the Contents option).
Names are case sensitive.
NewSegment is not the same as newsegment or newSegment
.
Address
Address reports the starting address for the memory segment showing in Name. Address entries are in hexadecimal format and limited only by the board or processor memory.
Length
From the starting address, Length sets the length of the memory allocated to the segment in Name. As in all memory entries, specify the length in hexadecimal format, in minimum addressable data units (MADUs). For the C6000 processor family, the MADU is 8 bytes, one word.
Contents
Contents details the kind of program sections that you can store in the memory segment in Name. As the processor type for the
Target Preferences block changes, the kinds of information you store in listed memory segments may change. Generally, the
Contents list contains these strings:
• Code
— Allow code to be stored in the memory segment in
Name.
• Data
— Allow data to be stored in the memory segment in
Name.
• Code & Data
— Allow code and data to be stored in the memory segment in Name. When you add a new memory segment, this is the default setting for the contents of the new element.
You may add or use as many segments of each type as you need, within the limits of the memory on your processor. Every processor must have sections that can hold code and data.
9-55
Target Preferences
Add
Click Add to add a new memory segment to the processor memory map. When you click Add, a new segment name appears, for example
NEWMEM1
, in Name and on the Memory bank list list.
In Name, change the temporary name
NEWMEM1 by entering the new segment name. Entering the new name, or clicking Apply, updates the temporary name on the list to the name you enter.
Remove
This option lets you remove a memory segment from the memory map. Select the segment to remove on the Memory bank list list and click Remove to delete the segment.
Create Heap
Note To enable the Heap option, select DSP/BIOS for Operating
system on the Board Info pane.
If your processor supports using a heap, as the C6711 does, selecting this option enables creating the heap, and enables the
Heap size option. Create heap is not available on processors that either do not provide a heap or do not allow you to configure the heap.
Using this option you can create a heap in any memory segment on the Memory bank list list. Select the memory segment on the list and then select Create heap to create a heap in the select segment. After you create the heap, use the Heap size and
Define label options to configure the heap.
The location of the heap in the memory segment is not under your control. The only way to control the location of the heap in a segment is to make the segment and the heap the same size.
Otherwise, the compiler determines the location of the heap in the segment.
9-56
Target Preferences
Heap Size
After you select Create heap, this option lets you specify the size of the heap in words. Enter the number of words in decimal format. When you enter the heap size in decimal words, the system converts the decimal value to hexadecimal format. You can enter the value directly in hexadecimal format as well.
Processors may support different maximum heap sizes.
Define Label
Selecting Create heap enables this option that allows you to name the heap. Enter your label for the heap in the Heap label option.
Heap Label
Use this option, which you enable by selecting Define label, to provide the label for the heap. Any combination of characters is accepted for the label, except reserved characters in C/C++ compilers.
Note When you enter a label, the block does not verify that the label is valid. An invalid label in this field may cause errors during code generation.
Cache Configuration
C621x, C671x, and C641x processors support an L2 cache memory structure that you can configure as SRAM and partial cache.
Both the data memory and the program share this second-level memory. C620x DSPs do not support L2 cache memory and this option is not available when you choose one of the C620x processors as your processor.
If your processor supports the two-level memory scheme, this option enables the L2 cache on the processor.
Some processors support code base memory organization. For example, a part of internal memory can be configure as code.
9-57
Target Preferences
Cache level lets you select one of the available cache levels to configure by selecting one of its configurations. For example, you can select L2 cache level and choose one of its configurations, such as
32kB
.
Sections Pane
Options on this pane let you specify where various program sections should go in memory. Program sections are distinct from memory segments—sections are portions of the executable code stored in contiguous memory locations. Commonly used sections include .
text
,
.
bss
, .
data
, and .
stack
. Some sections relate to the compiler and some can be custom sections.
For more information about program sections and objects, refer to the
Code Composer Studio online help.
9-58
Target Preferences
Within this pane, you configure the allocation of sections for Compiler,
DSP/BIOS, and Custom needs.
This table provides brief definitions of the kinds of sections in the
Compiler sections, DSP/BIOS sections/objects, and Custom
sections lists in the pane. All sections do not appear on all lists. The list the string appears on is shown in the table.
9-59
Target Preferences
String
.args
.bss
.bios
.cinit
.cio
.const
.data
.far
.gblinit
.hwi
.hwi_vec
.obj
.pinit
.rtdx_text
.stack
.switch
.sysdata
Section
List Description of the Section Contents
DSP/BIOS Argument buffers
Compiler Static and global C variables in the code
DSP/BIOS DSP/BIOS code if you are using
DSP/BIOS options in your program
Compiler Tables for initializing global and static variables and constants
Compiler
Compiler
Standard I/O buffer for C programs
Data defined with the C qualifier and string constants
Program data for execution Compiler
Compiler Variables, both static and global, defined as far variables
DSP/BIOS Load allocation of the DSP/BIOS startup initialization tables section
DSP/BIOS Dispatch code for interrupt service routines
DSP/BIOS Interrupt Service Table
DSP/BIOS Configuration properties that the processor program can read
Compiler Load allocation of the table of global object constructors section
DSP/BIOS Code sections for the RTDX program modules
Compiler
Compiler
The global stack
Jump tables for switch statements in the executable code
DSP/BIOS Data about DSP/BIOS
9-60
Target Preferences
String
.sysinit
.sysmem
.text
.trcdata
Section
List Description of the Section Contents
DSP/BIOS DSP/BIOS initialization startup code
Compiler
Compiler
Dynamically allocated object in the code containing the heap
Load allocation for the literal strings, executable code, and compiler generated constants
DSP/BIOS TRC mask variable and its initial value section load allocation
You can learn more about memory sections and objects in your Code
Composer Studio online help.
Default Sections
When you highlight a section on the list, Description show a brief description of the section. Also,Placement shows you where the section is presently allocated in memory.
Description
Provides a brief explanation of the contents of the selected entry on the Compiler sections list.
Placement
Shows you where the selected Compiler sections list entry is allocated in memory. You change the memory allocation by selecting a different location from the Placement list. The list contains the memory segments as defined in the physical memory map on the Memory pane. Select one of the listed memory segments to allocate the highlighted compiler section to the segment.
Custom Sections
When your program uses code or data sections that are not included in either the Compiler sections or DSP/BIOS
sections lists, you add the new sections to this list. Initially, the
9-61
Target Preferences
Custom sections list contains no fixed entries, but instead, only a placeholder for a section for you to define.
Name
You enter the name for your new section here. To add a new section, click Add. Then, replace the temporary name with the name to use. Although the temporary name includes a period at the beginning you do not need to include the period in your new name. Names are case sensitive.
NewSection is not the same as newsection
, or newSection
.
Placement
With your new section added to the Name list, select the memory segment to which to add your new section. Within the restrictions imposed by the hardware and compiler, you can select any segment that appears on the list.
Add
Clicking Add lets you configure a new entry to the list of custom sections. When you click Add, the block provides a new temporary name in Name. Enter the new section name to add the section to the Custom sections list. After typing the new name, click
Apply to add the new section to the list. You can also click OK to add the section to the list and close the dialog box.
Remove
To remove a section from the Custom sections list, select the section and click Remove.
DSP/BIOS Pane
Selecting
DSP/BIOS for Operating system on the Board Info pane enables this pane.
To enable the DSP/BIOS pane, you must have installed Target Support
Package TC6 and you must select
DSP/BIOS from the Operating
system list on the Board Info pane.
Options on this pane let you specify how to configure various modules of
DSP/BIOS.
9-62
Target Preferences
When you set the Operating system option to
None
, you disable the options in this pane.
For more information about tasks, refer to the Code Composer Studio online help.
Within this pane, you configure the options for DSP/BIOS tasks.
9-63
Target Preferences
DSP/BIOS sections/objects
During program compilation, DSP/BIOS produces both uninitialized and initialized blocks of data and code. These blocks get allocated into memory as required by the configuration of your system. On the DSP/BIOS sections list you find both initialized
(sections that contain data or executable code) and uninitialized
(sections that reserve space in memory) sections.
Description
Provides a brief explanation of the contents of the selected
DSP/BIOS sections list entry.
Placement
Shows where the selected DSP/BIOS sections/objects list entry is allocated in memory. You change the memory allocation by selecting a different location from the Placement list. The list contains the memory segments available on C6000 processors and changes based on the processor you are using.
DSP/BIOS Object Placement
Distinct from the entries on the DSP/BIOS sections list,
DSP/BIOS objects like STS or LOG, if your project uses them, get placed in the memory segment you select from the DSP/BIOS
Object Placement list. All DSP/BIOS objects use the same memory segment. You cannot select the location for individual objects.
Data object placement
Specify where to place new data objects in memory.
Code object placement
Specify where to place new code objects in memory.
Default stack size (bytes)
DSP/BIOS uses a stack to save and restore variables and CPU context during thread preemption for task threads. This option sets the size of the DSP/BIOS stack in bytes allocated for each task. 4096 bytes is the default value. You can set any size up to the limits for the processor. Set the stack size so that tasks do not
9-64
Target Preferences use more memory than you allocate. While any task can use more memory than the stack includes, exceeding the stack memory size might cause the task to write into other memory or data areas, possibly causing unpredictable behavior.
Stack segment for static tasks
Use this option to specify where to allocate the stack for static tasks. Static tasks are created whether or not they are needed for operation, compared to dynamic tasks that the system creates as needed. Tasks that your program uses often might be good candidates for static tasks. Infrequently used tasks usually work best as dynamic tasks.
The list offers
IDRAM for locating the stack in memory. The
Memory pane provides more options for the physical memory on the processor.
Stack segment for dynamic tasks
Like static tasks, dynamic tasks use a stack as well. Setting this option specifies where to locate the stack for dynamic tasks. In this case,
MEM_NULL is the only valid stack location in memory.
You must allocate system heap storage to use this option. Specify the system heap configuration on the Memory pane.
Peripherals Pane
When you choose a C2000 processor from the Processor list on the
Board info pane, this tabbed pane appears to configure peripheral settings and pin assignments.
You must have Target Support Package TC2 installed to enable this pane when you select a C2000 processor.
To set the attributes for a peripheral, select the peripheral from the
Peripherals list and then set the attribute options on the right side.
The following table describes all of the peripherals provided on the
Peripherals list. Some peripherals may not be available on some
C2000 processors.
9-65
Target Preferences
Peripheral
Name
ADC eCAN_A eCAN_B eCAP ePWM
I2C
SCI_A
SCI_B
SCI_C
SPI_A
SPI_B
SPI_C
SPI_D eQEP
Watchdog
Description
Report the settings for the Analog-to-Digital Converter
Report or set the enhanced Controller Area Network parameters for module A
Report or set the enhanced Controller Area Network parameters for module B
Report or assign enhanced CAPture module pins to general purpose IO pins
Report or assign enhanced Pulse Width Modulation pins to general purpose IO pins
Report or set Inter-Integrated Circuit parameters
Report or set the Serial Communications Interface parameters for module A
Report or set the Serial Communications Interface parameters for module B
Report or set the Serial Communications Interface parameters for module B
Report or set the Serial Peripheral Interface parameters for module A
Report or set the Serial Peripheral Interface parameters for module B
Report or set the Serial Peripheral Interface parameters for module C
Report or set the Serial Peripheral Interface parameters for module D
Report or assign enhanced Quadrature Encoder Pulse module pins to general purpose IO pins
Enable and configure timing for watchdog module
9-66
Target Preferences
Peripheral
Name
Description
GPIO[pin#] Configure input qualification types for General
Purpose Input Output pins
Flash_loader Enable and configure flash memory programmer.
Manually program flash
DMA_ch[#] Enable and configure Direct Memory Access channels
9-67
Target Preferences
9-68
ADC
The internal timing of the ADC module is controlled by the high-speed peripheral clock (HSPCLK). The ADC operating clock speed is derived in several prescaler stages from the HSPCLK speed. For more information about configuring these scalers, refer to “Configuring ADC Parameters for Acquisition Window Width” in the Target Support Package TC2 documentation (available if you have installed Target Support Package TC2).
Target Preferences
You can set the following parameters for the ADC clock prescaler:
ACQ_PS
This value does not actually have a direct effect on the ADC module’s core clock speed. It serves to determine the width of the sampling or acquisition period. The higher the value, the wider is the sampling period. The default value is
4
.
ADCLKPS
The HSPCLK speed is divided by this 4-bit value as the first step in deriving the ADC module’s core clock speed. The default value is
3
.
CPS
After the HSPCLK speed is divided by the ADCLKPS value, the result is further divided by 2 if the CPS parameter is set to
1
, which is the default.
External reference
By default, an internally generated bandgap voltage reference is selected to supply the ADC logic. However, depending on application requirements, the ADC logic may be supplied by an external voltage reference. Choose
True to use an external voltage reference.
Offset
The 280x ADC supports offset correction via a 9-bit value that is added or subtracted before the results are available in the ADC result registers. Timing for results is not affected. The default value is
0
.
eCAN_A
For more help on setting the timing parameters for the eCAN modules, refer to Configuring Timing Parameters for CAN Blocks.
You can set the following parameters for the eCAN module:
Baud rate prescaler
Value by which to scale the bit rate. Valid values are from
1 to
256
.
9-69
Target Preferences
Enhanced CAN mode
Whether to use the CAN module in extended mode, which provides additional mailboxes and time stamping. The default is
True
. Selecting
False enables only standard mode.
SAM
Number of samples used by the CAN module to determine the CAN bus level. Selecting
Sample_one_time samples once at the sampling point. Selecting
Sample_three_times samples once at the sampling point and twice before at a distance of TQ/2. A majority decision is made from the three points.
SBG
Sets the message resynchronization triggering.
Options are
Only_falling_edges and
Both_falling_and_rising_edges
.
SJW
Sets the synchronization jump width, which determines how many units of TQ a bit is allowed to be shortened or lengthened when resynchronizing.
Self test mode
If this parameter is set to
True
, the eCAN module goes to loopback mode, where a “dummy” acknowledge message is sent back without needing an acknowledge bit. The default is
False
.
TSEG1
Sets the value of time segment 1, which, with TSEG2 and
Baud rate prescaler, determines the length of a bit on the eCAN bus. Valid values for TSEG1 are from
1 through
16
.
TSEG2
Sets the value of time segment 2, which, with TSEG1 and
Baud rate prescaler, determines the length of a bit on the eCAN bus. Valid values for TSEG2 are from
1 through
8
.
9-70
Target Preferences eCAN_B
The parameters you can set for the eCAN_B module include all the parameters for the eCAN_A module plus the following parameters which apply only when you use the eCAN_B module:
Pin assignment (Rx)
Assigns the CAN receive pin to use with the eCAN_B module.
Possible values are
GPIO10
,
GPIO13
,
GPIO17
, and
GPIO21
.
Pin assignment (Tx)
Assigns the CAN transmit pin to use with the eCAN_B module. Possible values are
GPIO8
,
GPIO12
,
GPIO16
, and
GPIO20
.
eCAP
Assigns eCAP pins to GPIO pins if required.
ECAP1 pin assignment
Select an option from the list—
None
,
GPIO5
, or
GPIO24
.
ECAP2 pin assignment
Select an option from the list—
None
,
GPIO7
, or
GPIO25
.
ECAP3 pin assignment
Select an option from the list—
None
,
GPIO9
, or
GPIO26
.
ECAP4 pin assignment
Select an option from the list—
None
,
GPIO11
, or
GPIO27
.
ePWM
Assigns ePWM signals to GPIO pins, if required.
SYNCI pin assignment
Assigns the ePWM external sync pulse input (SYNCI) to a GPIO pin. Choices are
None
(the default),
GPIO6
, and
GPIO32
.
9-71
Target Preferences
SYNCO pin assignment
Assigns the ePWM external sync pulse output (SYNCO) to a GPIO pin. Choices are
None
(the default),
GPIO6
, and
GPIO33
.
TZ5 pin assignment
Assigns the trip-zone input 5 (TZ5) to a GPIO pin. Choices are
None
(the default),
GPIO16
, and
GPIO28
.
TZ6 pin assignment
Assigns the trip-zone input 6 (TZ6) to a GPIO pin. Choices are
None
(the default),
GPIO17
, and
GPIO29
.
I2C
Report or set Inter-Integrated Circuit parameters. For more information, consult the TMS320x280x Inter-Integrated Circuit
Module Reference Guide, Literature Number: SPRU721A, available on the Texas Instruments Web site.
Mode
Configure the I2C module as
Master or
Slave
.
If a module is an I2C master, it:
• Initiates communication with slave nodes by sending the slave address and requesting data transfer to or from the slave.
• Outputs the Master clock frequency on the serial clock line (SCL) line.
If a module is an I2C slave, it:
• Synchronizes itself with the serial clock line (SCL) line.
• Responds to communication requests from the master.
When Mode is
Slave
, you can configure the Addressing
format, Address register, and Bit count parameters.
9-72
Target Preferences
The Mode parameter corresponds to bit 10 (MST) of the
I2C Mode Register (I2CMDR).
Addressing format
If Mode is
Slave
, determine the addressing format of the
I2C master, and set the I2C module to the same mode:
• 7-Bit Addressing
, the normal address mode.
• 10-Bit Addressing
, the expanded address mode.
• Free Data Format
, a mode that does not use addresses.
(If Enable loopback is enabled,
Free data format is not supported.)
The Addressing format parameter corresponds to bit 3
(FDF) and bit 8 (XA) of the I2C Mode Register (I2CMDR).
Own address register
If Mode is
Slave
, enter the 7-bit (0–127) or 10-bit (0–1023) address this I2C module uses while it is a slave.
This parameter corresponds to bits 9–0 (OAR) of the I2C
Own Address Register (I2COAR).
Bit count
If Mode is
Slave
, set the number of bits in each data byte the I2C module transmits and receives. This value must match that of the I2C master.
This parameter corresponds to bits 2–0 (BC) of the I2C
Mode Register (I2CMDR).
Module clock frequency
This field displays the frequency the I2C module uses internally. To set this value, change the Module clock
prescaler. For more information about this value, consult the “Clock Generation” section in the TMS320x280x
Inter-Integrated Circuit Module Reference Guide, Literature
9-73
Target Preferences
Number: SPRU721, available on the Texas Instruments
Web site.
Module clock prescaler
If Mode is
Master
, configure the module clock frequency by entering a value from 0–255.
Module clock frequency = I2C input clock frequency / (Module
clock prescaler + 1)
The I2C specifications require a module clock frequency between 7 MHz and 12 MHz.
The I2C input clock frequency depends on the DSP input clock frequency and the value of the PLL Control Register divider (PLLCR). For more information on setting the
PLLCR, consult the documentation for your specific Digital
Signal Controller.
This Module clock prescaler corresponds to bits 7–0
(IPSC) of the I2C Prescaler Register (I2CPSC).
Master clock Low-time divider
When Mode is
Master
, this divider determines the duration of the low state of the SCL line on the I2C-bus.
The low-time duration of the master clock = Tmod x (ICCL
+ d).
For more information about this value, consult the “Formula for the Master Clock Period” section in the TMS320x280x
Inter-Integrated Circuit Module Reference Guide, Literature
Number: SPRU721A, available on the Texas Instruments
Web site.
This parameter corresponds to bits 15–0 (ICCL) of the Clock
Low-Time Divider Register (I2CCLKL).
9-74
Target Preferences
Master clock High-time divider
When Mode is
Master
, this divider determines the duration of the high state on the serial clock pin (SCL) of the I2C-bus.
The high-time duration of the master clock = Tmod x (ICCL
+ d).
For more information about this value, consult the “Formula for the Master Clock Period” section in the TMS320x280x
Inter-Integrated Circuit Module Reference Guide, Literature
Number: SPRU721A, available on the Texas Instruments
Web site.
This parameter corresponds to bits 15–0 (ICCH) of the Clock
High-Time Divider Register (I2CCLKH).
Enable loopback
When Mode is
Master
, enable or disable digital loopback mode. In digital loopback mode, I2CDXR transmits data over an internal path to I2CDRR, which receives the data after a configurable delay. The delay, measured in DSP cycles, equals (I2C input clock frequency/module clock frequency) x 8.
While Enable loopback is enabled, free data format addressing is not supported.
This parameter corresponds to bit 6 (DLB) of the I2C Mode
Register (I2CMDR).
Enable Tx Interrupt
This parameter corresponds to bit 5 (TXFFIENA) of the I2C
Transmit FIFO Register (I2CFFTX).
Tx FIFO interrupt level
This parameter corresponds to bits 4–0 (TXFFIL4-0) of the
I2C Transmit FIFO Register (I2CFFTX).
9-75
Target Preferences
Enable Rx interrupt
This parameter corresponds to bit 5 (RXFFIENA) of the I2C
Receive FIFO Register (I2CFFRX).
Rx FIFO interrupt level
This parameter corresponds to bit 4–0 (RXFFIL4-0) of the
I2C Receive FIFO Register (I2CFFRX).
Enable system interrupt
Select this parameter to display and individually configure the following five Basic I2C Interrupt Request parameters in the Interrupt Enable Register (I2CIER):
• Enable AAS interrupt
• Enable SCD interrupt
• Enable ARDY interrupt
• Enable NACK interrupt
• Enable AL interrupt
Enable AAS interrupt
Enable the addressed-as-slave interrupt.
When enabled, the I2C module generates an interrupt (AAS bit = 1) upon receiving one of the following:
• Its Own address register
• A general call (all zeros)
• A data byte is in free data format
When enabled, the I2C module clears the interrupt (AAS =
0) upon receiving one of the following:
• Multiple START conditions (7-bit addressing mode only)
• A slave address that is different from Own address
register (10-bit addressing mode only)
• A NACK or a STOP condition
9-76
Target Preferences
This parameter corresponds to bit 6 (AAS) of the Interrupt
Enable Register (I2CIER).
Enable SCD interrupt
Enable stop condition detected interrupt.
When enabled, the I2C module generates an interrupt (SCD bit = 1) when the CPU detects a stop condition on the I2C bus.
When enabled, the I2C module clears the interrupt (SCD =
0) upon one of the following events:
• The CPU reads the I2CISRC while it indicates a stop condition
• A reset of the I2C module
• Someone manually clears the interrupt
This parameter corresponds to bit 5 (SCD) of the Interrupt
Enable Register (I2CIER).
Enable ARDY interrupt
Enable register-access-ready interrupt enable bit.
When enabled, the I2C module generates an interrupt
(ARDY bit = 1) when the previous address, data, and command values in the I2C module registers have been used and new values can be written to the I2C module registers.
This parameter corresponds to bit 2 (ARDY) of the Interrupt
Enable Register (I2CIER).
Enable NACK interrupt
Enable no-acknowledgment interrupt enable bit.
When enabled, the I2C module generates an interrupt
(NACK bit = 1) when the module is a transmitter in master or slave mode and it receives a NACK condition.
9-77
Target Preferences
This parameter corresponds to bit 1 (NACK) of the Interrupt
Enable Register (I2CIER).
Enable AL interrupt
Enable arbitration-lost interrupt.
When enabled, the I2C module generates an interrupt (AL bit = 1) when the I2C module is operating as a master transmitter and looses an arbitration contest with another master transmitter.
This parameter corresponds to bit 0 (AL) of the Interrupt
Enable Register (I2CIER).
SCI_A
The serial communications interface parameters you can set for module A. These parameters are:
Baud rate
Baud rate for transmitting and receiving data. Select from
115200
1200
(the default),
57600
,
38400
,
19200
,
9600
,
4800
,
2400
,
,
300
, and
110
.
Blocking Mode
If this option is set to True, system waits until data is available to read (when data length is reached). If this option is set to False, system checks FIFO periodically (in polling mode) to see if there is any data to read. If data is present, it reads and outputs the contents. If no data is present, it outputs the last value and continues.
Character length bits
Length in bits of each transmitted or received character, set to 8 bits.
Communication mode
Select
Raw_data or
Protocol mode. Raw data is unformatted and sent whenever the transmitting side is ready to send, whether the receiving side is ready or not.
9-78
Target Preferences
No deadlock condition can occur because there is no wait state. Data transmission is asynchronous. With this mode, it is possible the receiving side could miss data, but if the data is noncritical, using raw data mode can avoid blocking any processes.
When you select protocol mode, some handshaking between host and processor occurs. The transmitting side sends
$SND to indicate it is ready to transmit. The receiving side sends back $RDY to indicate it is ready to receive.
The transmitting side then sends data and, when the transmission is completed, it sends a checksum.
Advantages to using protocol mode include:
• Avoids deadlock
• Ensures that data is received correctly (checksum)
• Ensures that data is actually received by processor
• Ensures time consistency; each side waits for its turn to send or receive
Note Deadlocks can occur if one SCI Transmit block tries to communicate with more than one SCI Receive block on different COM ports when both are blocking (using protocol mode). Deadlocks cannot occur on the same COM port.
Data byte order
Select
Little Endian or
Big Endian
.
Data swap width
Select
8-bits or
16-bits
.
Enable Loopback
Select this parameter to enable the loopback function for self-test and diagnostic purposes only. When this function
9-79
Target Preferences is enabled, a C28x DSP’s Tx pin is internally connected to its Rx pin and can transmit data from its output port to its input port to check the integrity of the transmission.
Number of stop bits
Select whether to use
1 or
2 stop bits.
Parity mode
Type of parity to use. Available selections are
None
,
Odd parity, or
Even parity.
None disables parity.
Odd sets the parity bit to one if you have an odd number of ones in your bytes, such as 00110010.
Even sets the parity bit to one if you have an even number of ones in your bytes, such as
00110011.
Suspension mode
Type of suspension to use when debugging your program with Code Composer Studio. When your program encounters a breakpoint, the suspension mode determines whether to perform the program instruction. Available options are
Hard_abort
,
Soft_abort
, and
Free_run
.
Hard_abort stops the program immediately.
Soft_abort stops when the current receive/transmit sequence is complete.
Free_run continues running regardless of the breakpoint.
SCI_B
The serial communications interface parameters you can set for module B. These parameters are:
Baud rate
Baud rate for transmitting and receiving data. Select from
115200
(the default),
57600
,
38400
,
19200
,
9600
,
4800
,
2400
,
1200
,
300
, and
110
.
Blocking mode
When you set this option to
True
, the system waits until data is available to read (when data length is reached).
If this option is set to
False
, the system checks the FIFO periodically (in polling mode) to see if there is any data to
9-80
Target Preferences read. If data is present, it reads and outputs the contents.
If no data is present, the system outputs the last value and continues.
Character length bits
Length in bits of each transmitted/received character, set to 8 bits.
Communication mode
Select
Raw_data or
Protocol mode. Raw data is unformatted and sent whenever the transmitting side is ready to send, whether the receiving side is ready or not.
No deadlock condition can occur because there is no wait state. Data transmission is asynchronous. With this mode, it is possible the receiving side could miss data, but if the data is noncritical, using raw data mode can avoid blocking any processes.
When you specify protocol mode, some handshaking between host and processor occurs. The transmitting side sends $SND to indicate that it is ready to transmit. The receiving side sends back $RDY to indicate that it is ready to receive. The transmitting side then sends data and, when the transmission is completed, it sends a checksum.
Advantages to using protocol mode include:
• Avoids deadlock
• Ensures that data is received correctly (checksum)
• Ensures that data is actually received by processor
• Ensures time consistency; each side waits for its turn to send or receive
9-81
Target Preferences
Note Deadlocks can occur if one SCI Transmit block tries to communicate with more than one SCI Receive block on different COM ports when both are blocking (using protocol mode). Deadlocks cannot occur on the same COM port.
Data byte order
Select
Little Endian or
Big Endian
.
Data swap width
Select
8-bits or
16-bits
.
Enable Loopback
Select this to enable the loopback function for self-test and diagnostic purposes only. When this function is enabled, the
Tx pin on a C28x DSP is internally connected to its Rx pin and can transmit data from its output port to its input port to check the integrity of the transmission.
Number of stop bits
Select whether to use
1 or
2 stop bits.
Parity mode
Type of parity to use. Available selections are
None
,
Odd parity, or
Even parity.
None disables parity.
Odd sets the parity bit to one if you have an odd number of ones in your bytes, such as 00110010.
Even sets the parity bit to one if you have an even number of ones in your bytes, such as
00110011.
Rx pin assignment
Assigns the SCI receive something to a GPIO pin. Choices are
None
(default),
GPI011
,
GPI015
,
GPI019
, or
GPI023
.
Tx pin assignment
Assigns the SCI transmit something to a GPIO pin. Choices are
None
(default),
GPI09
,
GPI014
,
GPI018
, or
GPI022
.
9-82
Target Preferences
Suspension mode
Type of suspension to use when debugging your program with Code Composer Studio. When your program encounters a breakpoint, the selected suspension mode determines whether to perform the program instruction. Available options are
Hard_abort
,
Soft_abort
, and
Free_run
.
Hard_abort stops the program immediately.
Soft_abort stops when the current receive or transmit sequence is complete.
Free_run continues running regardless of the breakpoint.
SPI_A
The serial peripheral interface parameters you can set for the A module. These parameters are:
Baud rate factor
To set the Baud rate factor, search for “Baud Rate
Determination” and “SPI Baud Rate Register (SPIBRR) Bit
Descriptions” in TMS320x28xx, 28xxx DSP Serial Peripheral
Interface (SPI) Reference Guide, Literature Number:
SPRU059, available on the Texas Instruments Web Site.
Clock phase
Select
No_delay or
Delay_half_cycle
.
Clock polarity
Select
Rising_edge or
Falling_edge
.
Data bits
Length in bits from
1 to
16 of each transmitted or received character. For example, if you select
8
, the maximum data that can be transmitted using SPI is
2 8-1
. If you send data greater than this value, the buffer overflows.
Enable Loopback
Select this option to enable the loopback function for self-test and diagnostic purposes only. When this function is enabled, the Tx pin on a C28x DSP is internally connected
9-83
Target Preferences to its Rx pin and can transmit data from its output port to its input port to check the integrity of the transmission.
Enable FIFO
Set true or false.
FIFO interrupt level (Rx)
Set level for receive FIFO interrupt. Select
0 through
16
.
FIFO interrupt level (Tx)
Set level for transmit FIFO interrupt. Select
0 through
16
.
FIFO transmit delay
Enter FIFO transmit delay (in processor clock cycles) to pause between data transmissions. Enter an integer.
Mode
Set to
Master or
Slave
.
Suspension mode
Type of suspension to use when debugging your program with Code Composer Studio. When your program encounters a breakpoint, the selected suspension mode determines whether to perform the program instruction. Available options are
Hard_abort
,
Soft_abort
, and
Free_run
.
Hard_abort stops the program immediately.
Soft_abort stops when the current receive or transmit sequence is complete.
Free_run continues running regardless of the breakpoint.
SPI_B
The serial peripheral interface parameters you can set for the B module. These parameters are:
Baud rate factor
To set the Baud rate factor, search for “Baud Rate
Determination” and “SPI Baud Rate Register (SPIBRR) Bit
Descriptions” in TMS320x28xx, 28xxx DSP Serial Peripheral
Interface (SPI) Reference Guide, Literature Number:
SPRU059, available on the Texas Instruments Web Site.
9-84
Target Preferences
Clock phase
Select
No_delay or
Delay_half_cycle
.
Clock polarity
Select
Rising_edge or
Falling_edge
.
Data bits
Length in bits from
1 to
16 of each transmitted or received character. For example, if you select
8
, the maximum data that can be transmitted using SPI is
2 8-1
. If you send data greater than this value, the buffer overflows.
Enable Loopback
Select this option to enable the loopback function for self-test and diagnostic purposes only. When this function is enabled, the Tx pin on a C28x DSP is internally connected to its Rx pin and can transmit data from its output port to its input port to check the integrity of the transmission.
Enable FIFO
Set true or false.
FIFO interrupt level (Rx)
Set level for receive FIFO interrupt. Select
0 through
16
.
FIFO interrupt level (Tx)
Set level for transmit FIFO interrupt. Select
0 through
16
.
FIFO transmit delay
Enter FIFO transmit delay (in processor clock cycles) to pause between data transmissions. Enter an integer.
Mode
Set to
Master or
Slave
.
CLK pin assignment
Assigns the SPI something (CLK) to a GPIO pin. Choices are
None
(default),
GPI014
, or
GPI026
.
SIMO pin assignment
Assigns the SPI something (SIMO) to a GPIO pin. Choices are
None
(default),
GPI012
, or
GPI024
.
9-85
Target Preferences
SOMI pin assignment
Assigns the SPI something (SOMI) to a GPIO pin. Choices are
None
(default),
GPI013
, or
GPI025
.
STE pin assignment
Assigns the SPI something (STE) to a GPIO pin. Choices are
None
(default),
GPI015
, or
GPI027
.
Suspension Mode
Type of suspension to use when debugging your program with Code Composer Studio. When your program encounters a breakpoint, the selected suspension mode determines whether to perform the program instruction. Available options are
Hard_abort
,
Soft_abort
, and
Free_run
.
Hard_abort stops the program immediately.
Soft_abort stops when the current receive or transmit sequence is complete.
Free_run continues running regardless of the breakpoint.
SPI_C
Parameters for the
SPI_C module include all the parameters for the
SPI_A module.
SPI_D
Parameters for the
SPI_D module include all the parameters for the
SPI_A module.
eQEP
Assigns eQEP pins to GPIO pins if required.
EQEP1A pin assignment
Select an option from the list—
GPIO20 or
GPIO50
.
EQEP1B pin assignment
Select an option from the list—
GPIO21 or
GPIO51
.
EQEP1S pin assignment
Select an option from the list—
GPIO22 or
GPIO52
.
9-86
Target Preferences
EQEP1I pin assignment
Select an option from the list—
GPIO23 or
GPIO53
.
Watchdog
When enabled, the watchdog resets the processor or generates an interrupt if the software fails to reset the watchdog counter within a specified interval. This feature enables the processor to automatically recover from some fault conditions.
For more information, locate the Data Manual or System Control
and Interrupts Reference Guide for your processor on the Texas
Instruments Web site.
Enable watchdog
Enable the watchdog timer module.
This parameter corresponds to bit 6 (WDDIS) of the Watchdog Control Register (WDCR) and bit 0
(WDOVERRIDE) of the System Control and Status Register
(SCSR).
Counter clock
Set the watchdog timer period relative to OSCCLK/512.
This parameter corresponds to bits 2–0 (WDPS) of the
Watchdog Control Register (WDCR).
Timer period in seconds
This field displays the timer period in seconds. This value automatically updates when you change the Counter clock parameter.
Time out event
Configure the watchdog to reset the processor or generate an interrupt when the software fails to reset the watchdog counter:
9-87
Target Preferences
• Select Chip reset to generate a signal that resets the processor (WDRST signal) and disable the watchdog interrupt signal (WDINT signal).
• Select Raise WD Interrupt to generate a watchdog interrupt signal (WDINT signal) and disable the reset processor signal (WDRST signal). This signal can be used to wake the device from an IDLE or STANDBY low-power mode.
This parameter corresponds to bit 1 (WDENINT) of the
System Control and Status Register (SCSR).
GPIO[pin#]
Each pin selected for input offers three signal qualification types:
• Sync to SYSCLKOUT
— This setting is the default for all pins at reset. Using this qualification type, the input signal is synchronized to the system clock SYSCLKOUT. The following figure shows the input signal measured on each tick of the system clock, and the resulting output from the qualifier.
•
Qualification using 3 samples
— This setting requires three consecutive cycles of the same value for the output value to change. The following figure shows that, in the third cycle, the GPIO value changes to
0
, but the qualifier output is still
1 because it waits for three consecutive cycles of the same GPIO value. The next three cycles all have a value of
0
, and the
9-88
Target Preferences output from the qualifier changes to
0 immediately after the third consecutive value is received.
• Qualification using 6 samples
— This setting requires six consecutive cycles of the same GPIO input value for the output from the qualifier to change. In the following figure, the glitch
A has no effect on the output signal. When the glitch occurs, the counting begins, but the next measurement is low again, so the count is ignored. The output signal does not change until six consecutive samples of the high signal are measured.
Qualification sampling period prescaler
Visible only when an appropriate setting for Qualification
type for GPIO [pin#] is selected. The qualification sampling period prescaler, with possible values of
0 to
255
, calculates the frequency of the qualification samples or the number of system clock ticks per sample. The formula for calculating the qualification sampling frequency is:
9-89
Target Preferences
SYSCLKOUT
2 * Pr
escaler
with the exception of zero. When Qualification sampling period prescaler
=0
, a sample is taken every SYSCLKOUT clock tick. For example, a prescale setting of
0 means that a sample is taken on each SYSCLKOUT tick.
The following figure shows the SYSCLKOUT ticks, a sample taken every clock tick, and the Qualification type set to
Qualification using 3 samples
. In this case, the
Qualification sampling period prescaler
=0
:
In the next figure Qualification sampling period prescaler
=1
. A sample is taken every two clock ticks, and the Qualification type is set to
Qualification using 3 samples
. The output signal changes much later than if
Qualification sampling period prescaler
=0
.
In the following figure, Qualification sampling period prescaler
=2
. Thus , a sample is taken every four clock ticks, and the Qualification type is set to
Qualification using 3 samples
.
9-90
Target Preferences
Flash_loader
You can use Flash_loader to:
• Automatically program generated code to flash memory on the target when you build the code.
• Manually erase, program, or verify specific flash memory sectors.
To use this feature, you must first download and install the appropriate TI Flash API plug-in from the TI Web site.
For more information, consult the “Programming Flash
Memory”topic in the Target Support Package TC2 User’s Guide or the *_API_Readme.pdf file included in the TI Flash API downloadable zip file.
Enable Flash Programmer
Enable the flash programmer by selecting a task for it to perform when you click Execute or build the software. To automatically program the flash memory when you build the software, select
Erase, Program, Verify
.
Detect Flash sectors to erase from COFF file
When enabled, the flash programmer erases all of the flash sectors defined by the COFF file.
Erase Sector Selection
When Detect Flash sectors to erase from COFF file is disabled, the selected flash sectors will be erased.
9-91
Target Preferences
Specify API location
Specify the directory path of the TI flash API executable you downloaded and installed on your computer.
Execute
Click this button to initiate the task selected in Enable
Flash Programmer.
DMA_ch[#]
The Direct Memory Access module transfers data directly between peripherals and memory using a dedicated bus, bypassing the
CPU and increasing overall system performance.
You can individually enable and configure each DMA channel.
The DMA module services are event driven. Using the Interrupt
source and External pin (GPIO) parameters, you can configure a wide range of peripheral interrupt event triggers.
To use DMA with the C280x/C28x3x ADC block, open the ADC block, enable Use DMA (with C28x3x), and select a DMA channel number. To avoid error messages, open the Target
Preferences block > Peripherals and disable the same DMA channel number.
For more information, consult the TMS320x2833x, 2823x Direct
Memory Access (DMA) Module Reference Guide, Literature
Number: SPRUFB8A, and the Increasing Data Throughput using
the TMS320F2833x DSC DMA training presentation (requires login), both available from the TI Web site.
Enable DMA channel
Enable this parameter to edit the configuration of a specific
DMA channel.
9-92
Target Preferences
If your model includes an C280x/C28x3x ADC block with the
Use DMA (with C28x3x) parameter enabled, disable the same DMA channel here in the Target preferences block.
This parameter has no corresponding bit or register.
Data size
Select the size of the data bit transfer:
16 bit or
32 bit
.
The DMA read/write data buses are 32 bits wide. 32-bit transfers have approximately twice the data throughput of a 16-bit transfer.
When providing DMA service to McBSP, set Data size to
16 bit
.
The following parameters are based on a 16-bit word size.
If you set Data size to
32 bit
, double the value of the following parameters:
• Size: Burst
• Source: Burst step
• Source: Transfer step
• Source: Wrap step
• Destination: Burst step
• Destination: Transfer step
• Destination: Wrap step
Data size corresponds to bit 14 (DATASIZE) in the Mode
Register (MODE).
Note When you select Use DMA (with C28x3x) in the
C280x/C28x3x ADC block, this parameter is
16 bit
.
9-93
Target Preferences
Interrupt source
Select the peripheral interrupt that triggers a DMA burst for the specified channel.
Selecting SEQ1INT or SEQ2INT generates a message:
“Use ADC block to implement the DMA function.” To do so, open the C280x/C28x3x ADC block, select the Use DMA
(with C28x3x) parameter, select a DMA channel, and disable the same DMA channel in the Target Preferences block. Currently, when you use the ADC block to implement
DMA, the corresponding DMA channel settings are not configurable in the Target Preferences block.
Select XINT1, XINT2, or XINT13 to configure GPIO pin 0 to
31 as an external interrupt source. Select XINT3 to XINT7 to configure GPIO pin 32 to 63 as an external interrupt source. For more information about configuring XINT, consult the following references:
• TMS320x2833x, 2823x External Interface (XINTF) User’s
Guide, Literature Number: SPRU949, available on the
TI Web site.
• TMS320x2833x System Control and Interrupts, Literature
Number: SPRUFB0, available on the TI Web site.
• The C280x/C28x3x GPIO Digital Inputand C280x/C28x3x
GPIO Digital Output block reference sections in the
Target Support Package TC2 User’s Guide.
Currently, Interrupt source does not support items TINT0 through MREVTB in the drop-down menu.
The Interrupt source parameter corresponds to bit 4-0
(PERINTSEL) in the Mode Register (MODE).
9-94
Target Preferences
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block:
• If the ADC block Module is A or
A and B
, Interrupt
source is
SEQ1INT
.
• If the ADC block Module is B
, Interrupt source is
SEQ2INT
.
External pin(GPIO)
When Interrupt source is set to an external interface
(XINT[#]), specify the GPIO pin number from which the interrupt originates.
This parameter corresponds to the GPIO XINTn, XNMI
Interrupt Select (GPIOXINTnSEL, GPIOXNMISEL)
Registers. For more information, consult the TMS320x2833x
System Control and Interrupts Reference Guide, Literature
Number SPRUFB0, available from the TI Web site.
Generate interrupt
Enable this parameter to have the DMA channel send an interrupt to the CPU via the PIE at the beginning or end of a data transfer.
This parameter corresponds to bit 15 (CHINTE) and bit 9
(CHINTMODE) in the Mode Register (MODE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the DMA channel generates an interrupt at the end of the data transfer.
Size
• Burst
9-95
Target Preferences
Specify the number of 16-bit words in a burst, from 1 to
32. The DMA module must complete a burst before it can service the next channel.
Set the Burst value appropriately for the peripheral the
DMA module is servicing. For the ADC, the value equals the number of ADC registers being used, up to 16. For multichannel buffered serial ports (McBSP), which lack
FIFOs, the value is 1. For RAM, the value can range from 1 to 32.
This parameter corresponds to bits 4-0 (BURSTSIZE) in the Burst Size Register (BURST_SIZE).
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value assigned to Burst equals the ADC block Number of conversions (NOC) multiplied by a value for the ADC block Conversion
mode (CVM). Burst = NOC * CVM
If Conversion mode is
Sequential
, CVM = 1. If
Conversion mode is
Simultaneous
, CVM = 2.
For example, Burst = 6 if NOC = 3 and CVM = 2 (6 = 3
* 2).
For more information, see C280x/C28x3x ADC.
• Transfer
9-96
Target Preferences
Specify the number of bursts in a transfer, from 1 to
65536.
This parameter corresponds to bits 15-0
(TRANSFERSIZE) in the Transfer Size Register
(TRANSFER_SIZE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 1.
• SRC wrap
Specify the number of bursts before returning the current source address pointer to the Source Begin Address value. To disable wrapping, enter a value for SRC wrap that is greater than the Transfer value.
This parameter corresponds to bits 15-0
(SRC_WRAP_SIZE) in the Source Wrap Size
Register (SRC_WRAP_SIZE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 65536.
• DST wrap
Specify the number of bursts before returning the current destination address pointer to the Destination Begin
Address value. To disable wrapping, enter a value for
DST wrap that is greater than the Transfer value.
9-97
Target Preferences
This parameter corresponds to bits 15-0
(DST_WRAP_SIZE) in the Destination Wrap
Size Register (DST_WRAP_SIZE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 65536.
Source
The following parameters configure the DMA channel inputs.
• Begin address
Set the starting address for the current source address pointer. The DMA module points to this address at the beginning of a transfer and returns to it as specified by the SRC wrap parameter.
This parameter corresponds to bits 21-0 (BEGADDR) in the Active Source Begin Register (SRC_BEG_ADDR).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of the source Begin
address is:
— 0xB00 if the ADC block Module is A or
A and B
(Interrupt source is
SEQ1INT
).
— 0xB08 If the ADC block Module is B
(Interrupt
source is
SEQ2INT
).
• Burst step
Set the number of 16-bit words by which to increment or decrement the current address pointer before the next
9-98
Target Preferences burst. Enter a value from –4096 (decrement) to 4095
(increment).
To disable incrementing or decrementing the address pointer, set Burst step to 0. For example, because
McBSP does not use FIFO, you must configure DMA to maintain the correct sequence of the McBSP data by moving each word of the data individually. Accordingly, when you use DMA to transmit or receive McBSP data, set Burst size to 1 word and Burst step to 0.
This parameter corresponds to bits 15-0
(SRCBURSTSTEP) in the Source Burst Step
Size Register (SRC_BURST_STEP).
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is 1.
• Transfer step
Set the number of 16-bit words by which to increment or decrement the current address pointer before the next transfer. Enter a value from –4096 (decrement) to 4095
(increment).
To disable incrementing or decrementing the address pointer, set Transfer step to 0.
This parameter corresponds to bits 15-0
(SRCTRANSFERSTEP) Source Transfer Step
Size Register (SRC_TRANSFER_STEP).
9-99
Target Preferences
If DMA is configured to perform memory wrapping
(if SRC wrap is enabled) the corresponding source
Transfer step has no effect.
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 0.
• Wrap step
Set the number of 16-bit words by which to increment or decrement the SRC_BEG_ADDR address pointer when a wrap event occurs. Enter a value from –4096 (decrement) to 4095 (increment).
This parameter corresponds to bits 15-0 (WRAPSTEP) in the Source Wrap Step Size Registers (SRC_WRAP_STEP).
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 0.
9-100
Target Preferences
Destination
The following parameters configure the DMA channel outputs.
• Begin address
Set the starting address for the current destination address pointer. The DMA module points to this address at the beginning of a transfer and returns to it as specified by the DST wrap parameter.
This parameter corresponds to bits 21-0 (BEGADDR) in the Active Destination Begin Register (DST_BEG_ADDR).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of the destination
Begin address (dstAdd) is the ADC buffer address
(ADCbufadr) minus the Number of conversions (NoC) in the ADC block. In other words, dstAdd = ADCbufadr
– NoC.
— If the target is F28232 or F28332, ADCbufadr = 57340
(0xDFFC)
— Otherwise, ADCbufadr = 65532 (0xFFFC)
For example, when you enable Use DMA (with
C28x3x) for a F28232 target, the DMA module sets the destination Begin address to 0xDFF9 (57337) because the ADCbufadr 57340 (0xDFFC) minus 3 conversions equals 57337 (0xDFF9).
• Burst step
Set the number of 16-bit words by which to increment or decrement the current address pointer before the next burst. Enter a value from –4096 (decrement) to 4095
(increment).
9-101
Target Preferences
To disable incrementing or decrementing the address pointer, set Burst step to 0. For example, because
McBSP does not use FIFO, you must configure DMA to maintain the correct sequence of the McBSP data by moving each word of the data individually. Accordingly, when you use DMA to transmit or receive McBSP data, set Burst size to 1 word and Burst step to 0.
This parameter corresponds to bits 15-0
(DSTBURSTSTEP) in the Destination Burst
Step Size Register (DST_BURST_STEP).
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is 1.
• Transfer step
Set the number of 16-bit words by which to increment or decrement the current address pointer before the next transfer. Enter a value from –4096 (decrement) to 4095
(increment).
To disable incrementing or decrementing the address pointer, set Transfer step to 0.
This parameter corresponds to bits 15-0
(DSTTRANSFERSTEP) Destination Transfer
Step Size Register (DST_TRANSFER_STEP).
9-102
Target Preferences
If DMA is configured to perform memory wrapping (if
DST wrap is enabled) the corresponding destination
Transfer step has no effect.
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this destination parameter is 1.
• Wrap step
Set the number of 16-bit words by which to increment or decrement the DST_BEG_ADDR address pointer when a wrap event occurs. Enter a value from –4096 (decrement) to 4095 (increment).
This parameter corresponds to bits 15-0 (WRAPSTEP) in the Destination Wrap Step Size Registers
(DST_WRAP_STEP).
Note This parameter is based on a 16-bit word size. If you set Data size to
32 bit
, double the value of this parameter.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, the value of this parameter is 0.
9-103
Target Preferences
Mode
The following parameters configure the DMA channel.
• Enable one shot mode
Enable this parameter to have the DMA channel complete an entire transfer in response to an interrupt event trigger. This option allows a single DMA channel and peripheral to dominate resources, and may streamline processing, but it also creates the potential for resource conflicts and delays.
Disable this parameter to have DMA complete one burst per channel per interrupt.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is disabled.
• Sync enable
When Interrupt source is set to SEQ1INT, enable this parameter to reset the DMA wrap counter when it receives the ADCSYNC signal from SEQ1INT. This ensures that the wrap counter and the ADC channels remain synchronized with each other.
If Interrupt source is not set to SEQ1INT, Sync
enable has no effect.
This parameter corresponds to bit 12 (SYNCE) of the
Mode Register (MODE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is disabled.
• Enable continuous mode
9-104
Target Preferences
Select this parameter to leave the DMA channel enabled upon completing a transfer. The channel will wait for the next interrupt event trigger.
Clear this parameter to disable the DMA channel upon completing a transfer. The DMA module disables the DMA channel by clearing the RUNSTS bit in the
CONTROL register when it completes the transfer. To use the channel again, first reset the RUN bit in the
CONTROL register.
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is enabled.
• Enable DST sync mode
When Sync enable is enabled, enabling this parameter resets the destination wrap counter
(DST_WRAP_COUNT) when the DMA module receives the SEQ1INT interrupt/ADCSYNC signal. Disabling this parameter resets the source wrap counter
(SCR_WRAP_COUNT) when the DMA module receives the SEQ1INT interrupt/ADCSYNC signal.
This parameter is associated with bit 13 (SYNCSEL) in the Mode Register (MODE).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is disabled.
• Set channel 1 to highest priority.
Enable this setting when DMA channel 1 is configured to handle high-bandwidth data, such as ADC data,
9-105
Target Preferences and the other DMA channels are configured to handle lower-priority data.
When enabled, the DMA module services each enabled channel sequentially until it receives a trigger from channel 1. Upon receiving the trigger, DMA interrupts its service to the current channel at the end of the current word, services the channel 1 burst that generated the trigger, and then continues servicing the current channel at the beginning of the next word.
Disable this channel to give each DMA channel equal priority, or if DMA channel 1 is the only enabled channel.
When disabled, the DMA module services each enabled channel sequentially.
This parameter corresponds to bit 0 (CH1PRIORITY) in the Priority Control Register 1 (PRIORITYCTRL1).
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is disabled.
• Enable overflow interrupt
Enable this parameter to have the DMA channel send an interrupt to the CPU via PIE if the DMA module receives a peripheral interrupt while a previous interrupt from the same peripheral is waiting to be serviced.
This parameter is typically used for debugging during the development phase of a project.
The Enable overflow interrupt parameter corresponds to bit 7 (OVRINTE) of the Mode Register (MODE), and involves the Overflow Flag Bit (OVRFLG) and Peripheral
Interrupt Trigger Flag Bit (PERINTFLG).
9-106
Target Preferences
Note When you select Use DMA (with C28x3x) the
C280x/C28x3x ADC block, this parameter is disabled.
New Processor Dialog Box
When you click Add new on the General pane, you open this new dialog box to add a new processor to the list of supported processors.
The first time you click Save to add a new processor definition to the list of supported processors, a dialog box opens that directs you to select a destination folder for the saved processor definitions file customChipInfo.dat
. You must select a directory to which you have write access. The location you specify becomes part of your MATLAB preferences. Future processors that you add become entries in the file customChipInfo.dat
.
To add a new processor, you must enter values for the following parameters:
• Name
Provide a name to identify your new processor. Any valid C string works here. The name you enter in this field appears on the list of processors after you add the new processor.
• Processor Class
Provide the class string that identifies your processor family, such as
62xx or
67xx
.
• CPU clock
Enter the clock speed of the processor on your processor in MHz.
When you enter a value, you are not setting the CPU clock rate on the processor. You are reporting the rate. If the value you enter does not match the rate on the processor, your model’s real-time results may be wrong, and code profiling results are not correct.
9-107
Target Preferences
Setting CPU clock to the actual board rate allows the code you generate to run correctly according to the actual clock rate of the hardware.
• Define internal memory banks (one or more memory banks in the processor memory)
Use the options to define the way the processor uses internal memory for code and data.
• Define default sections (one or more default sections)
Set values for the options to define the default sections in memory.
If you do not provide an entry for each of these parameters, Embedded
IDE Link CC returns an error message and does not create the new processor entry.
9-108
Target Preferences
9-109
Target Preferences
General
Name
Provide a name to identify your new processor. You can use any valid C string value in this field. The name you enter in this field appears on the list of processors after you add the new processor.
Processor Class
Identifies the class of the new processor. Your new processor must be a member of a family of processors that Embedded IDE Link
CC supports. For example, you can add a new C67xx processor because the product supports the C6700 processor family.
You cannot add a new processor class to support your new processor.
Generally, processors in a family share common design elements such as interrupt architecture and clock. They may have different memory maps. By selecting the processor class, you identify the common features of the processor family. The parameters in
Define internal memory banks and Define default sections enable you to specify the memory mapping for your new processor.
For example, to add a new C2811 processor, enter the string
28xx
.
The following table lists the processor class string for supported processor families.
Processor Family
C62xx
C64xx
C67xx
Processor Class String
62xx where xx designates the processor, such as C6203.
64xx where xx designates the processor, such as C6412. Use
645x for the TCI6482.
67xx where xx designates the processor, such as C6722.
9-110
Target Preferences
Processor Family
DM64x and DM64xx
C55xx
Processor Class String
64xx where xx designates the processor, such as DM6433 or
DM643.
55xx where xx designates the processor, such as C5502. For
C5503, C5507, and C5509 processors, use 55xx.
C28xx, F28xx, R28xx, F28xxx
28xx where xx designates the processor, such as C2812. For
F283xx processors, use
2833x
.
For F280xx processors, use
280x
.
CPU clock
Provide a name to identify your new processor. You can use any valid C string value in this field. The name you enter in this field appears on the list of processors after you add the new processor.
Enter the clock speed of the processor in MHz. When you enter a value, you are not setting the CPU clock rate on the processor.
You are reporting the rate. If the value you enter does not match the rate on the processor, your model’s real-time results may be wrong, and code profiling results are not correct.
Setting CPU clock to the actual board rate allows the generated code to run correctly according to the actual clock rate of the hardware.
Compiler switch
Identifies the processor family of the new processor to the compiler. Successful compilation requires this switch. The string depends on the processor family or class. For example, to set the compiler switch for a new C5509 processor, enter
-ml
. The following table shows the compiler switch string for supported processor families.
9-111
Target Preferences
Processor Family
C62xx
C64xx
C67xx
Compiler Switch String
None
None
DM64x and DM64xx
C55xx
None
None
-ml
C28xx, F28xx, R28xx, F28xxx
-ml
Code generation hook
This string specifies a prefix to add when the code generation process calls certain hook functions. The hook allows the code to call into handling functions that are specific to the processor selected. The following table shows the Code Generation hook string for supported processor families.
Processor Family Code Generation Hook
String
C62xx
C64xx
C67xx
DM64x and DM64xx
C6000
C6000
C6000
C6000
C55xx
C5000
C28xx, F28xx, R28xx, F28xxx
C2000
Here is an example of using the code generation hook when you begin to generate a project from a model intended for the
TMS320C6000 processor. At the start of the code generation process, the process calls
C6000_validateModelEntry.m
to validate the model settings for the processor. The
C6000 prefix is the code generation hook.
9-112
Target Preferences
Define internal memory banks (one or more memory banks)
Parameters in this group configure the memory map for the new processor.
Define default sections (one or more default sections)
Parameters in this group configure the default sections for your new processor.
Define internal memory banks
Name
To add a new physical memory segment to the internal memory banks list, click Add, replace the temporary label in Name with the one to use, and press Return. Your new segment appears on the list.
After you add the segment, you can configure the starting address, length, and contents for the new segment. New segments start with code and data as the type of content that can be stored in the segment (refer to the Contents option).
Names are case sensitive.
NewSegment is not the same as newsegment or newSegment
.
Address
Address reports the starting address for the memory segment showing in Name. Address entries are in hexadecimal format and limited only by the board or processor memory.
When you are using a processor-specific preferences block, the starting address shown is the default value. You can czerose the starting value by entering the new value directly in Address when you select the memory segment to change.
Length
From the starting address, Length sets the length of the memory allocated to the segment in Name. As in all memory entries, specify the length in hexadecimal format, in minimum
9-113
Target Preferences addressable data units (MADUs). For the C6000 processor family, for example, the MADU is 8 bytes, one word.
Contents
Contents details the kind of program sections that you can store in the memory segment in Name. As the processor type for the
Target Preferences block changes, the kinds of information you store in listed memory segments may change. Generally, the
Contents list contains these strings:
• Code
— Allow code to be stored in the memory segment in
Name.
• Data
— Allow data to be stored in the memory segment in
Name.
• Code and Data
— Allow code and data to be stored in the memory segment in Name. When you add a new memory segment, this setting is the default for the contents of the new element.
You may add or use as many segments of each type as you need, within the limits of the memory on your processor.
Add
Click Add to add a new memory segment to the processor memory map. When you click Add, a new segment name appears, for example
NEWMEM1
, in Name and on the list. In Name, change the temporary name
NEWMEM1 by entering the new segment name.
Entering the new name, or clicking OK updates the temporary name on the list to the name you enter.
Remove
This option lets you remove a memory segment from the memory map. Select the segment to remove from the list, and click
Remove to delete the segment.
9-114
Target Preferences
Define cache configuration
Options
Enter the label for each option of the selected cache configuration, one label on each line, such as 0kb, 16kb, 32kb and so on.
Add
Click Add to add a new cache configuration to the list. When you click Add, the new cache label appears on the list.
Remove
This option lets you remove a cache configuration from the cache list. Select the configuration to remove from the list, and click
Remove to delete the cache.
Cache configurations and related options are defined as symbols to the project generator component. Cache options for new processors are not labeled until you add the labels.
Label
Enter your label for the heap in the Label option. Entering the label updates the label of the selected configuration.
Define Default Sections
Options in this region let you specify where various program sections should go in memory and the contents and label for each section. You can add text to describe each section. Program sections are distinct from memory segments—sections are portions of the executable code stored in contiguous memory locations. Commonly used sections include .
text
,
.
bss
, .
data
, and .
stack
. Some sections relate to the compiler, some to
DSP/BIOS, and some can be custom sections as you require.
Label
The name of the section corresponds to the symbolic name recognized by the linker program used with the respective processor.
Contents
Contents provides the information about the native of the program section. As the processor type for the Target Preferences
9-115
Target Preferences block changes, the kinds of information you store in listed sections may change. Generally, the Contents list contains these strings:
• Code
— Allow code to be stored in the section in Name.
• Data
— Allow data to be stored in the section in Name.
• Code and Data
— Allow code and data to be stored in the section in Name. When you add a new section, this setting is the default for the contents.
You may add or use as many sections of each type as you need, within the limits of the memory on your processor.
Add
Click Add to add a new section to the list. When you click Add, the new section appears on the list.
Remove
This option lets you remove a section from the section list. Select the section to remove from the list, and click Remove to delete the section.
Sections and related options are defined as symbols to the project generator component. Section options for new processors are not labeled until you add the labels.
Processor Custom Code
The list on the left side of the pane shows the kinds of custom code you can specify for your processor. Each time you use your custom processor as defined in this dialog box, the custom code you enter here applies.
You can enter custom code in the categories in the following table.
Custom Code Entry Description
Source files
Enter the full paths to source code files to use with this processor. By default there are no entries in this parameter. Enter each source file on a new line.
9-116
Target Preferences
Custom Code Entry Description
Include paths If you require additional header files on your path, add them by typing the path into the text area, one file per line. The default setting does not include additional paths.
Libraries (Little
Endian)
Libraries (Big
Endian)
Preprocessor symbols
These entries identify specific little endian libraries that the processor requires. Add more as you require by entering the full path to the library with the library file in the text area. Enter one library per line. No additional libraries appear in the default configuration.
These entries identify specific big endian libraries that the processor requires. Add more as you require by entering the full path to the library with the library file in the text area. No additional libraries appear in the default configuration. Enter one library per line.
Enter any preprocessor symbols that the new processor requires for operation and compilation. No preprocessor symbols appear in the default configuration. Add the required symbols one symbol per line.
You can use two types of tokens when you specify custom code paths:
• $(Install_dir)
— Refers to the installation directory of Code
Composer Studio. One example of this token is
$(Install_dir) \c6000\csl\lib\csl6201.lib
• $(MATLAB_ROOT)
— Refers to the directory where you installed
MATLAB.
9-117
Target Preferences
9-118
Embedded IDE Link CC
Configuration Parameters
10
10
Embedded IDE Link™ CC Configuration Parameters
Embedded IDE Link CC Pane
10-2
In this section...
“Embedded IDE Link CC Overview” on page 10-4
“Export IDE link handle to base workspace” on page 10-5
“IDE link handle name” on page 10-7
“Profile real-time execution” on page 10-8
“Number of profiling samples to collect” on page 10-12
“Inline run-time library functions” on page 10-14
“Project options” on page 10-16
“Compiler options string” on page 10-18
“Linker options string” on page 10-20
Embedded IDE Link CC Pane
In this section...
“System stack size (MAUs)” on page 10-22
“Interrupt overrun notification method” on page 10-26
“Interrupt overrun notification function” on page 10-28
“PIL block action” on page 10-29
“Maximum time allowed to build project (s)” on page 10-31
“Maximum time to complete IDE operations (s)” on page 10-33
“Source file replacement” on page 10-35
10-3
10
Embedded IDE Link™ CC Configuration Parameters
Embedded IDE Link CC Overview
Options on this pane configure the generated projects and code for Texas
Instruments processors. They also enable PIL block generation and provide real-time task execution and stack use profiling.
10-4
Embedded IDE Link CC Pane
Export IDE link handle to base workspace
Directs the software to export the ticcs object to your MATLAB workspace.
Settings
Default: On
On
Directs the build process to export the ticcs object created to your
MATLAB workspace. The new object appears in the workspace browser.
Selecting this option enables the IDE link handle name option.
Off prevents the build process from exporting the ticcs object to your
MATLAB software workspace.
Dependency
This parameter enables IDE link handle name.
Command-Line Information
Parameter: exportIDEObj
Type: string
Value:
'on'
|
'off'
Default:
'on'
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
On
On
No impact
No impact
10-5
10
Embedded IDE Link™ CC Configuration Parameters
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-6
Embedded IDE Link CC Pane
IDE link handle name
specifies the name of the ticcs object that the build process creates.
Settings
Default:
CCS_Obj
• Enter any valid C variable name, without spaces.
• The name you use here appears in the MATLAB workspace browser to identify the ticcs object.
• The handle name is case sensitive.
Dependency
This parameter is enabled by Export IDE link handle to base workspace.
Command-Line Information
Parameter: ideObjName
Type: string
Value:
Default:
CCS_Obj
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Enter any valid C program variable name, without spaces
No impact
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-7
10
Embedded IDE Link™ CC Configuration Parameters
Profile real-time execution
enables real-time execution profiling in the generated code by adding instrumentation for task functions or atomic subsystems.
Settings
Default: Off
On
Adds instrumentation to the generated code to support execution profiling and generate the profiling report.
Off
Does not instrument the generated code to produce the profile report.
Dependencies
This parameter adds Number of profiling samples to collect and Profile
by.
Selecting this parameter disables Export ID link handle to base
workspace.
Setting Build action to
Archive_library or
Create_processor_in_the_loop project removes this parameter.
Command-Line Information
Parameter:
ProfileGenCode
Type: string
Value:
'on'
|
'off'
Default:
'off'
Recommended Settings
Application
Debugging
Traceability
Setting
On
On
10-8
Embedded IDE Link CC Pane
Application
Efficiency
Safety precaution
Setting
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
For more information about using profiling, refer to profile
Execution Profiling” on page 4-11.
10-9
10
Embedded IDE Link™ CC Configuration Parameters
Profile by
Defines which execution profiling technique to use.
Settings
Default:
Task
Task
Profiles model execution by the tasks in the model.
Atomic subsystem
Profiles model execution by the atomic subsystems in the model.
Dependencies
Selecting Real-time execution profiling enables this parameter.
Command-Line Information
Parameter: profileBy
Type: string
Value:
Task
|
Atomic subsystem
Default:
Task
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Task or
Atomic subsystem
Archive_library
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-10
Embedded IDE Link CC Pane
For more information about PIL, refer to “Using Processor in the Loop” on page 4-3.
For more information about enabling profiling, refer to profile
, and
“Real-Time Execution Profiling” on page 4-11
10-11
10
Embedded IDE Link™ CC Configuration Parameters
Number of profiling samples to collect
Specifies the number of profiling samples to collect. Collection stops when the buffer for profiling data is full.
Settings
Default: 100
Minimum: 1
Maximum: Buffer capacity in samples
Tips
• Collecting profiling data on a simulator may take a very long time.
• Data collection stops after collecting the specified number of samples. The application and processor continue to run.
Dependencies
This parameter is enabled by Profile real-time task execution.
Command-Line Information
Parameter:
ProfileNumSamples
Type: int
Value: Positive integer
Default:
100
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
100
No impact
No impact
No impact
10-12
Embedded IDE Link CC Pane
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-13
10
Embedded IDE Link™ CC Configuration Parameters
Inline run-time library functions
Marks run-time library functions generated by the Signal Processing Toolbox and Video and Image Processing Blockset™ block algorithms. These functions as marked with the inline keyword.
Settings
Default: On
On
Adds the keyword inline to each instance of an algorithm generated from blocks in the Signal Processing Blockset software and Video and
Image Processing Blockset software.
Off
Does not mark the algorithms with the keyword.
Tips
The following list shows cases where inlining run-time library functions may not be appropriate:
• Few or no numerical parameters in the function
• One algorithm that is already fixed in capability, such as it has no optional modes or alternate algorithms
• Function supports only one data type
• Significant or large code size in the mdlOutputs() function
• Your models use multiple instances of this library function
Command-Line Information
Parameter:
InlineDSPBlks
Type: string
Value:
'on'
|
'off'
Default: on
10-14
Embedded IDE Link CC Pane
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Off
On
On
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-15
10
Embedded IDE Link™ CC Configuration Parameters
Project options
Sets the project options for building your project from the model.
Settings
Default:
Custom
Custom
Applies a custom project configuration that provides a specialized combination of build and optimization settings.
The default settings are the same as the Release project configuration in CCS, except for the compiler and memory options. For the compiler options,
Custom does not use any optimizations. For memory configuration,
Custom specifies a memory model that uses
Far
Aggregate for data and
Far for functions.
Debug
Applies the
Debug project options defined by Code Composer Studio software to the generated project and code. The Compiler options string becomes
-g -d _DEBUG
Release
Applies the
Release project configuration defined by Code Composer
Studio software to the generated project and code. Sets the Compiler
options string to
-o2
.
.
Dependencies
• Selecting
Custom disables the reset options for Compiler options string and Linker options string.
• Selecting
Release sets the Compiler options string to
-o2
.
• Selecting
Debug sets the Compiler options string to
-g -d _DEBUG
Command-Line Information
Parameter: projectOptions
Type: string
10-16
Embedded IDE Link CC Pane
Value:
Custom
|
Debug
|
Release
Default:
Custom
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Custom or
Debug
Custom
,
Debug
,
Release
Release
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-17
10
Embedded IDE Link™ CC Configuration Parameters
Compiler options string
Lets you enter a string of compiler options to define your project configuration.
Settings
Default: No default
Tips
• To import compiler string options from the current project in CCS, click
Get from IDE.
• To reset the compiler options to the default values, click Reset.
• Use spaces between options.
• Verify that the options are valid. The software does not validate the option string.
• Setting Project options to Custom applies the
Custom compiler options defined by Embedded IDE Link CC software.
Custom does not use any optimizations.
• Setting Project options to Debug applies the
_Debug
,
-g
, and
-d complier flags defined by Code Composer Studio software.
• Setting Project options to Release applies the CCS Release compiler options and adds the
-o2 optimization flag defined by Code Composer
Studio software.
Command-Line Information
Parameter: compilerOptionsStr
Type: string
Value:
Custom
|
Debug
|
Release
Default:
Custom
Recommended Settings
Application
Debugging
Setting
Custom
10-18
Embedded IDE Link CC Pane
Application
Traceability
Efficiency
Safety precaution
Setting
Custom
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-19
10
Embedded IDE Link™ CC Configuration Parameters
Linker options string
Enables you to specify linker command options that determine how to link your project when you build your project.
Settings
Default: No default
Tips
• Use spaces between options.
• Verify that the options are valid. The software does not validate the options string.
• To import linker string options from the current project in CCS, click Get
from IDE.
• To reset the linker command options to the default values, click Reset.
Dependencies
Setting Build action to
Archive_library removes this parameter.
Command-Line Information
Parameter: linkerOptionsStr
Type: string
Value: any valid linker option
Default: none
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
No impact
No impact
No impact
No impact
10-20
Embedded IDE Link CC Pane
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-21
10
Embedded IDE Link™ CC Configuration Parameters
System stack size (MAUs)
Allocates memory for the system stack on the processor.
Settings
Default: 8192
Minimum: 0
Maximum: Available memory
• Enter the stack size in minimum addressable units (MAUs)..
• The software does not verify that your size is valid. Be sure that you enter an acceptable value.
Dependencies
Setting Build action to
Archive_library removes this parameter.
Command-Line Information
Parameter: systemStackSize
Type: int
Default:
8192
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting int int int
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-22
Embedded IDE Link CC Pane
Build action
Defines how Real-Time Workshop software responds when you press Ctrl+B to build your model.
Settings
Default:
Build_and_execute
Build_and_execute
Builds your model, generates code from the model, and then compiles and links the code. After the software links your compiled code, the build process downloads and runs the executable on the processor.
Create_project
Directs Real-Time Workshop software to create a new project in the IDE.
Archive_library
Invokes the CCS Archiver to build and compile your project, but It does not run the linker to create an executable project. Instead, the result is a library project.
Build
Builds a project from your model. Compiles and links the code. Does not download and run the executable on the processor.
Create_processor_in_the_loop_project
Directs the Real-Time Workshop code generation process to create PIL algorithm object code as part of the project build.
Dependencies
Selecting
Archive_library removes the following parameters:
• Interrupt overrun notification method
• Interrupt overrun notification function
• Profile real-time task execution
• Number of profiling samples to collect
• Linker options string
• Get from IDE
10-23
10
Embedded IDE Link™ CC Configuration Parameters
• Reset
• Export IDE link handle to base workspace
Selecting
Create_processor_in_the_loop_project removes the following parameters:
• Interrupt overrun notification method
• Interrupt overrun notification function
• Profile real-time task execution
• Number of profiling samples to collect
• Linker options string
• Get from IDE
• Reset
• Export IDE link handle to base workspace with the option set to export the handle
Command-Line Information
Parameter: buildAction
Type: string
Value:
Build
|
Build_and_execute
|
Create_project Archive_library
|
Create_processor_in_the_loop_project
Default:
Build_and_execute
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Build_and_execute
Archive_library
No impact
No impact
10-24
Embedded IDE Link CC Pane
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
For more information about PIL, refer to “Using Processor in the Loop” on page 4-3.
10-25
10
Embedded IDE Link™ CC Configuration Parameters
Interrupt overrun notification method
Specifies how your program responds to overrun conditions during execution.
Settings
Default:
None
None
Your program does not notify you when it encounters an overrun condition.
Print_message
Your program prints a message to standard output when it encounters an overrun condition.
Call_custom_function
When your program encounters an overrun condition, it executes a function that you specify in Interrupt overrun notification function.
Tips
• The definition of the standard output depends on your configuration.
• The custom function must exist in the current working directory.
Dependencies
Selecting
Call_custom_function enables the Interrupt overrun
notification function parameter.
Setting this parameter to
Call_custom_function enables the Interrupt
overrun notification function parameter.
Command-Line Information
Parameter: overrunNotificationMethod
Type: string
Value:
None
|
Print_message
|
Call_custom_function
Default:
None
10-26
Embedded IDE Link CC Pane
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Print_message or
Call_custom_function
Print_message
None
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-27
10
Embedded IDE Link™ CC Configuration Parameters
Interrupt overrun notification function
Specifies the name of a custom function your code runs when it encounters an overrun condition during execution.
Settings
No Default
Tips
Specify a function that exists in your current working directory.
Dependencies
This parameter is enabled by setting Interrupt overrun notification
method to
Call_custom_function
.
Command-Line Information
Parameter: overrunNotificationFcn
Type: string
Value: no default
Default: no default
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
String
String
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-28
Embedded IDE Link CC Pane
PIL block action
Specifies whether Real-Time Workshop software builds the PIL block and downloads the block to the processor
Settings
Default:
Create_PIL_block_and_download
Create_PIL_block_build_and_download
Builds and downloads the PIL application to the processor after creating the PIL block. Adds PIL interface code that exchanges data with
Simulink.
Create_PIL_block
Creates a PIL block, places the block in a new model, and then stops without building or downloading the block. The resulting project will not compile in the IDE.
None
Configures model to generate a CCS project that contains the PIL algorithm code. Does not build the PIL object code or block. The new project will not compile in the IDE.
Tips
• When you click Build on the PIL dialog box, the build process adds the PIL interface code to the project and compiles the project in the IDE.
• If you select Create PIL block
, you can build manually from the block right-click context menu
• After you select Create PIL Block
, copy the PIL block into your model to replace the original subsystem. Save the original subsystem in a different model so you can restore it in the future. Click Build to build your model with the PIL block in place.
• Add the PIL block to your model to use cosimulation to compare PIL results with the original subsystem results. Refer to the demo “Comparing
Simulation and processor Implementation with Processor-in-the-Loop
(PIL)” in the product demos Embedded IDE Link CC
10-29
10
Embedded IDE Link™ CC Configuration Parameters
• When you select None or
Create_PIL_block
, the generated project will not compile in the IDE. To use the PIL block in this project, click Build followed by Download in the PIL block dialog box.
Dependency
Enable this parameter by setting Build action to
Create_processor_in_the_loop_project
.
Command-Line Information
Parameter: configPILBlockAction
Type: string
Value:
None
|
Create_PIL_block
|
Create_PIL_block_build_and_download
Default:
Create_PIL_block
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
Create_PIL_block_build_and_download
Create_PIL_block_build_and_download
None
No impact
See Also
For more information, refer to “Using Processor in the Loop” on page 4-3.
10-30
Embedded IDE Link CC Pane
Maximum time allowed to build project (s)
Specifies how long, in seconds, the software waits for the project build process to return a completion message.
Settings
Default: 1000
Minimum: 1
Maximum: No limit
Tips
• The build process continues even if MATLAB does not receive the completion message in the allotted time.
• This timeout value does not depend on the global timeout value in a ticcs object or the Maximum time to complete IDE operations timeout value.
Dependency
This parameter is disabled when you set Build action to
Create_project
.
Command-Line Information
Parameter:
TBD
Type: int
Value: Integer greater than 0
Default:
100
Recommended Settings
Application
Debugging
Traceability
Setting
No impact
No impact
10-31
10
Embedded IDE Link™ CC Configuration Parameters
Application
Efficiency
Safety precaution
Setting
No impact
No impact
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-32
Embedded IDE Link CC Pane
Maximum time to complete IDE operations (s)
specifies how long the software waits for IDE functions, such as read or write
, to return completion messages.
Settings
Default: 10
Minimum: 1
Maximum: No limit
Tips
• The IDE operation continues even if MATLAB does not receive the message in the allotted time. Click here to see a list of the functions and methods.
• This timeout value does not depend on the global timeout value in a ticcs object or the Maximum time allowed to build project (s) timeout value
Command-Line Information
Parameter:
TBD
Type: int
Value:
Default:
10
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting
No impact
No impact
No impact
No impact
10-33
10
Embedded IDE Link™ CC Configuration Parameters
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
10-34
Embedded IDE Link CC Pane
Source file replacement
Selects the diagnostic action to take if Embedded IDE Link CC software detects conflicts that you are replacing source code with custom code.
Settings
Default: warn none
Does not generate warnings or errors when it finds conflicts.
warning
Displays a warning.
error
Terminates the build process and displays an error message that identifies which file has the problem and suggests how to resolve it.
Tips
• The build operation continues if you select warning and the software detects custom code replacement. You see warning messages as the build progresses.
• Select error the first time you build your project after you specify custom code to use. The error messages can help you diagnose problems with your custom code replacement files.
• Select none when the replacement process is correct and you do not want to see multiple messages during your build.
• The messages apply to Real-Time Workshop Custom Code replacement options as well.
Command-Line Information
Parameter:
DiagnosticActions
Type: string
Value: none
| warning
| error
Default: warning
10-35
10
Embedded IDE Link™ CC Configuration Parameters
Recommended Settings
Application
Debugging
Traceability
Efficiency
Safety precaution
Setting error error warning error
See Also
For more information, refer to “Embedded IDE Link CC Pane Parameters” on page 3-57.
For more information about replacing files, refer to “Using Custom Source
Files in Generated Projects” on page 3-65
10-36
Supported Hardware
This appendix provides the details about the hardware, simulators, and software that work with Embedded IDE Link CC.
• “Supported Platforms for Embedded IDE Link CC” on page A-2
• “Supported Versions of Code Composer Studio” on page A-8
A
A
Supported Hardware
A-2
Supported Platforms for Embedded IDE Link CC
In this section...
“Supported Hardware and Simulators” on page A-2
“Product Features Supported by Each Processor or Family” on page A-4
“OMAP Coemulation Support” on page A-7
“Custom Hardware Support” on page A-7
This appendix lists the hardware and simulators that work with the latest released version of Embedded IDE Link CC. Generally, the product supports boards and simulators from a given processor family. In some cases, only the simulators work, as noted in the tables in the next sections.
Supported Hardware and Simulators
Embedded IDE Link CC supports the following processors and boards produced by TI and others.
Supported
Hardware
C2000
Supported Simulators Description
C2401 eZdsp
C2407 eZdsp
C2808 eZdsp
C2812 eZdsp
C2833x
Floating-Point
Processor
Simulators (C24x, C27x,
C28x)
Simulators for the C2000 DSP family
Starter kit for the C2401 processor
Starter kit for the C2407 processor
Starter kit for the C2808 processor
Starter kit for the C2812 processor
Floating-point processor from
Texas Instruments
Supported Platforms for Embedded IDE Link™ CC
Supported
Hardware
C5000
C5402 DSK
C5416 DSK
C5510 DSK
C6000
C6211 DSK
C6416 DSK
DM64x
DM643x
C6701 EVM
C6711 DSK
C6713 DSK
OMAP
OMAP1510
Supported Simulators Description
Simulators (C54x, C5x) Simulators for the C5000 DSP family
DSP starter kit for the C5402 processor
DSP starter kit for the C5416 processor
DSP starter kit for the C5510 processor
Simulators (C62x, C64x,
C67x)
Simulators for the C6000 DSP family
DSP starter kit for the C6211 processor
DSP starter kit for the C6416 processor
C6400 processor-based video card
DaVinci™ processor from
Texas Instruments
Evaluation module for the
C6701 processor
DSP starter kit for the C6711 processor
DSP starter kit for the C6713 processor
Boards and simulators based on the OMAP1510.
A-3
A
Supported Hardware
Supported
Hardware
OMAP5910
TMS470
TMS470R1x
TMS470R2x
Supported Simulators Description
Boards and simulators based on the OMAP5910.
Boards and simulators based on the TMS470R1x processor.
Boards and simulators based on the TMS470R2x processor.
Product Features Supported by Each Processor or
Family
Within the collection of hardware that Embedded IDE Link CC supports, some features of the link do not apply.
Debug mode includes operations that CCS handles and that Embedded IDE
Link CC enables you to use from MATLAB. “Yes” in the Debug column tells you that the listed hardware supports MATLAB interaction with CCS.
Embedded Objects support indicates that the board family supports using objects in MATLAB to work with symbol table entries in CCS. A “Yes” in the Hardware-in-the-Loop column means the board family supports using function objects to run functions on your processor from MATLAB.
Embedded IDE Link CC provides components that work with and use CCS
IDE and TI Real-Time Data Exchange (RTDX):
A-4
Supported Platforms for Embedded IDE Link™ CC
Component
Debug Function
Processor-in-the-Loop (PIL)
Use
Use objects to create reference connections between CCS IDE and MATLAB. From the command window, you can run applications in CCS IDE, send to and receive data from processor memory, and check the processor status, as well as other functions such as starting and stopping applications running on your digital signal processors.
Evaluate how a candidate algorithm runs on your hardware and compare the performance to a simulation.
Real-Time Data Exchange (RTDX)
Component
Real-Time Execution Profiling
Support for RTDX on C5000 and
C6000 processors will be removed in a future version.
Communications pathway between
MATLAB environment and digital signal processors installed on your
PC. Using objects in Embedded
IDE Link CC, you open channels to processors on boards in your computer and send and retrieve data
In the next table, each processor family appears with headings that specify the support provided.
about the processors and executing applications, as well as send data to the processes for use and get data from the applications.
A-5
A
Supported Hardware
Processor
Family
C24xx
C27xx
C28xx
C54xx
C55xx
C62xx
C64x and
C64x+
C67x and
C67x+
DM64x
DM643x
OMAP1510
Processor Family Supporting Embedded IDE Link CC Components and Subcomponents
Automation Interface Component
Debug
Mode
Yes
Yes
Yes
Yes
Yes
Yes
Yes
RTDX
No
No
Yes
Yes
Yes
Yes
Yes
Project Generator
Component
Code Generation
No
No
Yes
Yes
Yes
Yes
Yes
PIL
No
No
Yes
Yes
Yes
Yes
Yes
Verification
Real-Time
Execution
Profiling
No
No
Yes
Yes
Yes
Yes
Yes
• C55x DSP
• R2x
TMS470R1x
TMS470R2x
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
No
No
No
Yes
Yes
Yes
Yes
No
No
No
No
Note To use the Function call capability with the C28x processor family, disable the watchdog timer on the processor. The watchdog timer interferes with the function call utility.
A-6
Supported Platforms for Embedded IDE Link™ CC
OMAP Coemulation Support
An added feature for OMAP processors is coemulation for the two processors that comprise the OMAP. Embedded IDE Link CC supports coemulation or direct multiprocessor support for the TMS470R2x (TI-enhanced ARM925) and
TMS320C55x DSP in OMAP 1510 and OMAP 5910.
Custom Hardware Support
Embedded IDE Link CC supports processors as shown in the previous tables.
When your custom hardware meets the following specifications:
• Uses one or more of the processors shown in the preceding tables or listed in the Target Preferences block Processor list
• You are able to use Code Composer Studio IDE to interact with your board/processor combination you should be able to use Embedded IDE Link CC with your hardware.
A-7
A
Supported Hardware
Supported Versions of Code Composer Studio
The following table lists versions of Embedded IDE Link CC and the versions of Code Composer Studio they support.
Embedded
IDE Link CC
Version
3.3
MATLAB
Release
R2008b
Supported Version of Code Composer
Studio
3.2
3.1
3.0
2.1
2.0
1.5
1.4.2
1.4.1
1.4
R2008a
R2007b
R2007a
R2006b
R2006a+
R2006a
R14SP3
R14SP2
R14SP1+
Only CCS 3.3 with DSP/BIOS 5.32.01 or
5.32.05 (not 5.32.00)
Only CCS 3.3 with DSP/BIOS 5.3 (not 5.32.00)
Only CCS 3.3 with DSP/BIOS 5.3
• CCS 3.2 for C64x+ processors
• CCS 3.1 for C2000, C5000, C6000, and
OMAP processors
• CCS 3.2 for C64x+ processors
• CCS 3.1 for C2000, C5000, C6000, and
OMAP processors
CCS 3.1 for C2000, C5000, C6000, and OMAP processors
CCS 3.1 for C2000, C5000, C6000, and OMAP processors
• CCS 3.0 for C6000 processors
• CCS 2.2 for C2000, C5000, C6000, and
OMAP processors
• CCS 3.0 for C6000 processors
• CCS 2.2 for C2000, C5000, C6000, and
OMAP processors
• CCS 3.0 for C6000 processors
• CCS 2.2 for C2000, C5000, C6000, and
OMAP processors
A-8
Supported Versions of Code Composer Studio
Embedded
IDE Link CC
Version
1.3.2
1.3.1
1.3
MATLAB
Release
R14SP1
R14
R13SP1+
Supported Version of Code Composer
Studio
• CCS 2.2 for C2000, C5000, C6000, and
OMAP processors
• CCS 2.12 for C2000, C5000, C6000, and
OMAP processors
• CCS 2.2 for C2000, C5000, C6000, and
OMAP processors
• CCS 2.12 for C2000, C5000, C6000, and
OMAP processors
CCS 2.12 for C2000, C5000, C6000, and
OMAP processors
A-9
A
Supported Hardware
A-10
Reported Limitations and
Tips
B
B
Reported Limitations and Tips
Reported Issues Using Embedded IDE Link CC Software
In this section...
“Demonstration Programs Do Not Run Properly Without Correct GEL
“Issues Using USB-Based RTDX Emulators and the C6416 DSK and C6713
“Error Accessing type Property of ticcs Object Having Size Greater Then 1” on page B-5
“Changing the represent Property of an Object” on page B-6
“Changing Values of Local Variables Does Not Take Effect” on page B-7
“Code Composer Studio Cannot Find a File After You Halt a Program” on page B-7
“C54x XPC Register Can Be Modified Only Through the PC Register” on page B-9
“Working with More Than One Installed Version of Code Composer Studio” on page B-9
“Changing CCS Versions During a MATLAB Session” on page B-10
“MATLAB Hangs When Code Composer Studio Cannot Find a Board” on page B-10
“Different Read Techniques Appear to Return Different Values” on page
“Using Function Call with C28x Processors” on page B-13
“RTDX Demos Do Not Run on C6727 PADK” on page B-13
“Using Mapped Drives” on page B-14
Some long-standing issues affect the Embedded IDE Link CC product.
When you are using ticcs objects and the software methods to work with
Code Composer Studio and supported hardware or simulators, recall the information in this section.
B-2
Reported Issues Using Embedded IDE Link™ CC Software
The latest issues in the list appear at the bottom. HIL refers to “hardware in the loop,” also called processor in the loop (PIL) here and in other applications, and sometimes referred to as function calls.
Demonstration Programs Do Not Run Properly
Without Correct GEL Files
To run the Embedded IDE Link CC demos, you must load the appropriate
GEL files before you run the demos. For some boards, the demos run fine with the default CCS GEL file. Some boards need to run device-specific GEL files for the demos to work correctly.
Here are demos and boards which require specific GEL files.
• Board: C5416 DSK
Demos: rtdxtutorial
, rtdxlmsdemo
Emulator: XDS-510
GEL file to load: c5416_dsk.gel
• Board: C6416 DSK
Demos: rtdxtutorial
, rtdxlmsdemo
Emulator: XDS-510
GEL file to load:
DSK6416.gel
• Board: C6713 DSK
Demos: rtdxtutorial
, rtdxlmsdemo
Emulator: XDS-510
GEL file to load:
DSK6713.gel
In general, if a demo does not run correctly with the default GEL file, try using a device-specific GEL file by defining the file in the CCS Setup Utility.
B-3
B
Reported Limitations and Tips
Issues Using USB-Based RTDX Emulators and the
C6416 DSK and C6713 DSK
You may encounter a few problems when you try to use the USB-based RTDX emulators with the C6713 and C6416 DSP Starter Kits. The problems relate to setting up RTDX and opening/closing RTDX channels.
1
Setting up and cleaning up RTDX.
If you do not set up RTDX correctly, your hardware might end up in a bad state and RTDX data transfers may not work correctly. Rerunning the application without setting up RTDX properly yields the same result. To bring the hardware back to a working state, you have to recycle power to your board. Likewise, if RTDX is not cleaned up correctly after running an application, your hardware can go into a bad state.
2
When you close and reopen CCS for DSP Starter Kit for TMS320C6416 or
DSP Starter Kit for TMS320C6713, you have to adhere to the two second close and reopen requirement as noted in TI documentation.
In the Quick Start Installation Guide, under “Debug Hints and Trouble
Shooting,” item 6 states
“The LED above the USB connector illuminates when the DSK is powered on. Do not start Code Composer Studio until the LED turns off.”
When your CCS application terminates, the USB bus is nonenumerated. It takes a few seconds (roughly two seconds in Windows XP) to enumerate the USB bus again.
Consequently, although the CCS application may appear to have gone away from the desktop, there can still be some processes running. You should follow the above guidelines when communicating with a C6416
DSK, C6713 DSK, or XDS510USB on a close and reopen sequence.
References
The information in this discussion comes from the following TI publications — dsk6416_releasenotes.htm
and dsk6713_releasenotes.htm
• Section 3.0 Installation
B-4
Reported Issues Using Embedded IDE Link™ CC Software
• Section 5.0 Some Basics on How it Works
• Quick Start Installation Guide, “Debug Hints and Trouble Shooting”
To avoid having problems in MATLAB software when you work with links, note these recommended tasks (in order) for creating handles to CCS from
MATLAB.
1
Assuming CCS IDE is not open ( cc_app.exe
is not in the Windows Task
Manager), create a handle to CCS ( cc_app.exe
appears in the Task
Manager).
cc = ticcs
2
Clear the handle to CCS ( cc_app.exe
disappears from the Task Manager).
clear cc
3
Wait about two seconds before creating a new handle to CCS.
pause(2); cc = ticcs
Error Accessing type Property of ticcs Object Having
Size Greater Then 1
When cc is a ticcs object consisting of an array of single ticcs objects such that cc
Array of TICCS Objects:
API version : 1.2
Board name : C54x Simulator (Texas Instruments)
Board number : 0
Processor 0 (element 1) : TMS320C5407 (CPU, Not Running)
Processor 0 (element 2) : TMS320C5407 (CPU, Not Running) you cannot use cc to access the type object. The example syntaxes below generate errors.
• cc.type
B-5
B
Reported Limitations and Tips
• add(cc.type,'mytypedef','int')
To access type without the error, reference the individual elements of cc as follows:
• cc(1).type
• add(cc(2).type,'mytypedef','int')
Changing the represent Property of an Object
An object’s represent property is writable. You can change it to modify the access format. For example, an object with represent set to float can be changed to represent set to signed
. After the change, the data is read as a signed integer. Likewise, the data is written as a signed integer.
Here’s one example of changing the property value for represent. Create a ticcs object to start.
x = createobj(cc,'g_double')
NUMERIC Object stored in memory:
Symbol name
Address
: g_double
: [ 14648 0]
Data type
Word size
: double
: 64 bits
Address units per value : 8 au
Representation : float
Size
Total address units
Array ordering
Endianness
: [ 1 ]
: 8 au
: row-major
: little read(x) ans =
17.0010
set(x,'represent','signed') read(x) ans =
B-6
Reported Issues Using Embedded IDE Link™ CC Software
4.6255e+018
Take care when you change the value of the represent property to float
.
Only change this property when the word referenced by the object is at least
32 bits.
As one example, if an object is a 16-bit integer where represent
= signed
, you cannot change the value for represent to float because to access floating point data, the data must be at least 32 bits long.
Changing Values of Local Variables Does Not Take
Effect
If you halt the execution of your program on your DSP and modify a local variable’s value, the new value may not be acknowledged by the compiler. If you continue to run your program, the compiler uses the original value of the variable.
This problem happens only with local variables. When you write to the local variable via the Code Composer Studio Watch Window or via a MATLAB object, you are writing into the variable’s absolute location (register or address in memory).
However, within the processor function, the compiler sometimes saves the local variable’s values in an intermediate location, such as in another register or to the stack. That intermediate location cannot be determined or changed/updated with a new value during execution. Thus the compiler uses the old, unchanged variable value from the intermediate location.
Code Composer Studio Cannot Find a File After You
Halt a Program
When you halt a running program on your processor, Code Composer Studio may display a dialog box that says it cannot find a source code file or a library file.
When you halt a program, CCS tries to display the source code associated with the current program counter. If the program stops in a system library like the runtime library, DSP/BIOS, or the board support library, it cannot
B-7
B
Reported Limitations and Tips find the source code for debug. You can either find the source code to debug it or select the Don’t show this message again checkbox to ignore messages like this in the future.
For more information about how CCS responds to the halt, refer the online
Help for CCS. In the online help system, use the search engine to search for the keywords “Troubleshooting” and “Support.” The following information comes from the online help for CCS, starting with the error message:
File Not Found
The debugger is unable to locate the source file necessary to enable source-level debugging for this program.
To specify the location of the source file
1
Click Yes. The Open dialog box appears.
2
In the Open dialog box, specify the location and name of the source file then click Open.
The next section provides more details about file paths.
Defining a Search Path for Source Files
The Directories dialog box enables you to specify the search path the debugger uses to find the source files included in a project.
To Specify Search Path Directories
1
Select Option > Customize.
2
In the Customize dialog box, select the Directories tab. Use the scroll arrows at the top of the dialog box to locate the tab.
The Directories dialog box offers the following options.
•
Directories
. The
Directories list displays the defined search path.
The debugger searches the listed directories in order from top to bottom.
B-8
Reported Issues Using Embedded IDE Link™ CC Software
If two files have the same name and are located in different directories, the file located in the directory that appears highest in the
Directories list takes precedence.
• New
. To add a new directory to the
Directories list, click New.
Enter the full path or click browse [...] to navigate to the appropriate directory. By default, the new directory is added to the bottom of the list.
• Delete
. Select a directory in the
Directories list, then click Delete to remove that directory from the list.
• Up
. Select a directory in the
Directories list, then click Up to move that directory higher in the list.
• Down
. Select a directory in the
Directories list, then click Down to move that directory lower in the list.
3
Click OK to close the Customize dialog box and save your changes.
C54x XPC Register Can Be Modified Only Through the PC Register
You cannot modify the XPC register value directly using regwrite to write into the register. When you are using extended program addressing in C54x, you can modify the XPC register by using regwrite to write a 23-bit data value in the PC register. Along with the 16-bit PC register, this operation also modifies the 7-bit XPC register that is used for extended program addressing.
On the C54x, the PC register is 23 bits (7 bits in XPC + 16 bits in PC).
You can then read the XPC register value using regread
.
Working with More Than One Installed Version of
Code Composer Studio
When you have more than one version of Code Composer Studio installed on your machine, you cannot select which CCS version MATLAB Embedded IDE
Link CC attaches to when you create a ticcs object. If, for example, you have both CCS for C5000 and CCS for C6000 versions installed, you cannot choose to connect to the C6000 version rather than the C5000 version.
When you issue the command
B-9
B
Reported Limitations and Tips cc = ticcs
Embedded IDE Link CC starts the CCS version you last used. If you last used your C5000 version, the cc object accesses the C5000 version.
Workaround
To make your ticcs object access the correct processor:
1
Start and close the appropriate CCS version before you create the ticcs object in MATLAB.
2
Create the ticcs object using the boardnum and procnum properties to select your processor, if needed.
Recall that ccsboardinfo returns the boardnum and procnum values for the processors that CCS recognizes.
Changing CCS Versions During a MATLAB Session
You can use only one version of CCS in a single MATLAB session. Embedded
IDE Link CC does not support using multiple versions of CCS in a MATLAB session. To use another CCS version, exit MATLAB software and restart it.
Then create your links to the new version of CCS.
MATLAB Hangs When Code Composer Studio Cannot
Find a Board
In MATLAB software, when you create a ticcs object, the construction process for the object automatically starts CCS. If CCS cannot find a processor that is connected to your PC, you see a message from CCS like the following
DSP Device Driver dialog box that indicates CCS could not initialize the processor.
B-10
Reported Issues Using Embedded IDE Link™ CC Software
Four options let you decide how to respond to the failure:
• Abort — Closes CCS and suspends control for about 30 seconds. If you used MATLAB software functions to open CCS, such as when you create a ticcs object, the system returns control to MATLAB command window after a considerable delay, and issues this warning:
??? Unable to establish connection with Code Composer Studio.
• Ignore — Starts CCS without connecting to any processor. In the CCS IDE you see a status message that says EMULATOR DISCONNECTED in the status area of the IDE. If you used MATLAB to start CCS, you get control immediately and Embedded IDE Link CC creates the ticcs object. Because
B-11
B
Reported Limitations and Tips
CCS is not connected to a processor, you cannot use the object to perform processor operations from MATLAB, such as loading or running programs.
• Retry — CCS tries again to initialize the processor. If CCS continues not to find your hardware processor, the same DSP Device Driver dialog box reappears. This process continues until either CCS finds the processor or you choose one of the other options to respond to the warning.
One more option, Diagnostic, lets you enter diagnostic mode if it is enabled.
Usually, Diagnostic is not available for you to use.
Different Read Techniques Appear to Return Different
Values
When you read the value of a pointer on your C54x processor, the result can seem to depend on how you read the value. If you check the value in the
MATLAB workspace browser, you see that read returns the same values in both cases.
The following example shows this happening with the variable g_vptr
.
In source code you have the following prototype.
double mydouble; void *g_vptr = &mydouble;
In MATLAB, perform these operations to set a value to read.
ptr = createobj(cc,'g_vptr'); convert(ptr,'Double *'); % Use double to represent ptr.
ptr1 = deref(ptr1); write(ptr1,10^20);
With the variables defined as shown, reading the data returns different results depending on which read syntax you use to read the data.
result1 = read(cc, ptr1.address, 'single') % Return the value...
% in single format.
returns
B-12
Reported Issues Using Embedded IDE Link™ CC Software
1.0000000e+020 and result2 = read(ptr1) returns
1.000000020040877e+020
The results appear to differ after the seventh decimal place. If you go to the
MATLAB workspace browser to look at the values, you see that result1 and result2 are the same. The apparent difference occurs because the syntax result1 = read(cc, ptr1.address, 'single') explicitly states that result1 is returned in single format, as controlled by the single input argument. On the other hand, result2 = read(ptr1) converts the data from ptr1 on the processor to double-precision format.
That is, result2 = double(result1)
In general, use read() when you want to access the data on the processor.
Use the read(object,...) syntax when you are manipulating data on the processor.
Using Function Call with C28x Processors
When you use the function call capability with any C28x processor, you must disable the watchdog timer or the function call process does not work.
RTDX Demos Do Not Run on C6727 PADK
Limitations in the demo files prevent you from running the RTDX demos on your C6727 Professional Audio Development Kit (PADK).
B-13
B
Reported Limitations and Tips
Using Mapped Drives
Limitations in Code Composer Studio do not allow you to load programs after you set your CCS working directory to a read-only mapped drive. When you set the CCS working directory to a mapped drive for which you do not have write permissions, you cannot load programs from any location. Load operations fail with an Application Error dialog box.
The following combination of commands does not work:
1 cd(cc,'mapped_drive_letter') % Change CCS working directory to read-only mapped drive.
2 load(cc,'program_file') % Loading any program fails.
B-14
Index
Index
A
B
block limitations using model reference 3-79
build configuration compiler options, default 3-64 custom 3-64 default 3-64
C
C280x/C28x3x hardware interrupt block 9-2
C280x/C28x3x Hardware Interrupt block 9-2
c281x hardware interrupt block 9-8
C6000 target preferences block 9-45
CCS IDE objects tutorial about using 2-2
configuration parameters pane 10-4
Compiler options string: 10-18
Export IDE link handle to base workspace: 10-5
Inline run-time library functions 10-14
Interrupt overrun notification function: 10-28
overrunNotificationMethod 10-26
Profile real-time execution 10-8
System stack size (MAUs): 10-22
configure the software timer 9-49
create custom target function library 3-76
custom build configuration 3-64 custom compiler options 3-64
D
Data Type Manager 2-58 data types
Index-1
Index
default build configuration 3-64 default compiler options 3-64
delete 7-43 breakpoint 7-43 source file 7-43 delete breakpoint 7-43
DSP/BIOS adding to generated code 3-57
E
Embedded IDE Link™ CC code generation options 3-57
execution in timer-based models 3-18
execution profiling subsystem 4-14
export filters to CCS IDE from FDATool 5-1
select the export data type 5-6
set the Export mode option 5-5
F
FDATool. See export filters to CCS IDE from
FDATool
G
generate optimized code 3-57 generate_code_only option 3-57
H
I
import filter coefficients from FDATool.. See
FDATool
inline Signal Processing Blockset functions option 3-57
interrupts enabling 3-20 mapping 3-20
intrinsics. See target function library
Index-2
Index
L link properties
link properties, details about 2-52
introducing the tutorial for using links for
loading files into CCS IDE 2-10
running applications using RTDX 2-32
tutorial about using links for RTDX 2-21
working with your processor 2-13
list 7-81 list object 7-81 list variable 7-81
M
model reference 3-77 about 3-77
Target Preferences blocks 3-79
N
new build configuration 7-94 file 7-94 project 7-94
O
objects creating objects for CCS IDE 2-8
introducing the objects for CCS IDE tutorial 2-2
selecting processors for CCS IDE 2-7
tutorial about using Automation Interface for CCS IDE 2-2
optimization, processor specific 3-57
Index-3
Index
P
PIL cosimulation definitions 4-4
processor general code generation options 3-55
processor configuration options build action 3-57
processor function library. See target function library
processor information, get 7-59
processor specific optimization 3-57
profile 7-101 profiling code 7-101
profiling execution by subsystem 4-14
program counter, restore 7-139
project generation selecting the board 3-3
properties link properties 2-50
Index-4
R
read address 7-114 object 7-114
Real-Time Workshop solver options 3-48
Real—Time Workshop build options generate_code_only
remove 7-137 remove file 7-137
replacing generated code 3-65 replacing linker directives 3-65
restart 7-139 restore program counter 7-139
RTDX links tutorial about using 2-21
S
stack size, set stack size 3-60
symbol 7-147 symbol table, getting symbols 7-147
T
target function library assessing execution time after selecting a library 3-73
seeing the library changes in your generated code 3-74
selecting the library to use 3-72
Target Preferences blocks in referenced models 3-79
TFL. See target function library ticcs
timer-based models, execution 3-18 timer-based scheduler 3-18
adding 2-60 managing 2-60 removing 2-60
V
viewing target function libraries 3-76
visibility, setting 7-157 visible 7-157
W
Index
Index-5
Download
Advertisement
Key features
MATLAB® functions for communication with Code Composer Studio™ software
Transfer information to and from Code Composer Studio software
Get information about data and functions stored in your signal processor memory and registers
Automate complex tasks in the development environment
Automate debugging
Exchange data between MATLAB software and the processor
Verify how your programs run
Use cosimulation techniques to verify generated code
Gather execution profiling timing measurements
Frequently asked questions
The Embedded IDE Link CC software utilizes objects, allowing you to create connections between MATLAB software and Code Composer Studio. You can set and get their properties, and use their methods to change or manipulate these objects and the IDE they reference.
The Embedded IDE Link CC software consists of three main components: Project Generator, Automation Interface, and Verification. These components allow you to generate C code from Simulink models, communicate with Code Composer Studio using MATLAB functions, and verify the execution of your code on the processor.
Embedded IDE Link CC supports a wide range of Texas Instruments DSPs, including TI’s C2000™, TI’s C5000™, and TI’s C6000™.
Embedded IDE Link CC provides verification tools like Processor in the Loop Cosimulation, which allows you to verify generated code in an instruction set simulator or real processor environment, and Execution Profiling, which helps gather execution profiling timing measurements to understand your algorithm's timing requirements.