Ccsqrefer

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

TMS320C62X (C54X) Code Composer Studio SIMULATOR

A Quick Reference Manual


Documented by: V. Kumar & Prof. R. V. Raja Kumar ---------------------------------------------------------------------------------------------------------------Description: The TMS320C6000 (C5000) platform of digital signal processors (DSPs) is part of the TMS320 family of DSPs. The TMS320C62X (C54X) device is a 16 bit fixed-point DSPs and has advanced very long instruction word (VLIW) architecture, with performance of upto 2400 (532) million instructions per second (MIPS) at 250 MHz clock speed. Here the main application and usage of this feature are described and would be convenient for the readers. Features: The features available in Code Composer Studio Simulator are Program Code Editing, Application Building and Application Debugging Features. Program Code Editing Features: Code Composer Studio allows editing C and Assembly language programs, so also view C and its corresponding Assembly language Code. Application Building Features: Code Composer Studio shows the basic process used to create, build, debug and test the programs on the target DSP Simulator. Application Debugging Features: Code Composer Studio provides Debugging features like Loading data, FILE IO, Watch Window, Graphing Signals, Setting up of Break points and usage of probe points, Viewing Disassembled and C instructions in the DSP Simulator. Aim of the Project is that the C source file for BPSK modulator is compiled and build with the use of Application Building and Debugging process to form an executable module. After successful build completes, this executable (*.out) file is loaded in the target DSP Simulator and viewed through the Output window. The resultant data generated from the source is viewed through by the use of graphical plots.

Before going to the experimentation with the code composer studio, it is essential to know about Code Generation Tools viz., 1. Compiler (C Compiler accepts C source code and produces assembly language source code), 2. Assembler (It translates assembly language source files into machine language object files) and 3. Linker (It combines object files into a single executable object module). The various file-naming conventions which are used in the program like, 1. project.mak e.g., hello1.mak - (It stores project information like build options, source filenames and dependencies), 2. project.cmd e.g., hello.cmd (It is a linker command file which maps SECTIONS to MEMORY and is essential), 3. program.asm e.g., vectors.asm (It contains assembly language instructions needed to set the RESET interrupt service fetch packets (ISFPs) to branch to the programs C entry point, c_int00), 4. filename.lib e.g., rts6201.lib (rts.lib) (Library files required for fixed point processor of C62X (C54X), 5. filename.h e.g., linkage.h, stdio.h, hello.h (header files for C programs), 6. program.c e.g., bpsk.c (C program source files), 7. program.obj e.g., bpsk.obj (object files compiled or assembled from the source file), 8. program.out e.g., hello1.out (executable program for the target - fully compiled, assembled and linked, this can be loaded to the target DSP simulator). For more detailed information on Code Generation Tools and file-naming conventions, (Refer Texas Instruments TMS320C6000 (C5000) Code Composer Studio An Experimental use of the Code Composer Studio From the Windows Start Menu, Click Programs (C5000), Click Code Composer Studio Compile C6000 Ignore. The C6xxx Simulator (C54x Tutorial).

CCStudio. For the first time to start with CCS Click

Parallel Debug Manager window appears where in Click Open

Simulator) or else directly Code Composer Studio Simulator window appears. The sample program begins by creating the project (hello1.mak) with Code Composer Studio and adding the Source files and Subroutines including the Assembly source (vectors.asm) Command files (hello.cmd) and Libraries - rts6201.lib (rts.lib) to the project.

I.)

Creating a new Project: In the Code Composer Studio Simulator menu, Go to Project Click New, a small window appears where enter in the File Type field as hello1.mak or any name and Click Save, so that hello1.mak preferably resides in c:\ti\c6000\tutorial\hello1 (c:\ti\c5400\tutorial\hello1) folder. It contains project information, which includes DSP/BIOS config, Include, Libraries and Source files that are required for execution.

II.)

Modification of a Project: After creating a new project (hello1.mak) the files which are to be added to the project (hello1.mak) are mentioned below. From the Code Composer Studio Simulator menu, Go to File, Click New Source File and save the file as bpsk.c, which has to reside in c:\ti\c6000\tutorial\hello1 (c:\ti\c5400\tutorial\hello1) folder. Thereby editing of C source file or any modification can be carried out in the right side of the CCS menu itself. 1.) From the menu, Go to the Project, Click and Click Open. 2.) Select Project, Click 3.) Select Project, Click Add Files to Project. Select vectors.asm and Click Open. Add Files to Project. Select linker command file Add Files to Project. Select rts6201.lib (rts.lib) Add Files to Project. Select bpsk.c

hello.cmd from the c:\ti\c6000\tutorial\hello1 (c:\ti\c5400\tutorial\hello1) folder. 4.) Select from the menu, Project hello1) folder. After creation of new project and adding files to it, second time when we invoke the project i.e., hello1.mak the Source files including the Assembly source, Command files and Libraries to the project files need not be added again. Subsequent modifications can be done on to the project (hello1.mak) by right clicking on to the existing source file (*.c) and removing it and there by adding a new source (*.c) file to the project. In the Project View, Click + sign which expands and forms like a tree structure showing the details of entire files residing in the Project. III.) File Description: and Click Open, which resides in c:\ti\c6000\cgtools\lib (c:\ti\c5400\tutorial\

Double Click on each of the Source files (*.cmd, *.asm, *.c, *.h) to view the entire code separately in the right side of the Project View window. (Refer Texas Instruments TMS320C6000 (C5000) Code Composer Studio Tutorial) for reviewing the code.

IV.)

