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.

adding Definitions to compiler.opt

Hi,

I'm searching for a function to add definitions to the compiler.opt file from the SYS/Bios .cfg file.

I tried the following without success:

var Main = xdc.useModule('xdc.tools.configuro.Main');
 var params = new Main.Params// Instance config-params object;
params.compileOptions  = "-DMYDEFINE";  

Is there an other way to insert such definitions into the compiler.opt file, or is something wrong with this code?

Thanking you in anticipation,

Sebastian

  • Sebastian,
    you can't change compiler.opt from the CFG script. The main purpose of the CFG script is to generate a C source file that is added to your app, but the options for compilation are determined earlier. But, there are ways to change compiler options for each step of the build. Where do you want your additional options to be used?
    If you need to add -DMYDEFINE to the compile line that builds the generated C file, you can do it by going to Project->Properties->CCS Build->XDCtools->Advanced Options->Additional compile options.
    If you need to add -DMYDEFINE to your sources, you can do it in Project->Properties->CCS Build->Compiler->Advanced Options->Predefined Symbols.

  • Thank you for the answer,

    Too bad, it does not work with CFG script.
    I'm working with several "static Library" Projects, that all have the RTSC Project as a dependency (Project properties > Build > Dependencies) and can be included in multiple "Executable" Projects. I just wanted to omit including "xdc/cfg/global.h" in every source file/project. Is there an other way to share compiler options or definitions automatically between CCS Projects?

  • Sebastian,
    you may want to ask in the CCS forum how to share compiler options between projects. I can't move your thread to that forum, but you probably can.
    I am sorry, I can't remember any RTSC property that would let you configure compile options for dependent projects.