Use of TI DSP Integrated Development Environment CCS[Copy link]
CCS is an integrated development environment for DSP chip development launched by TI. It uses a Windows-style interface and integrates editing, compiling, linking, software simulation, hardware debugging and real-time tracking functions. It greatly facilitates the development and design of DSP chips and is one of the most widely used DSP development software. 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 be separated from the DSP chip and simulate the instruction set and working mechanism of DSP on the PC, which is mainly used for early algorithm implementation and debugging. 2. Hardware online programming mode: It can run on the DSP chip in real time and combine with the hardware development board to program and debug the application program online. This experiment mainly uses the software simulator mode. 2. CCS system configuration Steps for system configuration using standard configuration files: Step 1: Start the CCS configuration program. Double-click the Setup CCS shortcut icon on the desktop to pop up a dialog box. 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" to pop up the dialog box for selecting the device driver. 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 system configuration of CCS. III. Common file names and application interfaces in CCS 1. Common file names *.cmd —— link command file; *.obj —— target file generated by compiling or assembling the source file; *.out —— executable file formed after compiling, assembling and linking, which can be debugged and executed under CCS monitoring. 2. Application interface IV. Experimental example 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 the New submenu 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 the 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 A project includes source code, 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, select 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 to set the reset RESET interrupt to the C entry 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, select Link Command File (*.cmd) in the File Type selection box, then select volume.cmd and click Open. This command file maps the assembly program segments to the DSP's memory space. 4) In CCS, select the menu Project Add Files to Project, go to the compiled library folder (c:\ti\c5400\cgtools\lib), select the target file type and library file type (*.o*, *.lib) in the file type selector, 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 specific 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 + to the left 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 compiling, 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 from the pop-up shortcut menu. When compiling, CCS searches for project files in the following paths: the folder containing the source files; the folders listed from left to right in the compiler or assembler options. 3. View the source code Double-click on volume.c in the project view to view the source code in the right window of CCS. Please note the following parts of the program: After entering the main function, a message is printed and an infinite loop is entered. The program calls dataIO and some other processing functions in the loop body. In the processing function, each value in the input buffer is multiplied by the gain and the result is placed 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 nothing other than 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 ProjectRebuild 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 will be generated in the debug subdirectory under the current project directory. The storage location of the generated file can be changed through the CCS toolbar. 3) Select FileLoad Program, and select the file volume1.out that has just been compiled in the dialog box, and click Open to open it. (The default is in the directory c:\ti\myprojects\volume1\Debug\ folder) CCS will 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 F1. 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 makes it easy to proceed to the next task: modify program options and correct syntax errors. 5. Modify and Run the Program In the previous section, the program section surrounded by the preprocessor commands (#ifdef and #endif) will not be executed because FILEIO is not defined. In this section, you will set a preprocessor option in CCS. 1) Select ProjectBuild Options. 2) In the Compiler tab of the Build Options window, select Processor from the list bar, type FILEIO in the Define Symbols field, and press the Tab key. (Note: The compile command in the upper part of the window includes the option -d. When you compile again, the statements after #ifdef FILEIO in the program will be included. Other options will also change depending on the DSP board used.) 3) Click OK to save the new option settings. 4) Select ProjectRebuild All or click the tool button (Rebuild All). Whenever you change the project options, you must recompile all files. 5) Select FileLoad Program and select the file volume1.out. (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 indicated by 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 and testing programs, you often need to view the values of variables during program execution. You will use breakpoints and variable observation windows to achieve this purpose. After reaching a breakpoint, use the single-step execution command. 1) Select File Reload Program. 2) Double-click the file volume.c 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 margin (the gray vertical bar on the left side of the editing area) indicates that a breakpoint has been set (red dot icon). If the selection margin is disabled (set using OptionCostomizeEditor Properties), the selected row is highlighted in pink. (Use OptionCostomizeColor to change the color.) 4) Select ViewWatch Window, and a separate area will appear in the lower right corner of CCS, which displays the values of the watch variables while the program is running. By default, the local watch tab Watch Locals is selected to display the local variables in the currently executed function. 5) If the program does not stop at main, select DebugGo Main. 6) Select DebugRun, or press F5, or the icon. 7) Select the Watch1 tab. Click in the Name column and type dataIO, that is, type 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. Adding Probes (Test Points) for File I/O Using probes to read data from files on the computer is very useful for algorithm development. Probes are used to: Transfer data from a host file (such as generated by Matlab) to the target DSP board's buffer for use by the algorithm. Take the calculation output from the target board's buffer and place 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 probes to transfer host file data to the target board as test data, and also uses breakpoints to update all open windows when the probe location is reached. 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 used as a placeholder (a function with no functionality). Now this function is a convenient place to set up probes 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 select the input and output files. 6) Under the File Input tab, click Add File. 7) Browse to the volume1 project folder created 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.) The sine.dat control window then 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, modify 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 are 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. The Wrap Around option allows CCS to read 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 only contains 1000 values of data and the probe reads 100 values at a time. 9) Click Add Probe Point so that the Probe Points tab of the Break/Probe Points dialog box appears. 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 file list. 12) Click Replace so that the Probe Point list will display the probe and file sine.dat is already connected. 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. Displaying the Graph If you run the program now, the results of the program will not be displayed. You can set watch variables to watch the data in the addresses associated with the inp_buffer and out_buffer arrays. However, you need to watch 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 the menu View Graph Time/Frequency. 2) In the Graph Property dialog box, change the 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 graph 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 the menu View Graph Time/Frequency again. Change the Graph Title to Output and the Start Address to out_buffer. Leave the other values as default. 6) Click OK to display the Output graph 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 experimental operation and become familiar with the use of CCS.