31
Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserve Technical Training Organization T TO

Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Embed Size (px)

Citation preview

Page 1: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Using Code Composer Studio

Chapter 2

C6000 Integration Workshop

Copyright © 2005 Texas Instruments. All rights reserved. Technical Training

Organization

T TO

Page 2: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Outline

Code Composer Studio (CCS) Projects Build Options Build Configurations Configuration Tool C – Data Types and Header Files Lab 2

Technical TrainingOrganization

T TO

Page 3: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Code Composer Studio

SIM

SimulatorDSK’s Code Composer Studio Includes: Integrated Edit / Debug GUI

Edit

DSK

EVM

Third Party

BIOS: Real-time kernelReal-time analysis

DSP/BIOSLibraries

DSP/BIOSConfigTool

Debug

Code Generation Tools

CompilerAsm Opto

Asm

Standard Runtime Libraries

.outLink

XDS

DSP Board

CCS is Project centric ...Technical TrainingOrganization

T TO

Page 4: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Outline

Code Composer Studio (CCS) Projects Build Options Build Configurations Configuration Tool C – Data Types and Header Files Lab 2

Technical TrainingOrganization

T TO

Page 5: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

What is a Project?

Project (.PJT) file contain:

References to files: Source Libraries Linker, etc …

Project settings: Compiler Options DSP/BIOS Linking, etc …

Let’s look more closely at Build Options and Configurations …Technical TrainingOrganization

T TO

Page 6: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Compiler Build Options

Debug and Optimize options conflict with each other, therefore they should be not be used together

These can be set/modified by …

Nearly one-hundred compiler options available to tune your code's performance, size, etc.

Following table lists most commonly used options:

Options Description

-mv6700 Generate ‘C67x code (‘C62x is default)

-mv67p Generate ‘C672x code

-mv6400  Generate 'C64x code

-mv6400+ Generate 'C64x+ code

-fr <dir> Directory for object/output files

-fs <dir> Directory for assembly files

Debug-g Enables src-level symbolic debugging-ss Interlist C statements into assembly listing

Optimize (release)

-o3 Invoke optimizer (-o0, -o1, -o2/-o, -o3)-k Keep asm files, but don't interlist

Technical TrainingOrganization

T TO

Page 7: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

-g -fr“$(Proj_dir)\Debug" -d"_DEBUG" -mv6700

Build Options GUI

GUI has 8 pages of options for code generation tools

Default build options for a new project are shown

Basic page defaults are -g -mv6700

To make options easier, TI recommends using …Technical Training

Organization

T TO

Page 8: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Build Configurations

For new projects, CCS automatically creates two build configurations: Debug

(unoptimized) Release

(optimized)

-g -fr“$(Proj_dir)\Debug" -d"_DEBUG" -mv6700

-o3 -fr“$(Proj_dir)\Release" -mv6700

Page 9: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Build Configurations

For new projects, CCS automatically creates two build configurations: Debug

(unoptimized) Release

(optimized)

-g -fr“$(Proj_dir)\Debug" -d"_DEBUG" -mv6700

-o3 -fr“$(Proj_dir)\Release" -mv6700

$(Proj_dir)Indicates the current project directory. This aids in project

portability. See SPRA913 (Portable CCS Projects) for

more information.

Page 10: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Two Default Build Configurations

For new projects, CCS automatically creates two build configurations: Debug

(unoptimized) Release

(optimized)

Use the drop-down to quickly select build config.

-g -fr“$(Proj_dir)\Debug" -d"_DEBUG" -mv6700

-o3 -fr“$(Proj_dir)\Release" -mv6700

Page 11: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Two Default Build Configurations

For new projects, CCS automatically creates two build configurations: Debug

(unoptimized) Release

(optimized)

Use the drop-down to quickly select build config.

Add/Remove build config's with Project Configurations dialog (on project menus)

Edit a configuration:1. Set it active2. Modify build options

(shown previously)3. Save project

-g -fr“$(Proj_dir)\Debug" -d"_DEBUG" -mv6700

