Скачать презентацию Using Code Composer Studio Chapter 2 C 6000 Скачать презентацию Using Code Composer Studio Chapter 2 C 6000

d6483dcdd2859ecaf40f30f30f7586f0.ppt

  • Количество слайдов: 31

Using Code Composer Studio Chapter 2 C 6000 Integration Workshop T TO Technical Training Using Code Composer Studio Chapter 2 C 6000 Integration Workshop T TO Technical Training Copyright © 2005 Texas Instruments. All rights reserved.

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

Code Composer Studio Asm Edit SIM Standar d Runtime Libraries Compiler Asm Opto Link Code Composer Studio Asm Edit SIM Standar d Runtime Libraries Compiler Asm Opto Link DSK. out Debug EVM DSP/BIOS Config Tool T TO Technical Training DSP/BIOS Libraries Third Party DSK’s Code Composer Studio Includes: Integrated Edit / Debug GUISimulator Code Generation Tools BIOS: Real-time kernel Real-time analysis XDS DSP Board CCS is Project centric. . .

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

What is a Project? Project (. PJT) file contain: References to files: Source Libraries What is a Project? Project (. PJT) file contain: References to files: Source Libraries Linker, etc … Project settings: T TO Technical Training Compiler Options DSP/BIOS Linking, etc … Let’s look more closely at Build Options and Configurations …

Compiler Build Options Nearly one-hundred compiler options available to tune your code's performance, size, Compiler Build Options Nearly one-hundred compiler options available to tune your code's performance, size, etc. Following table lists most commonly used options: Options Description -mv 6700 Generate ‘C 67 x code (‘C 62 x is default) -mv 67 p Generate ‘C 672 x code -mv 6400 Generate 'C 64 x code -mv 6400+ Generate 'C 64 x+ code -fr

Directory for object/output files -fs Directory for assembly files -g Enables src-level symbolic debugging Debug -ss Interlist C statements into assembly listing -o 3 Invoke optimizer (-o 0, -o 1, -o 2/-o, -o 3) Optimize (release) -k Keep asm files, but don't interlist Debug and Optimize options conflict with each other, therefore they should be not be used together T TO These can be set/modified by … Technical Training

Build Options GUI -g -fr“$(Proj_dir)Debug Build Options GUI -g -fr“$(Proj_dir)Debug" -d"_DEBUG" -mv 67 GUI has 8 pages of options for code generation tools Default build options for a new project are shown Basic page defaults are -g -mv 6700 T TO Technical Training To make options easier, TI recommends using …

Build Configurations -g -fr“$(Proj_dir)Debug Build Configurations -g -fr“$(Proj_dir)Debug" -d"_DEBUG" -mv 6700 -o 3 -fr“$(Proj_dir)Release" -mv 6700 For new projects, CCS automatically creates two build configurations: Debug (unoptimized) Release (optimized)

Build Configurations -g -fr“$(Proj_dir)Debug Build Configurations -g -fr“$(Proj_dir)Debug" -d"_DEBUG" -mv 6700 -o 3 -fr“$(Proj_dir)Release" -mv 6700 $(Proj_dir) Indicates the current project directory. This aids in project portability. See SPRA 913 (Portable CCS Projects) for more information. For new projects, CCS automatically creates two build configurations: Debug (unoptimized) Release (optimized)

Two Default Build Configurations -g -fr“$(Proj_dir)Debug Two Default Build Configurations -g -fr“$(Proj_dir)Debug" -d"_DEBUG" -mv 6700 For new projects, CCS automatically creates two build configurations: Debug (unoptimized) Release (optimized) Use the drop-down to quickly select build config. -o 3 -fr“$(Proj_dir)Release" -mv 6700

Two Default Build Configurations -g -fr“$(Proj_dir)Debug Two Default Build Configurations -g -fr“$(Proj_dir)Debug" -d"_DEBUG" -mv 6700 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 active 2. Modify build options (shown previously) 3. Save project -o 3 -fr“$(Proj_dir)Release" -mv 6700 T TO Technical Training

Linker Options Description -o<filename> -m<filename> -c -x Output file name Map file name Auto-initialize Linker Options Description -o -m -c -x Output file name Map file name Auto-initialize global/static C variables Exhaustively read libs (resolve back ref's) By default, linker options include the – o option -c -m "$(Proj_dir)Debuglab. map" -o"$(Proj_dir)Derecommend you We add the –m option “$(Proj_dir)Debug" indicates one subfolder level below project (. pjt) location $(Proj_dir)Debuglab. out Run-time Autoinit (-c) $(Proj_dir)Debuglab. map tells compiler to Run-time Autoinitialization T TO Technical Training initialize global/static variables before calling main()

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

DSP/BIOS Configuration Tool Simplifies system design by: T TO Technical Training Automatically includes the DSP/BIOS Configuration Tool Simplifies system design by: T TO Technical Training 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)

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

