Need Better Code Performance on your MSP430 MCU?

Maintaining the balance between code optimization and code size is not always easy. As many of you may know, Code Composer Studio 5.5 was recently released. What you may not know is that it now includes Optimizer Assistant. This is a great feature that will help you choose the right compiler optimization settings to maximize performance, while still meeting your code size requirements. 

Optimizer Assistant

  • Helps you choose the right mix of optimizations
  • Does the experimentation for you
  • Is free and integrated in CCS 5.5

So how do you use it? Build your project and check the Advice view. Double-click the corresponding entry to start the optimization analysis for "optimization level." The primary difference between the optimization levels is how much of the source code is considered in order to make decisions about how to improve compiler output.  Higher levels of optimization tend to generate better output.

After running the analysis, Optimizer Assistant will show code size with respect to the optimization level and you can choose the one that best meets your needs, while making sure the code size is within the needed limits. 

Reading the Optimization Level Results 

  • Red - code size is too large; Blue - code size fits
  • The check mark reveals the current setting
  • Hover and click the link to apply a new setting

At this point, you can further improve your compiler optimizations by re-running Optimizer Assistant and selecting the option for "speed vs. size trade-offs." The valid values are 0-5.  The value 0 means always favor code size over speed.  The value 5 means always favor speed over code size. The best choice is usually the optimization for the highest speed that still fits into the memory constraints of a given device. Optimization for high speed typically means that less CPU cycles are executed for a given task – which also means that the least amount of energy is spent.


Reading the Speed vs. Size Results 

  • Red - the code will not fit; Yellow - code fits, but more optimization possible; Green - recommended
  • The check mark reveals the current setting
  • Hover and click the link to apply a new setting


That's all there is to it! With Optimizer Assistant, you can spend less time determining the best compiler optimizations for your code. Want to learn more or explore other integrated features like MSPMATHLIB? Checkout the CCS for MSP430 User's Guide or the CCS Wiki. If you have any issues, head over to our E2E forum for help.

Anonymous