-o3 -fr“$(Proj_dir)\Release" -mv6700

Technical TrainingOrganization

T TO

Page 12: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Options Description

-o<filename> Output file name-m<filename> Map file name-c Auto-initialize global/static C variables-x Exhaustively read libs (resolve back ref's)

Linker Options

By default, linker options include the –o option

We recommend you add the –m option

“$(Proj_dir)\Debug\" indicates one subfolder level below project (.pjt) location

Run-time Autoinit (-c) tells compiler to initialize global/static variables before calling main()

Autoinit discussed in Ch 3

-c -m "$(Proj_dir)\Debug\lab.map" -o"$(Proj_dir)\De

$(Proj_dir)\Debug\lab.out

Run-time Autoinitialization

$(Proj_dir)\Debug\lab.map

Technical TrainingOrganization

T TO

Page 13: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Outline

Code Composer Studio (CCS) Projects Build Options Build Configurations Configuration Tool C – Data Types and Header Files Lab 2

Technical TrainingOrganization

T TO

Page 14: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

DSP/BIOS Configuration Tool

Simplifies system design by: Automatically includes the appropriate

runtime support libraries Automatically handles interrupt vectors

and system reset Handles system memory configuration

(builds CMD file) Generates 5 files when CDB file is saved:

C file, Asm file, 2 header files and a linker command (.cmd) file

More to be discussed later …

Simplifies system design by: Automatically includes the appropriate

runtime support libraries Automatically handles interrupt vectors

and system reset Handles system memory configuration

(builds CMD file) Generates 5 files when CDB file is saved:

C file, Asm file, 2 header files and a linker command (.cmd) file

More to be discussed later …Technical Training

Organization

T TO

Page 15: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Outline

Code Composer Studio (CCS) Projects Build Options Build Configurations Configuration Tool C – Data Types and Header Files Lab 2

Technical TrainingOrganization

T TO

Page 16: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

‘C6000 C Data Types

Type Bits Representationchar 8 ASCIIshort 16 Binary, 2's complementint 32 Binary, 2's complementlong 40 Binary, 2's complementlong long 64 Binary, 2's complementfloat 32 IEEE 32-bit

double 64 IEEE 64-bit

long double 64 IEEE 64-bit

pointers 32 Binary

Technical TrainingOrganization

T TO

Page 17: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Including Header Files in C/* * ======== Include files ======== */#include <csl.h>#include <csl_edma.h>

#include "sine.h"#include "edma.h"

1. What is #include used for?

2. What do header (.h) files contain?

It adds the contents of the header file to your C file at the point of the #include statement.

Let's look at a header file...

Page 18: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Example Header Files/* * ======== sine.h ======== * This file contains prototypes for all * functions and global datatypes * contained in sine.c */#ifndef SINE_Objtypedef struct {

float freqTone;float freqSampRate;float a;float b;float y0;float y1;float y2;…

} SINE_Obj;#endif

void copyData(short *inbuf, …);void SINE_init(SINE_Obj *sineObj, …);…

/* * ======== edma.h ======== * This file contains references for all * functions contained in edma.c */

void initEdma(void);void edmaHwi(int tcc);extern EDMA_Handle hEdma;

Header files can contain any C code to be used over and over again

Usually a header file is paired with a C file or library object file. Essentially, the header file provides a description of the global items in the “paired” file.

Most commonly, header files contain: Function prototypes Global data references, such as

new type definitions

Therefore...

Page 19: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Including Header Files in C/* * ======== Include files ======== */#include <csl.h>#include <csl_edma.h>

#include "sine.h"#include "edma.h"

1. What is #include used for?

2. What do header (.h) files contain?

3. What is the difference between <.h> and “.h”?

It adds the contents of the header file to your C file at the point of the #include statement.

They can contain any C statements. Usually, they contain code that would otherwise need to be entered into every C file. They’re a shortcut.

Angle brackets <.h> tell the compiler to look in the specified include path. Quotes “.h” indicate the file is located in the same location as the file

which includes it.

Page 20: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Outline

