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.

EK-TM4C123GXL: How to make CCS more debug friendly

Part Number: EK-TM4C123GXL

I declare my variable volatile and set optimization to none and it seems the compiler is still ditching code it does not think is useful. Out of frustration I output a debug variable to a GPIO pin just so it would persist. Is there no other way? Seems it would leave stuff alone if it a debug build instead of release.

  • Hi John,

    I declare my variable volatile and set optimization to none and it seems the compiler is still ditching code it does not think is useful.

    The behavior (e.g. code got removed or optimized out) you describe does not pertain to the "volatile" qualifier. The volatile keyword is intended to prevent the compiler from applying any optimizations on objects that can change in ways that cannot be determined by the compiler. Objects declared as volatile are omitted from optimization because their values can be changed by code outside the scope of current code at any time. It should not remove the code. Without declaring volatile, you may see the processor read from the register instead of from the memory.  It seems to me the variable that you declare as volatile is perhaps set but not used anywhere in your application and that is why it is optimized out. Normally, the compiler will give you a warning if this is the case. In any case, please share your code so I can take a look. 

    Seems it would leave stuff alone if it a debug build instead of release.

      Can you show your build settings for the "Release" mode? By default, there is no difference between "Debug" and "Release" modes. Both has the optimization set to 2. 

      

  • Hi John,

      Is this problem resolved? I will close this thread for now. If the problem is not resolved, simply just update this post and the thread will automatically reopen. 

  • I set optimization to off else the dubugger jumps all over the page, up and down so you really can;t tell where it is stopping.