Part 1: Set up common files
- Prior to creating projects, it is convenient to set up a directly of commonly used files for your projects. On my computer, I created a directory C:\Users\drb\Documents\workspace\common\ that I use to store these common files. You might want to set up something similar.
- One file that will probably be common to all of your projects is this linker command file. The linker command file tells CCS where to put your program, data, and other things like interrupt vectors, in the DSP's memory space. This file should work as-is, but you may want to modify it to try various options like putting the data into external RAM. Download this linker command file and put it in your directory of commonly used files.
Part 2: Create the CCS v4 project container
- These steps assume that you have correctly installed and configured CCS v4. You should be able to connect to the DSK and see the following window before proceeding.
- Click on "File->New->CCS Project". If this is the first time using CCS v4, you may have to click "File->New->Other" and then select CCS project. The following window should appear
This is where you name your project and choose a location for it. Here we are naming the project "stereoloop" (for reasons that will become clear later) and we are storing it in the default location. Click on "Next".
-
Now you need to select the type of project. Remember, CCS v4 can be used with lots of different targets, so we need to be explicit about the type of project.
In the Project Type pulldown, select "C6000". Leave the "Debug" and "Release" check boxes ticked. Click "Next".
-
Now you have the opportunity to reference other projects.
We don't have any other projects, so just click "Next".
-
Now you need to configure the project settings.
The "Output Type" should be "Executable". The "Device Variant" should be "Generic C67xx Device". The "Device Endianness" should be "little". Just go with the defaults on the "Code Generation Tools", "Output Format", and "Runtime Support Library". In the "Linker Command File", click "Browse" to select the linker command file you placed in the common folder. Do not click "Finish"! Instead, click "Next".
-
Now you have the opportunity to select a project template.
Select "Empty Project" and then click "Finish".
-
This is what it should look like after you've set up the project container.
You might have some other panels visible, but the C/C++ Projects panel should show the stereoloop project as "Active" and should show the linker.cmd file.
Part 3: Add source code to your project
- So far, we just have an empty project container with no code. To put some code in the project, download stereoloop.c and vectors.asm and move these files into your project directory.
CCS v4 will automatically add these files to your project.
- Here is what CCS v4 should look like after it recognizes that you moved the two source files into the project directory.
Note the presence of stereoloop.c, vectors.asm, and linker.cmd in the active stereoloop project.
Part 4: Tell CCS v4 where to find the CSL and BSL header files
- If we try to build the project now, we will get lots of errors because (among other things) CCS v4 doesn't know how to find the CSL and BSL header files and libraries. We'll first tell CCS v4 where to find the header files. Click on "Project->Properties" and select the "C/C++ Build" section in the left sidebar.
This is where we will configure CCS v4 to find the appropriate header files.
- In the "Tool Settings" tab, under the "C6000 Compiler" heading, select "Include Options"
Note that we can add directories to the #include search path here by pressing the button with the green plus sign.
- Press the button with the green plus sign to add the CSL header file directory
Note that your CSL header files might be in C:\Program Files\Texas Instruments\C6xCSL\include. Click "OK".
- Press the button with the green plus sign to add the BSL header file directory
Note that your BSL header files might be in C:\Program Files\Texas Instruments\DSK6713\c6000\dsk6713\include. Click "OK".
- Your properties window should now look like this.
Note the two directories that we added to the #include search path. Click "Apply" and then click "OK".
- The main window should now look like this.
Note the CSL and BSL include directories are now shown in the includes section.
Part 5: Include the CSL and BSL libraries in the project
- We now need to tell CCS v4 to include the CSL and BSL library files in the project. Just like before, click on "Project->Properties" and select the "C/C++ Build" section in the left sidebar.
- In the "Tool Settings" tab, under the "C6000 Linker" heading, select "File Search Path"
Note that we can include library files directly in the project by pressing the button with the green plus sign.
- Press the button with the green plus sign to add the CSL library
Note that your CSL library might be in C:\Program Files\Texas Instruments\C6xCSL\lib_3x\csl6713.lib. Click "OK".
- Press the button with the green plus sign to add the BSL library
Note that your BSL library might be in C:\Program Files\Texas Instruments\DSK6713\c6000\dsk6713\lib\dsk6713bsl.lib. Click "OK".
- Your properties window should now look like this.
Note the two libraries that we added to the project. Click "Apply" and then click "OK".
Part 6: Tell CCS what to use for stack and heap sizes
- You could now compile the project, but you would get some warnings about not explicitly setting the stack and heap sizes (CCS v4 will just go with some default values). We would like to get rid of these warnings. To do this, click on "Project->Properties" and select the "C/C++ Build" section in the left sidebar.
- In the "Tool Settings" tab, under the "C6000 Linker" heading, select "Basic Options"
Put in values of 0x400 for stack size and 0x400 for heap size (these should be fine for ECE4703 projects). Click "Apply" and then click "OK".
Part 7: Tell CCS to use a "far" memory model
- There is still one more thing to fix before CCS v4 will cleanly compile the project. Click on "Project->Properties" and select the "C/C++ Build" section in the left sidebar.
- In the "Tool Settings" tab, under the "C6000 Compiler" heading, select "Runtime Model Options"
Set the "Constant access model" and "Data access model" both to "Far". Click "Apply" and then click "OK".
Part 8: Build and run the project
- If you've followed all of the steps above, you should be able to build the project without errors or warnings. Click on "Project->Build Active Project". You should see something like this:
- Click the "Debug Launch" button. This will cause the executable output of the build to be loaded onto the DSK and put the instruction pointer of the DSP at the start of your code. In the Debug window, press the Run button.
Any music played into the line-in input of the DSK will be passed through to the line-out and headphone outputs. Try it. You can halt the code anytime by pressing the Halt button (looks like pause). When the DSP is running, you should hear music. When the DSP is halted, you should not hear music.
- Congratulations. At this point, you have a template that you can use for the remaining assignments in ECE4703.