Use of TI DSP Integrated Development Environment CCS[Copy link]
This post was last edited by fish001 on 2018-6-14 21:53 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 currently 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 emulator 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 can be combined 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 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 a dialog box for selecting a device driver. Step 6: Save the system configuration. Open the "File" menu, click the "Save" button, save the system configuration in the system register, and complete the system configuration of CCS. 3. Common file names and application interfaces in CCS 1. Common file names *.cmd —— link command file; *.obj —— target file generated by compiling or assembling source files; *.out —— executable file formed after compiling, assembling, and linking, which can be debugged and executed under CCS monitoring. 2. Application interface 4. 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 in 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 the 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 folder volume1 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 project configuration and several files used in the project. You can see it in the "Project View". 2. Add files to the project A project includes source programs, library files, link command files, and header files. 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 in 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 for setting the 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 assembly 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 may have 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. Volume.h should now appear in the Libraries folder in the Project View window. 6) Click the small plus sign + to the left of Project. This will expand the project list: volume1.pjt, Libraries, and Source. This list is the Project View. You do not need to manually add include files to the project because CCS will automatically find them during the compilation process. After compilation, the include files will appear in the Project View. To remove a file from the project, right-click the file and select Remove from project from the 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.Viewing the Source Code Double-click on volume.c in the project view to view the source code in the right window of CCS. Note the following parts of the program: After entering the main function, a message is printed and an infinite loop is entered. In the loop, the program calls dataIO and some other processing functions. 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 except return. We will not use C code to complete the I/O here, but use a probe point in CCS to read data from the file on the host and place it in 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 just compiled in the dialog box, and click Open to open it. (The default is in the directory c:\ti\myprojects\volume1\Debug\ folder) In this way, 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 label area at the bottom of the window to display the output sent to stdout by the program. 4) Select ViewMixed Source/ASM, and you will see the C source code and the assembly result code at the same time. 5) Click an assembly pseudo instruction in the mixed mode window and press F1, CCS will search for help for the instruction. 6) Select DebugGo Main to start executing the program from the main function. The program pauses at main and is marked with a yellow arrow. 7) Select DebugRun or click the tool button (Run) to run the program. 8) Select DebugHalt 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 introduction, 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, type FILEIO in the Define Symbols field, and press the Tab key. (Note: The compile command in the upper part of the window contains 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 File Load 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 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 In the process of 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 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 the breakpoint has been set (red dot icon). If the selection margin is disabled (set with OptionCostomizeEditor Properties), the selection line is highlighted in pink. (Use OptionCostomizeColor to change the color.) 4) Select ViewWatch Window. A separate area will appear in the lower right corner of CCS. This area displays the values of the watch variables while the program is running. The local watch label Watch Locals is selected by default to display the local variables in the currently executed function. 5) If the program does not stop at main, select DebugGo Main. 6) Select Debug Run, 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 observed. 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 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 with data, such as a graphics display window. In this section, probes are used to transfer host file data to the target board as test data. In addition, breakpoints are used 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 at the statement in the main function: dataIO(); The dataIO() function is here as a placeholder (a function with no 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 to draw a small blue diamond to indicate that the probe has been set up. If the border selection does not work, you can use Option Customize Editor Properties to set it up, 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 the input and output files. 6) Under the File Input tab, click Add File. 7) Browse to the volume1 project folder you 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 values of a sine waveform.) The sine.dat control window appears. When executing the program, you can use this control window to start, stop, rewind, and fast forward through 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. The Wrap Around option causes 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 contains only 1000 values 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 on VOLUME.C line 61 No Connection to highlight it. 11) In the Connect To field, click on the drop-down arrow and select sine.dat from the list. 12) Click Replace so that the Probe Point list shows 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. Displaying Graphs If you run the program now, the results will not be displayed. Set the 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 appears. 4) Right-click in the Input graph window and select Clear Display from the pop-up menu. 5) Select View Graph Time/Frequency from the menu 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 graph window. Right-click in the window and select Clear Display from the pop-up menu. V. Experimental Operations Students follow the above steps to complete the experimental operations and become familiar with the use of CCS. c. 3) Place the cursor at the statement in the main function: dataIO(); Here the dataIO() function is a placeholder (a function with no functionality). This function is now a convenient place to set up the probe so that data can be passed in from the host. 4) Click the tool button (Toggle Probe Point) and select the border to mark a small blue diamond-shaped dot, indicating that the probe has been set up. If the border selection does not work, you can use Option Customize Editor Properties to set it up, 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 the input and output files. 6) Under the File Input tab, click Add File. 7) Browse to the volume1 project folder you 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 values of a sine waveform.) The sine.dat control window appears. When executing the program, you can use this control window to start, stop, rewind, and fast forward through 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. The Wrap Around option causes 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 contains only 1000 values 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 on VOLUME.C line 61 No Connection to highlight it. 11) In the Connect To field, click on the drop-down arrow and select sine.dat from the list. 12) Click Replace so that the Probe Point list shows 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. Displaying Graphs If you run the program now, the results will not be displayed. Set the 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 appears. 4) Right-click in the Input graph window and select Clear Display from the pop-up menu. 5) Select View Graph Time/Frequency from the menu 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 graph window. Right-click in the window and select Clear Display from the pop-up menu. V. Experimental Operations Students follow the above steps to complete the experimental operations and become familiar with the use of CCS. c. 3) Place the cursor at the statement in the main function: dataIO(); Here the dataIO() function is a placeholder (a function with no functionality). This function is now a convenient place to set up the probe so that data can be passed in from the host. 4) Click the tool button (Toggle Probe Point) and select the border to mark a small blue diamond-shaped dot, indicating that the probe has been set up. If the border selection does not work, you can use Option Customize Editor Properties to set it up, 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 the input and output files. 6) Under the File Input tab, click Add File. 7) Browse to the volume1 project folder you 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 values of a sine waveform.) The sine.dat control window appears. When executing the program, you can use this control window to start, stop, rewind, and fast forward through 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. The Wrap Around option causes 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 contains only 1000 values 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 on VOLUME.C line 61 No Connection to highlight it. 11) In the Connect To field, click on the drop-down arrow and select sine.dat from the list. 12) Click Replace so that the Probe Point list shows 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. Displaying Graphs If you run the program now, the results will not be displayed. Set the 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 appears. 4) Right-click in the Input graph window and select Clear Display from the pop-up menu. 5) Select View Graph Time/Frequency from the menu 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 graph window. Right-click in the window and select Clear Display from the pop-up menu. V. Experimental Operations Students follow the above steps to complete the experimental operations and become familiar with the use of CCS. C line 61 No Connection is highlighted. 11) In the Connect To field, click the drop-down arrow and select sine.dat from the list. 12) Click Replace and the Probe Point list will show that the probe is connected to the sine.dat file. 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 Graphs 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, there is a lot of data to watch, and it only shows the data, 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 View Graph Time/Frequency again. Change the Graph Title to Output and the Start Address to out_buffer. Leave the rest of the values as default. 6) Click OK, and the Output graph window will appear. Right-click in the window and select Clear Display from the pop-up menu. V. Experimental operation Students should complete the experimental operation according to the above steps and become familiar with the use of CCS. C line 61 No Connection is highlighted. 11) In the Connect To field, click the drop-down arrow and select sine.dat from the list. 12) Click Replace and the Probe Point list will show that the probe is connected to the sine.dat file. 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 Graphs 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, there is a lot of data to watch, and it only shows the data, 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 View Graph Time/Frequency again. Change the Graph Title to Output and the Start Address to out_buffer. Leave the rest of the values as default. 6) Click OK, and the Output graph window will appear. Right-click in the window and select Clear Display from the pop-up menu. V. Experimental operation Students should complete the experimental operation according to the above steps and become familiar with the use of CCS.