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.

How to add a pre-defined symbol with command line build?

Other Parts Discussed in Thread: CCSTUDIO

Hi,

I'm building my project with either the full CCS environment (my development environment) or with the command line scripts (like explained on http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create --> that's my build machine environment)

  • In order to use a single project file for both environments, I simply import the existing project file during my headless build, with the com.ti.ccstudio.apps.projectImport command and then build it with projectBuild.
  • But now I would like to be able to distinguish between development builds (done in CCS) and my automated command line builds: I would like to define the pre-defined macro AUTOMATED_BUILD for the command line build.
  • In order to make sure the developper using CCS always use the correct configuration (without the AUTOMATED_BUILD variable), I also want to limit me to a single configuration in this project.
So the question is: is there a way, during the import or the build done with the command line scripts, to automatically define my extra pre-defined macro?
The only option I found until now is  -ccs.defineBuildVariable, but only usable with com.ti.ccstudio.apps.projectCreate, not with projectImport or projectBuild.
Thanks for your help or suggestions.
  • Hi Stephane,

    Stephane Mainier said:
    In order to make sure the developper using CCS always use the correct configuration (without the AUTOMATED_BUILD variable), I also want to limit me to a single configuration in this project.

    One of the main purposes of supporting multiple build configurations is for use cases as yours where you wish to easily maintain build options. But I understand you wish to avoid this so:

    Stephane Mainier said:
    So the question is: is there a way, during the import or the build done with the command line scripts, to automatically define my extra pre-defined macro?

    Not by default with the command line build utility. If you want to add a preprocessor define variable outside the CCS environment before you build, you can try modifying the .*project files directly or define it in an options file that get included in the build. The options file is basically a text file which has additional build options. You can manually add/remove "--define=AUTOMATED_BUILD". This method is probably easier to deal with.

    If I think of any more suggestions, I'll let you know.

    Thanks

    ki

  • Thanks for the suggestion, the external option file might be the solution that answer my needs.

  • Could you explain what is an 'options file' and how to use it in CCS?

    Thank you,
    Piotr
  • The options (or command) file is basically a text file which has additional build options that is read by the compiler. The file is passed to the compiler via the flag:

    --cmd_file=filename

    For more information, see Section 2.3.2 of the Compiler User's Guide:

    http://downloads.ti.com/docs/esd/SPNU151/index.html

    To use it in CCS, use the field in the project properties as shown below:

    Thanks

    ki