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.

TMS320F28335 使用CCS6.0编译问题



最近使用CCS6.0编译28335程序遇到一个比较诡异的问题:

(1)函数 

long test_fun(long var)

{

    int a[200];

    a++;

    return 0;

}

while(test_fun() == 0); 死循环条件不成立。

(2)

long test_fun(long var)

{

    int a[20];

    a++;

    return 0;

}

while(test_fun() == 0); 死循环条件成立。

查看汇编,test_fun两者使用恢复栈的方式不一样,前者使用 ADD 恢复栈,后者使用SUBB 恢复栈。ADD 恢复栈会改变 st0 寄存器 z 位的值,while 条件判断是使用SBF指令跳转,依赖Z值,导致最终与预期结果不一致。

请问这个问题如何解决。