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.

msp430fr5992代码运行时间的问题

最近在做一个项目,使用的是msp430fr5969芯片,为了 减小在中断中消耗的时间,我把中断中的一个for(i=0;i<8;i++)循环语句进行了展开(目的是用空间换时间,展开后会省掉++和判断语句),经过测试,展开后确实比使用for循环省时间。后来项目功能进行了扩展,msp430fr5969的flash(64k)不够用,现在用msp430fr5992进行了替换(管脚完全兼容,只是flash由64k扩大到了128k),经过测试,在msp430fr5992中,把for循环语句展开后反而比使用for循环更消耗时间。不理解原因,求高手指点。

 

  • 提高代码执行速度的,您可以看一下 www.ti.com/.../slaa801.pdf 的 2.1.1 Optimization Settings

    In CCS, the optimization settings are found in Project > Properties > Build > MSP430 Compiler >Optimization. There are two main optimization settings: Optimization level, and Speed vs size trade-offs

    The optimization level determines what types of optimizations the compiler is allowed to make. Speed vs size setting tells the compiler if trade-offs should be made more in the favor of size or speed, with 0 being optimizing with the most focus on size, and level 5 being the most focus on speed. Settings between 0 and 5 instruct the compiler to take a more balanced approach.
  •  建议检查时钟配置是否相同,还有工程的优化选项配置是否相同?