This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Creating C2000 Project Basics

Other Parts Discussed in Thread: TMS320F2802, CONTROLSUITE, SPRC191

Normal 0 false false false EN-US X-NONE X-NONE

I’m using Code Composer 4.2.1.  Here are the steps I’ve taken to create a new project:

 

File -> New -> CCS Project -> Project Name: “Kit F2802” -> Next -> Project Type: “C2000” -> Next -> Next -> Output type: “Executable”, Device Variant: “TMS320F2802”, Linker Command File: “automatic”, Runtime Support Library: “rts2800_ml.lib” -> Finish.

 

This creates a link to ccsv4/tools/compiler/c2000/include and it creates the file "2802_RAM_lnk.cmd". 

 

1) I presume the include dir contains the headers necessary for the library.  The library appears to be located at ccsv4/tools/compiler/c2000/lib.  Is this correct?


2) I created a simple main function.  Everything compiles fine. 

 

3) I heard that it is important to add to the project, “DSP280x_CodeStartBranch.asm”. (still compiles fine).  Is this correct?

 

4) I also heard “DSP280x_GlobalVariableDefs.c” need to be added (no longer compiles fine ... can't find DSP280x_Device.h).  Is this correct?

 

5) What are the steps to remove this compilation issue? Adding "DSP280x_Device.h" just leads to many other compile issues.

 

  • Hi Clyde,

    This wiki page is a very good starting point for CCS4 related problems and should guide you through your questions. This is another wikipage covering CCS4 in general.

    BR Andreas

  • I spent a lot of time the past two weeks trying to find this type of info on TI websites ... with little success.  I'd like a straight answer to my questions. 

  • Clyde,

    in your procedure step 4 the search path for the header file "DSP28xx_Device.h" is missing. These headerfiles are NOT part of the CCS - installation path; since they are device specific, they are stored under controlsuite - support files.

    I have attached an example from my workshops. It explains step by step how to setup a new project from scratch. The point you missed is at page 5  - top ("add additional precompiler search paths").

    Regards

     

     

    28335_Lab1_1.pdf
  • 6) I don't have the path shown on the top of page 5 on the pdf ... have not installed controlsSUITE.  Where do I find xxx_common\include and xxx_headers\include?

     

    7) Under Project -> Properties -> C/C++ Build -> Tool Settings (tab) -> C2000 Compiler -> Include Options -> "add dir to #include search path, etc", I see {CG_TOOL_ROOT} ... where is CG_TOOL_ROOT defined? 

     

    What is the answer to questions 3 and 4?

  • 6) try to install controlsuite, its a nice collection of lot of support files. If you don't like it, then you can install the legacy peripheral register header files manually. For the F28335, search for SPRC530, download and install it. It will produce folders, such as C:\tidcs\c28\DSP2833x\v131\DSP2833x_common. For other devices there are other literature numbers.

    4) This file defines all peripheral register variables as global variables. It's a way to bit-field access registers from C, based on structures and unions.

    3) The function of this file is usually linked into the code entry point an performs a branch into the C-runtime preparation function. This function is required to start the code exectuion directly from reset.

    7) I am not sure about this but I guess this macro is defined when you install CCS4 and gives the root location of the tools.

       

  • 7) CG_TOOL_ROOT is defined here: right-click on project root->Build propertier->Macros Tab->System Macros

     

    Andreas

  • 3) Ok, thanks.

     

    4) I presume it is good to include this file in the project?

     

    6) Last week I downloaded the appropriate SPRC F2802  file ... ended up with "tidcs\c28\DSP280x\v170\etc".  I added paths to the _common and _headers dirs.  When I compile, I get errors ... "run placement fails for object SpiaRegsFile", etc. 

     

    7) Thanks.

  • 4) Yes.

    6) is answered. New question 8) because this is a different error message: it is now a linker error.

    8)  If you use 4) then somebody must tell the linker where to place all the variables from 4)  into. That's the role of firl "DSP280x_Headers_nonBIOS.cmd", which must also be linked to your project. Explained in my pdf.

     

     

  • Thanks for the clarifications.  It's nice to communicate with someone who is knowledgeable! 

     

    9) To document what I've learned, after building the project, as described in the first post, I must:

    * Download "SPRC191" and run "setup_DSP280x_v170.exe" to create the DSP280x common and header files.

    * Add "DSP280x_CodeStartBranch.asm"

    * Add "DSP280x_GlobalVariableDefs.c"

    * Add an include path to "DSP280x_common/include"

    * Add an include path to "DSP280x_header/include"

    * Add "DSP280x_Headers_nonBIOS.cmd"

    Do I have this correct?

     

    10) I like to keep my code simple and easy to transport.  It appears I could also move to the project the files from "ccsv4\tools\compiler\C2000\include", "ccsv4\tools\compiler\C2000\lib", "tidcs\c28\DSP280x\v170\DSP280x_headers\include", and "tidcs\c28\DSP280x\v170\DSP280x_common\include".  Do I have this correct?

  • 10) I tried this ... the code compiles fine. I added "DSP280x_Gpio.c", "DSP280x_SysCtrl.c", and "DSP280x_usDelay.asm" .. still compiles fine.

     

    11) Under "Includes", it lists a path to "ccsv4\tools\compiler\C2000\include", even though I have moved this folder / files to my project.  How do I remove this include path?

     

    12) Where do I specify the path for libraries?

  • Hi Clyde

    If you want to have easy portable projects you might consider having a macros.ini file. within this file you can define macro variables that are imported into CCS4 together with your project. you can define relative paths in the macros.ini to build your very on environment. I know you would like to have a step by step description but I don't have the time to write it down - again there is a good wiki resource for this.

    12) right click project root->Build Properties-> Tool Settings -> C2000 Linker -> File Search Path

    BR Andreas

  • Hi Andreas,

    12) Thanks!

    13) To keep things simple for now, I reverted back to leaving directories in place (did not move them to the project), and added appropriate paths (C2000, common, and header include dirs) ... code compiles fine.  In main() I added InitSysCtrl() ...

    #include "DSP280x_SysCtrl.h"
    void main(void)
    {
        // Initialize the CPU (FILE: SysCtrl.c)
        InitSysCtrl();
        while(1)                           
        {
            asm(" NOP");
        }
    }//main

    Result: Error msg ... identifier "Uint16" is undefined. 

    Clyde

  • Hi Clyde,

    13) instead of including "DSP280x_SysCtrl.h" include "DSP280x_Device.h. This headerfile defines the datatypes and includes all the other necessary headerfiles.

    Andreas

  • 13) Ok.  Now I get a warning ... function declared implicitly. 

  • Clyde,

    The prototype for this function is missing... Have you got a file called DSP280x_GlobalPrototypes.h in your project? if not, include it. I do agree with you that even with controlSUITE it is a little messy with all the headers and stuff that needs to be included. I asked TI Guru's whether this will be sorted out - you can see their answer here.
    Because of the non trivial setup, the way to go for an easy start is taking one of the TI examples and adapt it to your needs. However for me that was never very satisfying, because it is hard to get the whole overview if you only copy...

    BR Andreas

  • Thanks Andreas.  It's satisfied after I added #include "DSP280x_GlobalPrototypes.h".  I also added DSP280x_Gpio.c to the project and added InitGpio() to main() ... still compiles fine. 

    14) I added  DSP280x_PieCtrl.c and DSP280x_PieVect.c to the project.  Now I get compile errors ... unresolved symbol _ADCINT_ISR, first referenced in ./Source/DSP280x_PieVect.obj.

  • Ok Clyde,

    DSP280x_DefaultISR.h is missing.....
    A tip for you: Import an example project for your target from TI (found in controlSUITE). In such a project, all the necessary files are included. In the specific case, you could open the file where the compile error occurs (DSP280x_PieVect.c), and search for the unresolved symbol (ADCINT_ISR). Right click on this symbol and select "Open Declaration" now the file where the Symbol is declared will open. This is exactly the one that is missing in your project.

    Hope the explanation was clear enough

    BR Andreas