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.

Compiler/TMS570LS1224: Recommended Compiler Optimization level

Part Number: TMS570LS1224

Tool/software: TI C/C++ Compiler

We are starting a new safety critical project.  We want to set the optimization level now and freeze it for the duration of the project to avoid surprises down the road.  In the past,  I have used level 0, which gave me the most consistent behavior.  However,  I get a recommendation within code composer to set to level 3, which from my past experience can lead to unexpected behavior such as optimizing out global variables that may change via an interrupt.(Yes I know these should be declared volatile).   We do not have any performance or code issues at the moment and so I prefer our debug capability to not be impacted too much.  What optimization level do you recommend?  Thanks.

  • Jana Fernando60 said:
    We want to set the optimization level now and freeze it for the duration of the project to avoid surprises down the road.

    There is no optimization level at which any vendor can guarantee there will never be any surprises.

    I think you should use the highest level, --opt_level=4.  But I understand why you might hesitate.

    The article Debug versus Optimization Tradeoff has some discussion on this point.

    Thanks and regards,

    -George