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.

Disable optimization for function

Other Parts Discussed in Thread: CC3200

Hey,

I'm looking for a pragma or something like that so I could disable the optimizer for certain functions. I believe I found a function where the optimizer re-ordered the logic within it. The function held a sequence of commands to send for our co-processor and it looked like they were queued up in the wrong order.

I worked around it for now but wondering if there is an easy processor  macro I could use. 

My environment is CCS 6, TI-RTOS, for the CC3200 with O4 set for optimization level, TI 5.2.6 compiler, and the CC3200 1.1 SDK. 

Thanks. 

  • halfbit;drop said:
    I believe I found a function where the optimizer re-ordered the logic within it. The function held a sequence of commands to send for our co-processor and it looked like they were queued up in the wrong order.

    This is often due to the failure to use the volatile keyword on the variables for which access (read or write) may have system-wide effects beyond those of an ordinary memory access.  Please see this wiki article for more about volatile.

    A direct answer to your original question ... You can use the FUNCTION_OPTIONS pragma to lower the level of optimization used on the problem function.  Read about it in the ARM compiler manual.

    Thanks and regards,

    -George

  • Thanks, that is exactly what I was looking for.