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.

FUNCTION_OPTIONS pragma



I was wondering if there was more information on the following (new?) pragma. The following clip was found in SPRU187s.pdf (pg 158).

The FUNCTION_OPTIONS pragma allows you to compile a specific function in a C or C++ file with additional command-line compiler options. The affected function will be compiled as if the specified list of options appeared on the command line after all other compiler options. In C, the pragma is applied to the function specified. In C++, the pragma is applied to the next function.

The syntax of the pragma in C is:

#pragma FUNCTION_OPTIONS (func, "additional options");

I can't find any other information about this pragma. For example:

  • Would a common usage of this be to override the project/file-level compiler options for speed and code size options (-o, -ms) on a function level basis?
  • Are there any limitations on the options allowed in the "additional options".
  • Is there any documentation on how this is implemented in asm/linker?

Thanks,
Scott

  • sgspecker said:
    Would a common usage of this be to override the project/file-level compiler options for speed and code size options (-o, -ms) on a function level basis?

    Yes.

    sgspecker said:
    Are there any limitations on the options allowed in the "additional options".

    Yes.  There is a small list of options which are acceptable to use here.  If you specify an option not on that list, you get an error message.  The list ought to be documented.  But if you stick with options for optimization and the code size/speed trade-off, you'll be fine.

    sgspecker said:
    Is there any documentation on how this is implemented in asm/linker?

    I'm not sure what you mean.  Once the assembly is generated by the compiler, these options don't matter anymore.

    Thanks and regards,

    -George

  • Thanks for the feedback! As always, much appreciated.

    Georgem said:
    I'm not sure what you mean.  Once the assembly is generated by the compiler, these options don't matter anymore.

    OK, you're right; it wouldn't make much difference after the compiler has finished. I guess what I meant to ask was whether there is another way to convey this type of information to the compiler, say, via the command line.

    Thanks,
    Scott

  • Is this pragma also planned for the C2000 compiler?

    It would be VERY convenient to do optimization on function and not on file level...

  • It will be in the 6.0.0 release planned for the end of March.

    Thanks and regards,

    -George

  • Are there some news regarding the 6.0 release?

    It was planned for end of March, but does not seem to be out until now  - when will it be released?

  • The 6.0.1 compiler tools release is now available for download via CCS4 update manager. In CCS4, go to Help->Software Updates->Find and Install. Select "Search for new features to install". In the next dialog, choose Code Generation Tools Updates, and hit Finish. The 6.0.1 CGT should now be visible under C2000 Code Generation Tools, which you can select and install.

  • Ah, okay, we are still at CCS3.3. Is the 6.0.1 compiler available for CCS3.3, too?

  • Is the 6.0.1 compiler available for CCS3.3, too - or do we have to update to CCS4?

  • Stephan,

    Sorry for not replying sooner. The 6.0.1 compiler is not tested with CCS 3.3, hence not officially supported, and is the reason it is not posted on CCS3 Update Advisor. As we add new features and options into the compiler tools, the CCS build interface in CCS3 is no longer being updated to display these options. Also we are not going back and adding/testing support in the debugger for new coprocessor instructions etc. For instance, in CGT 6.0.x, there is new assembler support added for VCU coprocessor for newer c28x devices, and CCS3 will not have debug support for this.

    If you mostly plan to use features that existed in older versions of the CGT, and are ok with building on command line (or with some missing options in build interface), you should be ok using CGT 6.0.1 with CCS 3.3. However, please keep in mind that this is not a supported configuration, so it would be advisable to update to CCS4 as soon as it is feasible for your project schedule.

    I will send you a private message with the CGT 6.0.1.