DSP

Code Composer Studio v4 DSP/BIOS Project

2019-07-13 11:26发布

Introduction

This module describes how to create a Code Composer Studio (CCS) project that executes a simple DSP/BIOS based program. The target will be the TI simulator and the processor used is the TMS320C67xx.

Create a DSP/BIOS CCS project

To create a CCS project select File->New->CCS Project. Figure 1: Screenshot of CCS Project menu Figure 1 (graphics1.png) This will bring up a window where you can enter the name of the project. The location selected is the default location for project files. Press Next.   Figure 2: CCS Project name and location Figure 2 (graphics2.png)   Since the example uses the TMS320C67xx processor the project type selected is C6000. The project configurations are Debug and Release. Select the Next button.   Figure 3: Type of CCS project Figure 3 (graphics3.png)   If there are any project dependencies they are selected on the next screen. Select the Next button.   Figure 4: CCS Project dependencies Figure 4 (graphics4.png)   On the Project Settings Screen, select the items that pertain to the type of project to be created. Since the project will be executed select Output Type: Executable. The processor type is TMS320C67xx so the Device Variant is Generic C67xx Device. This project will use Little Endian. The code generation tools are the latest version (in this case TI v7.0.3). The runtime support library is selected to match the device variant and the endianness selected. The library can be selected automatically. Press Next.   Figure 5: Project settings window Figure 5 (graphics5.png)   Since the project will be based on DSP/BIOS an empty DSP/BIOS example project. This will set up project parameters for DSP/BIOS. Figure 6: Figure 6 (graphics6.png) After the projects settings have been set, select Finish and the project will show up in the C/C++ Projects view. Figure 7: C/C++ projects view Figure 7 (graphics7.png)

Add a DSP/BIOS configuration file

The easiest way to set up DSP/BIOS in a CCS project is to use the DSP/BIOS configuration tool. This generates a file with a .tcf extension that is included in the project. This file will generate code that gets included in the project for setting up DSP/BIOS. It also generates a header file that can be included in other C/C++ files. For the file name dspbiosproject.tcf the header file name will be dspbiosprojectcfg.h. To create a DSP/BIOS configuration file, select File->New->DSP/BIOS v5.xx Configuration File (you may need to select File->New->Other first, then select DSP/BIOS v5.xx Configuration File). This will bring up a dialog where the name of the file is entered. Figure 8: DSP/BIOS Configuration file name Figure 8 (graphics8.png) There are default configuration files for different devices. For this example the C67xx simulator is used. The configuration will have 16Mbytes of SDRAM in the memory section. Select Next and a dialog for the DSP/BIOS features will come up.   Figure 9: DSP/BIOS platform for default settings Figure 9 (graphics9.png)   Figure 10: DSP/BIOS features selection Figure 10 (graphics10.png) Select Finish and a new file is created with the default configuration and is added to the project and the configuration tool is opened. Figure 11: DSP/BIOS configuration tool Figure 11 (graphics11.png) In the configuration tool is where the DSP/BIOS objects are set up. In this example there are only two objects that will be set up. The first is a trace log that is common to many DSP/BIOS projects. The second is a task object that will be used to print to the log. To set up the LOG object, expand the Instrumentation item and right click on the LOG item. Select Insert LOG and give the LOG object the name trace. Figure 12: Insert LOG menu item Figure 12 (graphics12.png) Figure 13: Figure 13 (graphics13.png) Figure 14: DSP/BIOS configuration tool showing the trace LOG object Figure 14 (graphics14.png) Next insert a task (TSK) object and give it the name TSK0.   Figure 15: Inserting a TSK object Figure 15 (graphics15.png)     Figure 16: TSK object Figure 16 (graphics16.png)   In order for the TSK object to be associated with a function the Task function name must be changed. Right click on the TSK0 object and select Properties. Under the Function tab, type _funTSK0. Be sure to include the underscore at the beginning of the name. The C program function name will be funTSK0 but the assembly code name will have an underscore at the beginning. Be sure to note that the name of the task object and the name of the function that it uses cannot be the same name. In this example the object name is TSK0 and the function name if funTSK0. After the objects have been set up, save and close the configuration file. When your project gets built, the configuration file automatically generates files. One of these files is a header file that can be used in your programs. If your configuration file is named file.tcf then the header file that gets made will be called filecfg.h. In the source files that use the DSP/BIOS object this header file can be included. Use a statement like: #include "filecfg.h"

Add code files

When using DSP/BIOS in a project, very little code is in the main function. Other objects are used like tasks and interrupts. In this example a simple task will be made that prints to a LOG buffer. Create a new C program file. Select File->New->Source File.   Figure 17: New source file Figure 17 (graphics17.png)   The New Source File dialog opens and you can enter the source file name. Add a .c extension for a C program file. The source folder should be the folder of your project. Select Finish and a new file is opened. Figure 18: New source file dialog Figure 18 (graphics18.png) Enter the C code. The file must contain a main function. After entering the code, save the file. #include #include #include #include "dspbiosprojectcfg.h" //header generated by dspbiosproject.tcf void main(void){ LOG_printf(&trace,"In main function"); return; } void funTSK0(void){ LOG_printf(&trace,"In TSK0"); return; } In the code above, note that the header file dspbiosprojectcfg.h is included. This is the header file generated by the DSP/BIOS configuration file. Also, the function funTSK0 is the function that will be executed when TSK0 gets scheduled to run.

Create a target configuration

In order to build and run your project you need to have a target configuration. This file will contain information about the emulator that will be used and the target processor. In this module the target configuration will be the TI simulator for the C6713 processor. First select File->New->Target Configuration File. Figure 19: Open new target configuration file Figure 19 (graphics19.png) In the New Target Configuration dialog enter the configuration file name ending in the .ccxml file extension. Put the file in the project directory. Select Finish and a new target configuration file opens.   Figure 20: Target configuration dialog Figure 20 (graphics20.png)   In the target configuration, select the connection needed (simulator or some type of emulator, etc.) and the type of device. In this example the TI simulator is used with the C6713 little endian simulator device. Select Save when done. Figure 21: Target configuration setup Figure 21 (graphics21.png) Now the target configuration is in the project.   Figure 22: Project files Figure 22 (graphics22.png)  

Debug the project

To start a debug session either select Target->Debug Active Project or press the debug icon in the menu bar. Figure 23: Debug icon Figure 23 (graphics23.png) When the debug session starts the code files are compiled and linked into an executable file and the file is loaded onto the target. The initialization code is executed and the program is halted at the beginning of the main function. Figure 24: Debugging session Figure 24 (graphics24.png) In order to be able to see the LOG print text the real time analysis (RTA) data stream must be turned on. Select Tools->RTA->Print Logs which will open up the LOG print window. Select the Stream RTA data button on the right part of the menu bar. The icon is depressed in the figure.   Figure 25: Turn on the RTA data stream Figure 25 (graphics25.png)   Icons on the debug window can be used to run the program and other debugging tools. Figure 26: Debugging tools Figure 26 (graphics26.png) Press the green arrow to run the program. The main function will be executed and the program will leave the main function. After the main function executes the TSK0 object is schedule and the tsk0 function is executed. Both functions print to the trace LOG object. The output can be viewed in the Printf Logs window. http://cnx.org/content/m36660/latest/