get optimization level at compile time

Sysprogs forums Forums VisualGDB get optimization level at compile time

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #29864
    Johanan
    Participant

    Hi,

    Is there a way to know optimization level at compile time (STM32)? for example:

    //————————————-

    void _delay_us_x(int dly)
    {
    while (dly–)
    __NOP();
    }

    #if  (_OPTIMIZE_LEVEL_  ==  0)

    #define delay_us(x) _delay_us_x(x*4)

    #else

    #define delay_us(x) _delay_us_x(x*8)

    #endif

    //——————————————

    Thanks

    • This topic was modified 3 years, 10 months ago by Johanan.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.