Compilation, Building and Running the Program: 1.) Go to Project Compile, wait for some time and if any error occurs, message is Save so as to

Click on the source file (bpsk.c) to be compiled. normally shown in the Output window at the bottom of the menu. In the source file after correcting the errors, and once again save it by File compile again. 2.) After successful compilation, Go to Project Build or Rebuild all, Once build completes without any error, in the Output window it shows details of complete building process like asm6x -gs vectors.asm vectors.obj, cl6x -g -as bpsk.c, lnk6x -g as hello1.mak 3.) Go to File, Click Load Program. The program that was just rebuild, Click Open and Select *.out e.g., hello1.out. After loading the hello1.out file, Code Composer Studio opens up Dis-Assembly window showing a yellow bar pointing towards the starting of the instructions disassembled which makes up the program content. 4.) Select from the CCS menu; Go to Debug, Click Run or press (F5) we find at the bottom panel showing DSP RUNNING. It halts by showing DSP HALTED simultaneously we find in the Dis-Assembly window a yellow bar pointing the end of the program content. The o/p of the Source program can also be viewed in the Output window. 5.) Go to Debug, Click process to be halted. 6.) Step commands of the code composer studio like Step Into (or press in the Keyboard F8), Step Over (F10), Step Out (F7), Run to Cursor (Ctrl F10) are used to view the assembly instructions step by step in the Dis-Assembly window. V.) Loading the Data File: Halt or Press Shift F5 for termination if required in the

Code Composer Studio data file: The data file (bpsk.dat) which was just created, header information in the first line of the data file need to be specified that has been incorporated through the C Program itself. The header information for the data file uses the following syntax. (MagicNumber Format StartingAddress PageNum Length). 1.) Magic number - 1651 (fixed). 2.) Format - 1 (Hexadecimal), 2 (Integer), 3 (Long) and 4 (float).

3.) Starting Address - Starting address of the block that was saved. 4.) PageNum - Page number of the block taken from. 5.) Length - No of samples in the block. For additional information on these topics, (Refer Instruments TMS320C6000 (C5000) Code Composer Studio Guide). Go to menu and select File Data, Click Load. Load Data dialog box appears, open. Loading File OK. Similarly if the where select the data that was generated i.e., (bpsk.dat), depending on the type of data, select in the File of type field as (*.dat [float]) and Click to be 300 say since that data is of 300 samples and Click into Memory dialog appears wherein enter the Address field as out_buffer and length Source has more data file then same procedure mentioned above can be followed. VI.) Viewing the Graphs: Code Composer Studio provides a way to graph the signals being processed by the program. After loading the data at the address location, now to view the plots, 1.) Go to View Click Graph Time/Frequency. 2.) In the Graph Property Dialog box, specify any Graph title as per users wish say result and also change the Start Address field as out_buffer which is similar to one that was given at the time of loading data file. For further details on graph changing property please (refer Texas Instruments TMS320C6000 (C5000) Code Composer Studio Tutorial). 3.) Type in the DSP data type field as 32-bit IEEE floating point. 4.) Click O.K to the Graph Property Dialog box, a graph window for the output Buffer appears and data values plotted are seen. 5.) The procedure is same for subsequent data file to be viewed through. 6.) To close the Project, Go to Project Close. Users

Please refer to the source file (bpsk.c) and modulated waveform for BPSK using the generated data file (bpsk.dat) mentioned below.

/* 'C' Source for a BPSK Modulator in TMS320C62X (C54X) CCS Simulator */ #include <stdio.h> #include <math.h> #define pi 4.0*atan(1.0) #define BUFSIZE 300 int out_buffer[BUFSIZE]; void main() { int *output = &out_buffer[0]; int bits,samples_bit,a[6]; float bpsk; FILE *fp; fp=fopen("bpsk.dat","w"); a[0]=1,a[1]=-1;a[2]=-1; a[3]=1,a[4]=-1;a[5]=1; fprintf(fp,"1651 4 0 0 0\n");/*Header format of the data file to be specified based on the data type where first four digits are fixed so called Magic Number, since 4 is mentioned as the samples are of floating point type*/ for(bits=0;bits<6;bits++) for(samples_bit=0;samples_bit<50;samples_bit++) { if(a[bits] == 1) bpsk=100*sin(2*pi*samples_bit/25); if(a[bits] == -1) bpsk=-100*sin(2*pi*samples_bit/25); fprintf(fp,"%f\n",bpsk); printf("%f\n",bpsk); *output++=bpsk; /*Output data writing to a buffer*/ } fclose(fp); }

Fig. Shows BPSK modulated output using the DSP simulator Input bit stream of [1, 0, 0, 1, 0, 1] No of cycles per bit: 2 No of samples per cycle: 25 Max phase transition: 1800

You might also like