Skip to main content
ssk
Associate III
October 1, 2015
Question

Using preprocessor directive

  • October 1, 2015
  • 3 replies
  • 1001 views
Posted on October 01, 2015 at 14:11

Hello,

I want to use a pre-processor directive for conditional compilation. 

I have a piece of code which I want to include when a pre-processor directive is defined. Where to define this in SPC5Studio? Which settings are required for this?

Thanks in advance for your reply.

Mike.
    This topic has been closed for replies.

    3 replies

    Erwan YVIN
    ST Technical Moderator
    October 1, 2015
    Posted on October 01, 2015 at 16:38

    Hello Mike ,

    You can define in the Platform component  by -D<DIRECTIVE_NAME> in CPP options

          Best regards

                       Erwan

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    ssk
    sskAuthor
    Associate III
    October 5, 2015
    Posted on October 05, 2015 at 13:32

    1. I tried using the -D under cpp options. I wrote -D PASS1 and my code contains following statement,

    #if defined(PASS1)

    #define Toggle_Pin() palTogglePad(PORT_B, TICK);

    #endif

    With above option, I am expecting the above code should get enabled when I debug it. But I see that this part of code is disabled as it is not getting the required macro definition. Can you please clarify how to achieve this?

    2. Which document/user guide has this information listed for different build or runtime settings?

    Thanks.

    Mike.

    Erwan YVIN
    ST Technical Moderator
    October 6, 2015
    Posted on October 06, 2015 at 11:36

    Hello Mike ,

    CPP Options is for C++ Compiler

    C options is for C Compiler

    please use C Option , generate, and compiler

    the different build / runtime settings are described in SPC5 Property description

    SPC5studio is using the hightec compiler

    there are several documents in this directory

    c:\SPC5Studio\eclipse\plugins\com.st.tools.spc5.tools.hightec.win32_1.0.0.201306281422\hightec\docs\

    Best regards

    Erwan

    ________________

    Attachments :

    2015-10-06_113313.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htf0&d=%2Fa%2F0X0000000aVU%2FaH6hXC2Y6vhF0xoAJONryCd6ndbHQy_R7r0w9TSKU0s&asPdf=false
    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.