how to use the optimization of the codewarrior

Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use the optimization of the codewarrior

Contributor I

hello all,

      I have a question that a program with the level 2 of optimization commad.The version of the program runs on the same 10 hardware platforms, of which there is a board program does not run for a while. This version of program optimization option is level 2. But when I choose the level of optimization level 0. This version of the process can be normal operation does not appear stuck, the function is normal.

the figure:the optimization as show:


I have a few questions,

(1) codewarrior optimization options optimization code how to view the assembly language?

(2)  whether the project is recommended to use optimization options; (3) Some people think that codewarrior optimization options could introduce a bug so do not recommend Use, is it reasonable? (4) My project has entered a small batch test, 500 boards only a board appears such a situation, whether I need to cancel the optimization options. Is this necessary?

i hope your advice.


Labels (1)
1 Reply

NXP Employee
NXP Employee


1) For assembly code, right click somewhere in C file and select Disassemble.


2) If you use higher optimization, your code will be smaller, but also it will be more difficult to debug it and compiling will be slower. There is a description under each optimization level, so you can read, what optimizations are done.

3) It is possible that high level optimization will create some bug in the code. Unfortunately any compiler is flawless. 

4) In case your code does not work as expected with optimization, I recommend you set optimization off and do not use it (if it is possible).

Hope it helps. In case you have any other questions, please feel free to write me back.