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.

Pre-complie symbols from global.h not found

I have a follow on question (an extension to this thread http://e2e.ti.com/support/embedded/tirtos/f/355/t/191616.aspx)

I added this line in my .cfg file: Program.global.EVM_TEST = 1;
This created a #define EVM_TEST 0x1 definition in some _pe66.h file
This definition is accessible from my source file if I #include <xdc/cfg/global.h>

In my function I'm using this definition in two ways:

void Test()
{
     int array[EVM_TEST];

     #ifdef EMV_TEST
            Fxn1();
     #else
            Fxn2();
     #endif
}

This code segment compiles without giving me any errors. However, the CCS tool is showing me that Fxn2() is the call that is being made (the call to Fxn1() is greyed out).

NOTE: I actually just verified that Fxn1() is being called as expected. The tool is just displaying the information incorrectly. I'm using CCS 5.4.0.00091.

  • Rajan,

    Thank you for reporting this.  The improper greying out behavior is a known issue that has been raised with the CCS team.

    Scott 

  • Is it possible to have just the definition created with no value associated with it?

    Program.global.EVM_TEST = 1; We know this generates "#define EVM_TEST 0x1"

    How can I generate "#define EVM_TEST" from the cfg file?

  • Rajan,

    I asked more about this, and there isn’t a workaround to recommend to you to avoid the greying out by the editor.  I don't know all the details, but it is apparently due to an include file parsing issue when determining what the editor thinks is real code.  The problem is  triggered by some of the contents/nesting within xdc/cfg/global.h files.  The problem is being actively worked, but it is unclear when there will be a fix.

    Scott

  • Oh - I understand the issue with the editor. I appreciate you looking into it.

    In my previous post I was just asking if there was a way to have the statement that is generated not have a value.

    Program.global.EVM_TEST = 0;
    produces
    #define EVM_TEST 0

    What statement (if possible) will generate #define EVM_TEST (without the 0)?

    Doing Program.global.EVM_TEST; in the cfg file doesn't seem to work.

  • Rajan,
    currently there is no way to only generate
    #define EVM_TEST

    Can you tell me what's the problem with defining the replacement string?

  • There is no real problem with having the replacement string definition. In some of our legacy code we create definitions for components that are required for certain builds. So we use #ifdef and #ifndef throughout our code. Having a value wouldn't hurt anything really - just could add confusion if someone decides to change a definition from 0 to 1 but will have no impact on the final build.

    Alternatively, we could change to #if EVM_TEST == 0, etc to actually use the value.

  • I think you can easily ignore the value, and just keep using #ifdef and #ifndef. I was asking because there could be a convoluted solution where you would add -DEVM_TEST to your command line, but I don't think you need that here.