‘C 6000 C Data Types Type T TO Representation char short int long float ‘C 6000 C Data Types Type T TO Representation char short int long float double long double pointers Technical Training Bits 8 16 32 40 64 32 64 64 32 ASCII Binary, 2's complement IEEE 32 -bit IEEE 64 -bit Binary

Including Header Files in C /* * ==== Include files ==== */ #include <csl. Including Header Files in C /* * ==== Include files ==== */ #include #include #include "sine. h" #include "edma. h" 1. What is #include used for? It adds the contents of the header file to your C file at the point of the #include statement. 2. What do header (. h) files contain? Let's look at a header file. . .

Example Header Files /* /* * ==== sine. h ==== * ==== edma. h Example Header Files /* /* * ==== sine. h ==== * ==== edma. h ==== * This file contains prototypes for all * This file contains references for all * functions and global datatypes * functions contained in edma. c * contained in sine. c */ */ #ifndef SINE_Obj void init. Edma(void); typedef struct { void edma. Hwi(int tcc); float freq. Tone; extern EDMA_Handle h. Edma; float freq. Samp. Rate; float a; float b; float y 0; float y 1; float y 2; … } SINE_Obj; #endif 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. void copy. Data(short *inbuf, …); void SINE_init(SINE_Obj *sine. Obj, …); Most commonly, header files … contain: Function prototypes Therefore. . . Global data references, such

Including Header Files in C /* * ==== Include files ==== */ #include <csl. Including Header Files in C /* * ==== Include files ==== */ #include #include #include "sine. h" #include "edma. h" 1. What is #include used for? It adds the contents of the header file to your C file at the point of the #include statement. 2. What do header (. h) files contain? 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. 3. What is the difference between <. h> and “. h”? Angle brackets <. h> tell the compiler to look in the specified include path. Quotes “. h” indicate the file is located in the same location

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

Lab Exercises – C 67 x vs. C 64 x T TO Technical Training Lab Exercises – C 67 x vs. C 64 x T TO Technical Training Which DSK are you using? We provide instructions and solutions for both C 67 x and C 64 x. We have tried to call out the few differences in lab steps as explicitly as possible:

Lab 2 – Creating/Graphing a Sine Wave CPU buffer Introduction to Code Composer Studio Lab 2 – Creating/Graphing a Sine Wave CPU buffer Introduction to Code Composer Studio (CCS) Run, halt, step, breakpoint your program T TO Examine variables, memory, code Technical Training Create and build a project Graph results in memory (to see the sine wave)

Creating a Sine Wave A sine. c Generates a value for each output sample Creating a Sine Wave A sine. c Generates a value for each output sample t float y[3] = {0, 0. 02, 0}; float A = 1. 9993146; short sine. Gen() { y[0] = y[1] * A - y[2]; y[2] = y[1]; y[1] = y[0]; return((short)(28000*y[0]); } T TO Technical Training

Lab 2 Debrief 1. What differences are there in Lab 2 between the C Lab 2 Debrief 1. What differences are there in Lab 2 between the C 6713 and C 6416 solutions? 2. What do we need CCS Setup for? 3. Did you find the “clear. Arrays” GEL menu command useful? T TO Technical Training

Optional Exercises T TO Technical Training Lab 2 a - Customize CCS Lab 2 Optional Exercises T TO Technical Training Lab 2 a - Customize CCS Lab 2 b - Using GEL Scripts Lab 2 d - Float vs Fixed Point

Summary: CCS Automation T TO Technical Training GEL Scripting Command Window CCS Scripting TCONF Summary: CCS Automation T TO Technical Training GEL Scripting Command Window CCS Scripting TCONF Scripting

GEL Scripting T TO Technical Training GEL: General Extension Language C style syntax Large GEL Scripting T TO Technical Training GEL: General Extension Language C style syntax Large number of debugger commands as GEL functions Write your own functions Create GEL menu items

Command Window Some frequently used commands: help dlog alias take T TO Technical Training Command Window Some frequently used commands: help dlog alias take T TO Technical Training , a close. . . load reload reset restart ba

CCS Scripting Debug using VB Script or Perl Using CCS Scripting, a simple script 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

TCONF Scripting (CDB vs. TCF) Tconf Script (. tcf) /* load platform */ utils. TCONF Scripting (CDB vs. TCF) Tconf Script (. tcf) /* load platform */ utils. load. Platform(“ti. platforms. dsk 6416”); config. board("dsk 6416"). cpu("cpu 0"). clock. Oscillator = 600. 0; /* make all prog objects Java. Script global vars */ utils. get. Prog. Objs(prog); /* Create Memory Object */ var my. Mem = MEM. create("my. Mem"); my. Mem. base = 0 x 0000; my. Mem. len = 0 x 00100000; my. Mem. space = “data"; /* generate cfg files (and CDB file) */ prog. gen(); T TO Technical Training • Textual way to create and configure CDB files • Runs on both PC and Unix • Create #include type files (. tci) • More flexible than Config Tool

Technical Training Organization ti Technical Training Organization ti