E2 studio optimization settings.

Hello Forum,

How does one change the optimization setting in the e2 studio tool so that as you are single stepping though code, you dont have variables getting optimized out?



  • Hello Matt,

    go to:
    Project > Properties > C/C++ Build > Settings > Tool Settings tab > Optimization > Optimization Level
    and choose "None (-O0)" or "Optimize for debug (-Og)".

    You may also refer to the adboc's answer in following thread for detailed description:


  • Hello Matt,

    Anper's answer should solve your problem for most part. Sometimes stack variables are marked "optimized out" when they're no longer relevant to their scope - compiled code will most likely release the stack allocated for this. For example:

    UINT status;

    status = my_function();
    if (0 == status) ...

    /* Some code not using "status" */

    will cause "status" to be not visible (i.e. "optimized out") after line with "if (0 == status)". Marking variable as "volatile" often ensures that stack is not released until it goes out of scope.

  • In reply to Renesas Karol:

    Hello Anper and Karol,

    Thank you both for the answers here. Ill give these a try.