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.

[参考译文] TMS320F28379D:使用 idiv0优化的不正确模数计算

Guru**** 2589275 points
Other Parts Discussed in Thread: TMS320F28379D

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1112209/tms320f28379d-incorrect-modulo-computation-with-idiv0-optimization

器件型号:TMS320F28379D

我在使用 CCSv10和 c/c++编译器 TIv20.2.5.LTS 的 TMS320F28379D controlCARD 上遇到以下最小代码片段的问题

#define __SIZE_T_TYPE__ unsigned long
typedef __SIZE_T_TYPE__ size_t;

size_t tail;
#define SERIAL_BUF_SIZE 256U

for(;;) {
    tail = (tail + 1) % SERIAL_BUF_SIZE;
}

当我在编译器中启用--idiv-support idiv0标志时,上述模块停止工作。 预期行为(在未启用优化的情况下观察)是 tail 变量递增至 serial_BUF_size 然后从0重新启动。 启用 idiv0后、模数始终返回0、尾数永不递增。 为什么会发生这种情况?

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

    您好!

    F2837x 没有 FASTINTDIV 功能、因此-idiv0不起作用。 它在 F2838x 和更新的器件上提供。

    -Shantanu