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.
To create a CCS project select
File->New->CCS Project.
Figure 1: Screenshot of CCS Project menu
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
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
If there are any project dependencies they are selected on the next screen. Select the
Next button.
Figure 4: CCS Project dependencies
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
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:
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
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
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 10: DSP/BIOS features selection
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
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 13:
Figure 14: DSP/BIOS configuration tool showing the trace LOG object
Next insert a task (TSK) object and give it the name
TSK0.
Figure 15: Inserting a TSK object
Figure 16: TSK object
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"
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
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
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.
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
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
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
Now the target configuration is in the project.
Figure 22: Project files
To start a debug session either select
Target->Debug Active Project or press the debug icon in the menu bar.
Figure 23: Debug icon
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
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
Icons on the debug window can be used to run the program and other debugging tools.
Figure 26: Debugging tools
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/