ccsqrefer

download ccsqrefer

of 7

Transcript of ccsqrefer

  • 8/6/2019 ccsqrefer

    1/7

    TMS320C62X (C54X) Code Composer StudioSIMULATOR

    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 andAssembly language programs, so also view C and its corresponding Assembly

    language Code.

    Application Building Features: Code Composer Studio shows the basic process usedto create, build, debug and test the programs on the target DSP Simulator.

    Application Debugging Features: Code Composer Studio provides Debuggingfeatures 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 Projectis that the C source file forBPSKmodulator 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 isviewed through by the use of graphical plots.

  • 8/6/2019 ccsqrefer

    2/7

    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 languagesource code),

    2. Assembler (It translates assembly language source files into machine languageobject 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, sourcefilenames and dependencies),

    2. project.cmd e.g., hello.cmd (It is a linker command file which maps SECTIONS toMEMORY and is essential),

    3. program.asm e.g., vectors.asm (It contains assembly language instructions needed toset 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 processorof 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,

    (ReferTexas Instruments TMS320C6000 (C5000) Code Composer Studio Tutorial).

    An Experimental use of the Code Composer Studio

    From the WindowsStartMenu, Click ProgramsCode Composer Studio Compile C6000

    (C5000), Click CCStudio. For the first time to start with CCS Click Ignore. The

    Parallel Debug Manager window appears where in Click OpenC6xxx Simulator(C54x

    Simulator) or else directly Code Composer Studio Simulatorwindow appears. The sample

    program begins by creating theproject(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.

  • 8/6/2019 ccsqrefer

    3/7

    I.) Creating a new Project:

    In the Code Composer Studio Simulator menu, Go to Project ClickNew, 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, ClickNew 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, ClickAdd Files to Project. Select bpsk.c

    and ClickOpen.

    2.) SelectProject, ClickAdd Files to Project. Select vectors.asm and ClickOpen.3.) Select Project, Click Add Files to Project. Select linker command file

    hello.cmd from the c:\ti\c6000\tutorial\hello1 (c:\ti\c5400\tutorial\hello1) folder.

    4.) Select from the menu,ProjectAdd Files to Project. Select rts6201.lib (rts.lib)and Click Open, which resides in c:\ti\c6000\cgtools\lib (c:\ti\c5400\tutorial\

    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 theProject View, Click + sign which

    expands and forms like a tree structure showing the details of entire files residing in the

    Project.

    III.) File Description:

    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.

  • 8/6/2019 ccsqrefer

    4/7

    IV.) Compilation, Building and Running the Program:

    Click on the source file (bpsk.c) to be compiled.

    1.) Go toProjectCompile, wait for some time and if any error occurs, message isnormally shown in the Output windowat the bottom of the menu. In the source

    file after correcting the errors, and once again save it by FileSave so as to

    compile again.

    2.) After successful compilation, Go toProjectBuildorRebuild all,Once build completes without any error, in the Output windowit 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, ClickLoad Program. The program that was just rebuild, ClickOpen and Select *.out e.g., hello1.out. After loading the hello1.out file, Code

    Composer Studio opens upDis-Assembly windowshowing 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 atthe 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, ClickHaltor Press Shift F5 for termination if required in theprocess to be halted.

    6.) Step commands of the code composer studio like Step Into (or press in theKeyboard 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:

    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).

  • 8/6/2019 ccsqrefer

    5/7

    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 Users

    Guide).

    Go to menu and select FileData, ClickLoad. Load Data dialog boxappears,

    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 Clickopen.Loading File

    into Memory dialogappears wherein enter theAddress fieldas out_buffer and length

    to be 300 say since that data is of 300 samples and Click OK. Similarly if the

    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 ClickGraphTime/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 (referTexas Instruments TMS320C6000 (C5000) Code

    Composer Studio Tutorial).

    3.) Type in theDSP 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 theProject, Go toProjectClose.Please refer to the source file (bpsk.c) and modulated waveform for BPSK using the

    generated data file (bpsk.dat) mentioned below.

  • 8/6/2019 ccsqrefer

    6/7

    /* 'C' Source for a BPSK Modulator in

    TMS320C62X (C54X) CCS Simulator */

    #include #include #define pi 4.0*atan(1.0)#define BUFSIZE 300int 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 datafile to be specified based on the data type where firstfour digits are fixed so called Magic Number, since 4 ismentioned as the samples are of floating point type*/

    for(bits=0;bits

  • 8/6/2019 ccsqrefer

    7/7

    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