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.

Compile and Link CCS Project with command lines

I am working on the unit testing for a C2000 MCU project developed in CCS v5. I have to specify the pre-process, compiler, and linker command separately to build the instrumented code in Vectorcast software. I copied the corresponding command lines from CCS build settings (i.e. cl2000  <summary of flags set>). And it seems to work fine to build the project. But it is found that some macros were not defined, such as __TMS320C28X__ ., which results in some problems for 64-bits types.


I check the wiki page about build the project with command line. But It uses eclipsec. The compiler and linker flags are not shown explicitly. I am wondering what is the correct way to identify those commands/flags?

Thanks.

  • Hello,

    The best thing to look at is the contents of the build output window. It should show the exact full command passed to the command line to build.

    Thanks

    ki

  • Thanks for the reply. The build output shows same compile and linking flags that I used. But the macros such as _ _TMS320C28XX_ _ are still not defined in the build in the unit testing environment. Wondering if there are any flags I missed? Or maybe there are some flags that are implicit in CCS?

    Thanks

  • Pass in:

    -D_ _TMS320C28XX_ _

  • Yeah, that works if it is defined explicitly. But build in CCS doesn't defined it and those macros are always predefined after a device is chosen  in properties->general-> Device. It looks .ccsproject or .cproject contains the device information. Is there a flag used to include the project settings?

    Thanks

  • Usually when you pick the device variant, it will add some additional flags like the macro you are mentioning. However it should appear in the project properties and definitely in the build output. Everything the project is passing to the actual build tools is in the build output.

  • Here is the build output. Wondering where could be the macros defined?

    Thanks

    **** Build of configuration Debug for project HelloWorld ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building file: ../hello.c'
    'Invoking: C2000 Compiler'
    "C:/ti/ccsv5/tools/compiler/c2000_6.1.6/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -g --include_path="C:/ti/ccsv5/tools/compiler/c2000_6.1.6/include" --preproc_with_compile --preproc_with_line --diag_warning=225 --display_error_number --diag_wrap=off  "../hello.c"
    'Finished building: ../hello.c'
    ' '
    'Building target: HelloWorld.out'
    'Invoking: C2000 Linker'
    "C:/ti/ccsv5/tools/compiler/c2000_6.1.6/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -g --preproc_with_compile --preproc_with_line --diag_warning=225 --display_error_number --diag_wrap=off -z --stack_size=0x300 -m"HelloWorld.map" --warn_sections -i"C:/ti/ccsv5/tools/compiler/c2000_6.1.6/lib" -i"C:/ti/ccsv5/tools/compiler/c2000_6.1.6/include" --reread_libs --display_error_number --diag_wrap=off --xml_link_info="HelloWorld_linkInfo.xml" --rom_model -o "HelloWorld.out"  "./hello.obj" "../28346_RAM_lnk.cmd" -l"libc.a"
    <Linking>
    'Finished building target: HelloWorld.out'
    ' '

    **** Build Finished ****

  • Wei Guo58 said:
    Wondering where could be the macros defined?

    In the project build properties:

  • Please revisit the post and my question. You don't need to define the macros like "__TMS320C28XX__" and they are always pre-defined if built in CCS. Those macros were discussed in user guide of "TMS320C28x Optimizing C/C++
    Compiler v6.2.4", Literature Number: SPRU514G. Section 2.5.1.

  • Wei,

    _ _TMS320C28XX_ _ is a predefined macro maintained by the compiler if the target is a C28x. So if the option -v28 is passed to the compiler, this macro should be predefined. Please see the Compiler Users Guide (section 2.5.1) for a complete list of predefined macros.

  • Thanks for clearing that up Aarti!

  • Yeah, they are defined in built in CCS. Though I tried to build the project with command lines with the same compiler options, -v28 ... This macros will no longer be defined in the build. I was wondering where is the problem.

    Thanks

  • Wei Guo58 said:
    Though I tried to build the project with command lines with the same compiler options, -v28 ... This macros will no longer be defined in the build. I was wondering where is the problem.

    Can you send us a test case that shows the problem?

  • Hi AartiG:

    Thanks for the reply. This was fixed when I include "-v28" in unit testing preprocessor options. Thank you!