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/TDA2PXEVM: CCS incorrectly grays out #ifdef blocks

Part Number: TDA2PXEVM

Tool/software: Code Composer Studio

Code Composer Studio 8.0.0.00016 appears to incorrectly gray out #ifdef blocks. At first I assumed this was due to a conflict between project settings and build settings, since I was using an ad-hoc CCS project that is used to view code but not build it, because I am running a makefile project based on Processor SDK Vision 3.0.3. However, the problem persists when I close the project and just look at code loaded through debugger symbols. It is confusing and inconvenient to be given the impression that certain code will or will not execute, only to find out that is incorrect when stepping through the code.

The following screen shot gives an example:

Note that code under #ifdef IPU_PRIMARY_CORE_IPU1 is grayed out, however, this code is running on primary core IPU1. Furthermore, line 197 highlighted in green indicates that line 197 is the active line about to execute, despite the compiler's indication that this line should not be reached.

It appears that this is a bug. If so, I hope reporting it here will help speed its resolution. However, if there is a way to resolve or mitigate this issue, I would appreciate it.

One possibility I can imagine is that the code index file may control the highlighting. If so, it may be possible to correct it by including an extra header file with the right definitions. However, #definitions in different modules may not be the same, and getting these outputs from the complex build system has proven difficult.

Thanks for your help.

  • There is no possible way for the C/C++ editor to know whether these defines are actually defined in your code. So it will always think it's inactive code. See below screenshot:

    If the shading annoys you, you can always disable the inactive code highlighting. See below screenshot:

    Or you can play with the colors and set up a custom theme where the #ifdefines will be highlighted in white (i.e. not greyed out) while the inactive code is still enabled. Does that make sense?

    Thanks

    Alex

  • Hi Alex,

    Is it correct that the inactive code highlight feature knows about #defines that are included or defined in a particular file, but not those specified on the command line by the build process? If so, it would be handy to print a list of all the command line #defines from the build process. Is there a good way to do this for Processor SDK Vision 3.0.3? I experimented with this a bit, but got lots of copies of some settings and none of others.

    Thanks.

  • Hello,

    TG2718 said:
    Is it correct that the inactive code highlight feature knows about #defines that are included or defined in a particular file, but not those specified on the command line by the build process?

    Sounds like it's doing what it is intended to highlight since the build arguments are not really known prior to the build. I mean, all CCS is using is the standard eclipse based C/C++ GUI editor, so it's not really a particular feature specific to CCS or the Processor SDK.

    However, just came across this thread ( e2e.ti.com/.../673610 ). I haven't tried it but sounds like it is a similar thing to what you are asking. Basically, maybe you can add the compiler flags to the list in the XDCTools, that way it will know what will be defined and will not grey out lines. Try it and let us know.

    TG2718 said:
    If so, it would be handy to print a list of all the command line #defines from the build process. Is there a good way to do this for Processor SDK Vision 3.0.3?

    There is the makerules_spec.doc that lists these build options. It's located in "VisionSDK\vision_sdk\build\makerules\" folder.

    thanks,

    Alex

  • Hi Alex,

    The link you sent references the following settings: Project Properties->CCS Build->XDCTools->Advanced Options. However, I'm not seeing anything like that under the project properties or CCS preferences. Can you steer me in the right direction where to look, or what to do if it is not there? Is this something likely to work given that my project is really an SDK Vision makefile project, and can't actually be build from my CCS project, which just gives me a nice way to view the code?

    Thanks for the reminder about the makerules_spec.doc document.

  • TG2718 said:
    Can you steer me in the right direction where to look, or what to do if it is not there?

    I am not seeing it on my setup either. Looks like it wants the XDCTools installed. You can follow the guides on how to install/include these in your project.

    TG2718 said:
    Is this something likely to work given that my project is really an SDK Vision makefile project, and can't actually be build from my CCS project, which just gives me a nice way to view the code?

    My understanding is that when listed, these defines will be now known in the code editor and won't be greyed out anymore. But again I haven't personally tested it. 

    thanks,

    Alex

  • I believe I already have XDCTools installed since it is used with Processor Software Development Kit Vision/Radar. Where would I find out more about how to enable this feature or install XDCTools in some other way?

    Thanks.

  • Sure, here is a post that explains how to make sure the feature is known by the CCS environment.  

    thanks,

    Alex

  • If I go to CCS Window:Preferences:Code Composer Studio:Products, it lists 3 versions of XDC tools:
    3.50.5.12_core, 3.32.2.25_core, 3.32.1.22_core.

    Despite that, I don't see the other options referenced in your previous post. Any other ideas?

  • Sorry for the delay, let me ask around as I am not sure why you are still not the seeing XDS options despite having the tools installed. Somebody will reply here soon when we find the XDS expert.

    thanks,
    Alex
  • TG2718 said:
    Despite that, I don't see the other options referenced in your previous post.

    The XDCTools will appear in the Project Properties only for CCS projects, not for Makefile Projects. So unfortunately you cannot go down that path.

    As suggested in a previous post, you could try adding the preprocessor defines inside the source files to make it known to the editor, however I personally have not tested it with the Vision SDK either.

  • OK, thanks. Please let me know if you come up with anything further.

  • AartiG said:
    As suggested in a previous post, you could try adding the preprocessor defines inside the source files to make it known to the editor

    An alternative approach I have used for CCS 8 makefile projects is to add symbols on the C/C++ General -> Paths and Symbols. E.g.:

    These symbols add to the project get used by the Eclipse indexer, and thus the editor highlighting which greys-out #if blocks.

    When symbols are added to the Paths and Symbols dialogue they are saved in the .cproject file which can be placed under configuration control.

  • Thanks everyone!