1854 views|0 replies

6593

Posts

0

Resources
The OP
 

Use of TI DSP Integrated Development Environment CCS [Copy link]

1. Introduction to CCS

CCS is an integrated development environment for TMS320 series DSP . Under the Windows operating system, it uses a graphical interface and provides tools such as environment configuration, source file editing, program debugging, tracking and analysis. CCS has two working modes:

1. Software simulator mode: It can simulate the instruction set and working mechanism of DSP on PC without DSP chip , which is mainly used for early algorithm implementation and debugging.

2. Hardware online programming mode: It can run in real time on the DSP chip and combine with the hardware development board to program and debug the application online.

This experiment mainly uses the software simulator mode.

2. CCS system configuration

Steps to configure the system using the standard configuration file:

Step 1 : Start the CCS configuration program. Double-click the Setup CCS shortcut icon on the desktop and a dialog box pops up.

Step 2 : Clear the previously defined configuration.

Step 3 : Select the configuration file that matches the target system.

Step 4 : Add the selected configuration file to the system configuration.

Step 5 : Install the driver. Click " Intall a Device Driver " and a dialog box for selecting a device driver will pop up.

Step 6 : Save the system configuration. Open the " File " menu and click the " Save " button to save the system configuration in the system register to complete the CCS system configuration.

3. Commonly used file names and application interfaces in CCS

1. Common file names

*.cmd —— link command file;

*.obj —— The target file generated by compiling or assembling the source file;

*.out —— The executable file formed after compilation, assembly and linking, which can be debugged and executed under CCS monitoring.

2. Application interface

IV. Experimental Examples

1. Create a new project

Use CCS to create a new project, and then add source code files and library files to the project.

1) The installation directory of CCS is c:\ti . First , create a new folder under the folder c:\ti\myprojects\ and name it volume1 .

2) Copy the contents of the c:\ti\tutorial\target(sim54xx or dsk5402 , etc. )\volume1 folder to the newly created folder.

3) Start CCS . If necessary, configure CCS to work in C54x simulator mode.

4) Select New from the Project menu of CCS . The Project Creation dialog box will appear . In the dialog box , enter volume1 in the " Project Name " field , browse to the location of the volume1 folder created in the first step in the " Location " field , select Executable ( .out ) type in the " Project Type " field, and select the target DSP type configured by CCS in the " Target " field. Finally, click " Finish " to complete.

5) Through the above steps, Code Composer Studio has created a project file named volume1.pjt , which is used to store the project configuration and several files used in the project. You can see it in the "Project View " window.

2. Add files to the project

An engineering project includes source programs, library files, link command files, header files, etc.

1) In CCS , select the menu Project Add Files to Project , then select the file volume.c and click Open . (You can also right-click the project icon and select Add Files to Project from the shortcut menu , or drag the file into the folder in the project view window.)

2) In CCS , select the menu Project Add Files to Project , and select the assembly source file ( *.a*, *.s* ) in the file type selection box, then select the two files vectors.asm and load.asm and click Open . These files contain some assembly instructions for setting the reset RESET interrupt to the C entry point c_int00 of the program . (For more complex programs, you can define more interrupt vectors in the vectors.asm file. You can also use DSP/BIOS to automatically define all interrupt vectors.)

3) In CCS , select the menu Project Add Files to Project , and select the link command file ( *.cmd ) in the file type selection box , then select volume.cmd and click Open . This command file maps the assembler program segments to the DSP 's memory space.

4) In CCS , select the menu Project Add Files to Project , enter the compiled library folder ( c:\ti\c5400\cgtools\lib ), select the target file type and library file type ( *.o*, *.lib ) in the file type selection box , select the rts.lib file for the configured target DSP and click Open . This library file provides runtime support for the target DSP . (For some target DSPs , the runtime library can be a more special file name, such as rts_ext.lib .)

5) In the Project View window, right-click the project file volume.pjt and select Scan All Dependencies from the shortcut menu . At this time, volume.h should appear in the Libraries folder in the Project View window .

