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.

[参考译文] TMS320F28P550SJ:<urgent>关于优化中断例程代码以减少时间消耗的问题

Guru**** 2386610 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1487161/tms320f28p550sj-urgent-question-about-optimizing-interrupt-routine-code-for-time-consumption-reduction

器件型号:TMS320F28P550SJ

工具与软件:

您好!

我们在将控制代码纳入中断例程的时间范围方面面临着挑战。

一些背景信息:

1.我们在固件中仅使用一个中断例程。

2.中断程序中的所有内容都被放入"Ramfunc"来加快过程。  

3. 固件以 C 语言编写

我们使用的编译器是 TI V22.6.0.1.LTS。

5.优化级别配置为"3-过程间优化"。

6.速度与尺寸的权衡设置为"2"。

7.浮点模式配置为"relaxed"。

8、允许 FP 算术重新关联设置为'开'。

9.我们使用的 MCU 是 TMS320F28P550。

这里有一些我们不理解的东西,似乎不符合逻辑。

我们在运行时执行的常量之间进行了一些计算。

例如:

 #define constant_one   10.0f

#define constant_two   20.0f

float 变量= 5.0f;

在 ISR 例程中、我们有如下代码:

......

float result =  variable * constant_one * constant_two;

 

我们知道、 如今的编译器 足够智能、可以在编译期间优化常量乘法常量。 但我们仍然选择将代码更改为如下:

#constant_three  200.0f

......

float result = 变量 * constant_three;

让我们感到困惑的地方是、通过进行此类清理、ISR 时间消耗实际上有所增加、而不是保持不变或减少。

对我们来说、这在逻辑上没有意义。

我们在这里一定不能错过一些内容、否则就会误解 C 编译器的工作方式。

请帮助我们了解可能会发生什么情况。

谢谢!

Frank

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    有关包含 ISR 例程的源文件、 请按照 如何提交编译器测试用例一文中的说明进行操作。  但请执行两次。  一旦代码被写入使用类似的语句...

    [quote userid="628261" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1487161/tms320f28p550sj-urgent-question-about-optimizing-interrupt-routine-code-for-time-consumption-reduction float result =  variable * constant_one * constant_two ;

    第二次,当有类似的声明...

    [quote userid="628261" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1487161/tms320f28p550sj-urgent-question-about-optimizing-interrupt-routine-code-for-time-consumption-reduction float result = variable * constant_three;

    谢谢。此致、

    -George.