Code Composer Studio (CCS) Projects Build Options Build Configurations Configuration Tool C – Data Types and Header Files Lab 2

Technical TrainingOrganization

T TO

Page 21: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Lab Exercises – C67x vs. C64x Which DSK are you using? We provide instructions and solutions for both

C67x and C64x. We have tried to call out the few differences in

lab steps as explicitly as possible:

Technical TrainingOrganization

T TO

Page 22: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Lab 2 – Creating/Graphing a Sine Wave

CPUbuffer

Create and build a project Examine variables, memory, code Run, halt, step, breakpoint your program Graph results in memory (to see the sine wave)

Introduction to Code Composer Studio (CCS)

Technical TrainingOrganization

T TO

Page 23: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Creating a Sine Wave

t

Asine.cGenerates a value for each output sample

float y[3] = {0, 0. 02, 0};float A = 1.9993146;

short sineGen() {y[0] = y[1] * A - y[2]; y[2] = y[1];y[1] = y[0];

return((short)(28000*y[0]);}

Technical TrainingOrganization

T TO

Page 24: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Lab 2 Debrief

1. What differences are there in Lab2 between the C6713 and C6416 solutions?

2. What do we need CCS Setup for?

3. Did you find the “clearArrays” GEL menu command useful?

Technical TrainingOrganization

T TO

Page 25: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Optional Exercises

Lab2a - Customize CCS Lab2b - Using GEL Scripts Lab2d - Float vs Fixed Point

Technical TrainingOrganization

T TO

Page 26: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Summary: CCS Automation

GEL Scripting Command Window CCS Scripting TCONF Scripting

Technical TrainingOrganization

T TO

Page 27: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

GEL Scripting

GEL: General Extension Language

C style syntax Large number of debugger

commands as GEL functions Write your own functions Create GEL menu items

GEL: General Extension Language

C style syntax Large number of debugger

commands as GEL functions Write your own functions Create GEL menu itemsTechnical Training

Organization

T TO

Page 28: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

Command Window

Some frequently used commands: load <filename.out> reload reset restart ba <label > wa <label>

help dlog <filename>,a dlog close alias ... take <filename.txt>

run run <cond> go <label> step <number> cstep <number> halt

Technical TrainingOrganization

T TO

Page 29: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

CCS Scripting

Debug using VB Script or Perl Using CCS Scripting, a simple script can:

Start CCS Load a file Read/write memory Set/clear breakpoints Run, and perform other basic debug

functions

Debug using VB Script or Perl Using CCS Scripting, a simple script can:

Start CCS Load a file Read/write memory Set/clear breakpoints Run, and perform other basic debug

functions

Page 30: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

TCONF Scripting (CDB vs. TCF)Tconf Script (.tcf)

/* generate cfg files (and CDB file) */

prog.gen(); • Textual way to create and configure CDB files

• Runs on both PC and Unix• Create #include type files (.tci)• More flexible than Config Tool

• Textual way to create and configure CDB files

• Runs on both PC and Unix• Create #include type files (.tci)• More flexible than Config Tool

/* load platform */utils.loadPlatform(“ti.platforms.dsk6416”);config.board("dsk6416").cpu("cpu0").clockOscillator = 600.0;

/* make all prog objects JavaScript global vars */utils.getProgObjs(prog);

/* load platform */utils.loadPlatform(“ti.platforms.dsk6416”);config.board("dsk6416").cpu("cpu0").clockOscillator = 600.0;

/* make all prog objects JavaScript global vars */utils.getProgObjs(prog);

/* Create Memory Object */

var myMem = MEM.create("myMem");

myMem.base = 0x00000000;

myMem.len = 0x00100000;

myMem.space = “data";

/* Create Memory Object */

var myMem = MEM.create("myMem");

myMem.base = 0x00000000;

myMem.len = 0x00100000;

myMem.space = “data";

Technical TrainingOrganization

T TO

Page 31: Using Code Composer Studio Chapter 2 C6000 Integration Workshop Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization

ti

Technical TrainingOrganization