6) Click the small plus sign + on the left side of Project to expand the project list: volume1.pjt , Libraries , and Source . This list is the project view. There is no need to manually add include files
to the project , because CCS will automatically find these files during the compilation process. After compilation, these include files will appear in the project view .
If you want to remove a file from the project, just right-click the corresponding file and select Remove from project in the pop-up shortcut menu .
When compiling, CCS searches for project files in the following paths in sequence: the folder containing the source files; the folders listed from left to right in the compiler or assembler options.

3. View source code

Double-click volume.c in the project view to view the source code in the right window of CCS .

Please note the following sections in this program:

After entering the main function, a message is printed and an infinite loop is entered. In the loop body, the program calls dataIO and some other process functions.

In the processing function, multiply each value in the input buffer by the gain and place the result in the output buffer . The program will also call the assembly load routine, which consumes instruction cycles according to the value passed to it by processingLoad .

In this example, the dataIO function does not do anything except return. We do not use C code to complete I/O here , but use a probe Probe Point in CCS to read data from the host file and put it into the inp_buffer area.

4. Compile and run the program

Steps to compile and run the program:

1) Select Project Rebuild All or click the tool button ( Rebuild All ). CCS recompiles and links all files in the project. The compilation process information is displayed in the window at the bottom of CCS .

2) By default, the .out file is generated in the debug subdirectory of the current project directory . The storage location of the generated file can be changed through the CCS toolbar.

3) Select File Load Program , and select the file volume1.out just compiled in the dialog box , and click Open to open it. (The default directory is c:\ti\myprojects\volume1\Debug\ .) CCS will then load the program into the target DSP and open a disassembly window to display the corresponding disassembly instructions. CCS will also automatically open a tab area at the bottom of the window to display the output sent to stdout by the program.

4) Select View Mixed Source/ASM to see both the C source code and the assembly result code.

5) Click an assembly pseudo-instruction itself in the mixed mode window and press the F1 key. CCS will search for help for the instruction.

6) Select Debug Go Main to start executing the program from the main function. The program pauses at main and is marked with a yellow arrow.

7) Select Debug Run or click the tool button ( Run ) to run the program.

8) Select Debug Halt to pause program execution.

9) Select Mixed Source/ASM from the View menu. You will see the C code without the corresponding assembly . This will make it easy to proceed to the next task: modify the program options and correct the syntax errors.

5. Modify and run the program

In the previous introduction, the section of the program surrounded by the preprocessor commands (#ifdef and #endif ) will not be executed because FILEIO is not defined . In this section, we will set a preprocessor option in CCS .

1) Select Project Build Options .

2) In the Compiler tab of the Build Options window, select Processor from the list , type FILEIO in the Define Symbols field , and then press the Tab key.
(Note: The compile command in the upper part of the window includes the option -d . The statement after #ifdef FILEIO in the program will be included when you compile again . Other options will also change depending on the DSP board used.)

3) Click OK to save the new option settings.

4) Select Project Rebuild All or click the tool button ( Rebuild All ). Whenever you change the project options, you must recompile all files.

5) Select File Load Program and select the volume1.out file . (You can also load it automatically after compiling by selecting Option Customize , clicking the Program Load Options tab, and then selecting Load Program After Build Option .)

6) Select Debug Go Main to start executing the program from the main function. The program pauses at main and is marked with a yellow arrow.

7) Select Debug Run or click the tool button ( Run ) to run the program.

8) Select Debug Halt to pause program execution.

6. Use breakpoints and variable observation windows

When developing a test program, you often need to view the value of a variable during program execution. Breakpoints and variable observation windows are used to achieve this purpose. After reaching a breakpoint, use the single-step execution command.

1) Select File Reload Program .

2) Double-click the volume.c file in the project view to open the code window. Place the cursor on the following statement line:
dataIO ;

3) Click the tool button ( Toggle Breakpoint ) or press F9 . The selection area (the gray vertical bar on the left side of the editing area) indicates that the breakpoint has been set (red dot icon). If the selection area is disabled (set with Option Costomize Editor Properties ), the selected line is highlighted in pink. (Use Option Costomize Color to change the color.)

4) Select View Watch Window . A separate area will appear in the lower right corner of CCS , which displays the values of the variables being watched while the program is running. The local watch tab Watch Locals is selected by default , which displays the local variables in the currently executing function.

