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.

CCS/TMS320F28335: Pre-define NAME option question

Part Number: TMS320F28335


Tool/software: Code Composer Studio

CCS V5.3.0 is used for F28335 development.The question is about: Show Build settings -> Build -> C2000 Compiler -> Advanced Options -> Predefined Symbols -> Pre-define NAME

1)I want to confirm whether following example expression is correct for "Pre-define NAME":

CANOPEN

#define CANOPEN    2

CANOPEN=2

2)In fact, I want to achieve following function, is it possible to use "Pre-define NAME"? then I could use different "Build Configurations" for project build.

#if CANOPEN == 0

#if CANOPEN == 1

#if CANOPEN == 2

 

thanks

 

  • sir zhang23 said:

    1)I want to confirm whether following example expression is correct for "Pre-define NAME":

    CANOPEN

    This is correct.  It defines the preprocessor name CANOPEN, but does not assign it a value.  You would test it with lines like 

    #ifdef CANOPEN
    
    /* ... or ... */
    
    #ifndef CANOPEN

    sir zhang23 said:
    #define CANOPEN    2

    Incorrect.  Do not use the #define syntax in this context

    sir zhang23 said:
    CANOPEN=2

    Correct.  This defines the preprocessor name and assigns it the value 2.

    sir zhang23 said:
    2)In fact, I want to achieve following function, is it possible to use "Pre-define NAME"? then I could use different "Build Configurations" for project build.

    Correct.  Different build configurations can assign different values to CANOPEN, and you can test those values in the C source.

    Thanks and regards,

    -George