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.

[参考译文] TMS320F280049:while 循环的 C 编译器。

Guru**** 2931100 points

Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1368041/tms320f280049-c-compiler-for-a-while-loop

器件型号:TMS320F280049
主题中讨论的其他器件:SysConfigC2000WARE

工具与软件:

大家好!

我对 C 编译器有一个问题、即使用 f280049和编译器 TI v.22.6.1的代码有疑问。 我有简单的 while 循环:

// .. 
int myFlag = 0;
// ..
while (!myFlag) NOP;

// .. other code

反汇编是:

105         while (!myFlag) NOP;
        C$L1:
008a86:   761F02AD    MOVW         DP, #0x2ad
008a88:   9211        MOV          AL, @0x11
008a89:   6004        SB           C$L3, NEQ
        C$L2:
008a8a:   7700        NOP          
008a8b:   5200        CMPB         AL, #0x0
008a8c:   61FE        SB           C$L2, EQ

问题在于、当 myFlag 为1时、在中断例程中设置、while 循环不会中断、并继续循环。

在反汇编代码中、我看到、一旦 myFlag 的值加载到 AL (C$L1至 C$L2的结构)中、该值就不会被重新加载、并且 C$L2下方的循环也不会退出。

我缺少什么?? 我是什么样子的:

while(1) {
  if (myFlag) break;
}

我的编译器选项包括:

-v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu0 /DE/PROGETTI/DE1240/software/sysconfig --opt_for_speed=5 /ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib --include_path="C /ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib/inc:/DE/PROGETTI/DE1240/software /ti/c2000/C2000Ware_5_01_00_00/device_support/f28004x/common/include /ti/c2000/C2000Ware_5_01_00_00/device_support/f28004x/headers/include /ti/ccs1230/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include /ti/c2000/C2000Ware_5_01_00_00/driverlib/f28004x/driverlib /DE/PROGETTI/DE1240/software/Debug/syscfg

我缺少什么??

谢谢!

此致

E·佩鲁兹

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

    应用关键字 易失性 添加至变量 我的标志 。  相关详细信息、 请在 C28x 编译器手册 中搜索标题为" 使用易失性关键字进行必要的存储器访问"的子章节。

    谢谢。此致、

    -乔治

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

    啊,老好的易挥发性

    此致

    E·佩鲁兹