5) If the program does not stop at main , select Debug Go Main .

6) Select Debug Run , or press F5 , or the icon.

7) Select the Watch1 tab. Click in the Name column and type dataIO , which is the name of the variable to be watched.

8) Click the white area of the watch window to save. The variable value will be displayed immediately.

9) Click the tool button ( Step Over ) or press F10 several times to jump to the call to dataIO ().

10) Click ( Remove All Breakpoints ).

7. Add probes (test points) for file I/O

Using probes to read data from files in a computer is very useful for algorithm development. Probe usage:

Transfer the data in the host file (e.g. generated by Matlab ) to the buffer of the target DSP board for use by the corresponding algorithm.

Take the calculation output from the target board's buffer and store it in a file on the host for analysis.

Used to update a window, such as a graphics display window, with data.

This section uses the probe to transfer the host file data to the target board as test data. In addition, when the probe position is reached, breakpoints are used to update all open windows.

1) File Load Program , select volume1.out , and click Open .

2) Double-click the project view file volume.c .

3) Place the cursor in the main function at the statement: dataIO ();
Here the dataIO () function is a placeholder (a function without any functionality). This function is now a convenient place to set up the probe to pass data from the host.

4) Click the tool button ( Toggle Probe Point ) and select the border area to mark a small blue diamond dot, indicating that the probe has been set. If the border area selection is invalid, you can use Option Customize Editor Properties to set it, highlight the line in blue, and use Option Customize Color to change the color.

5) Select File I/O from the File menu . The File I/O dialog box appears to allow you to select input and output files.

6) Under the File Input tab, click Add File .

7) Browse to the created volume1 project folder and select sine.dat and click Open . (You can select the data file format under the file type item. The sine.dat file contains the hexadecimal value of a sine waveform . ) Then the sine.dat
control window appears . When executing the program, you can use this control window to start, stop, rewind, and fast forward in the data file.

8) In the File/IO dialog box, change Address to inp_buffer , change Length to 100 , and check the Wrap Around box.

The Address field defines where the data from the file should be placed. inp_buffer is an integer array of size BUFSIZE declared in volume.c ( BUFSIZE is a constant defined in volume.h .)

The Length field defines how many samples can be read from the data file at each probe point. Since the constant BUFSIZE is defined in volume.h as ( 0x64 ), the Length field is set to 100 here .

The Wrap Around option causes CCS to start reading from the beginning of the file again when it reaches the end of the file. This allows the data file to be viewed as a continuous stream of data, even though the file contains only 1000 values of data and the probe reads 100 values at a time.

9) Click Add Probe Point to make the Probe Points tab appear in the Break/Probe Points dialog box .

10) In the Probe Point list, click VOLUME.C line 61 No Connection to highlight it.

11) In the Connect To field, click the drop-down arrow and select sine.dat from the list of files .

12) Click Replace and the Probe Point list will show that the probe is connected to the file sine.dat . Click OK and the File I/O dialog box will now show that the file is connected to the probe. Click OK to close the File I/O dialog box.

8. Display graphics

If you run the program now, the results will not be displayed. You can set the observation variables to observe the data in the addresses associated with the inp_buffer and out_buffer arrays. However, you need to observe a lot of data, and only the data is displayed, not the corresponding curve graph (waveform graph).

CCS provides a variety of ways to visualize the data processed by the program.

1) Select View Graph Time/Frequency from the menu .

2) In the Graph Property dialog box, change Graph Title to Input , Start Address to inp_buffer , Acquisition Buffer Size to 100 , Display Data Size to 100 , DSP Data Type to 16-bit signed integer , Autoscale to Off , and Maximum Y-value to 1000 .

3) Click OK and an Input graphics window showing the Input Buffer will appear.

4) Right-click in the Input graph window and select Clear Display from the pop-up menu .

5) Select View Graph Time/Frequency again . Change Graph Title to Output and Start Address to out_buffer . Leave the rest of the values as default.

6) Click OK to display the Output graphics window. Right-click in the window and select Clear Display from the pop-up menu .

V. Experimental Operation

Students follow the above steps to complete the experiment and become familiar with the use of CCS .

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list