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.

Matlab生成的DSP C源代码,在C6713B的Flash引导模式下,程序跑飞



如题,请教各位。

实验背景如下:

1、通过Matlab的IDElink,链接CCS3.3。配置DSP C6713B,根据需要调用不同cmd文件,仿真器引导或Flash引导,成功编译

2、调用Matlab中的标准sin函数,生成DSP源代码,其中核心代码如下

sineDemo_B.SineWave = sin(((real_T)sineDemo_DW.counter +
sineDemo_P.SineWave_Offset) * 2.0 * 3.1415926535897931 /
sineDemo_P.SineWave_NumSamp) * sineDemo_P.SineWave_Amp +
sineDemo_P.SineWave_Bias;

3、编译,生成.out

4、如为Flash引导,进一步生成.hex

运行结果:

仿真器引导模式,生成.out,加载到C6713B的RAM中运行正常,sin函数结果能够输出。

Flash引导模式,仅切换cmd文件,C程序一致,将.hex烧写到Flash中,Flash引导,程序执行到sin函数时,跑飞。

问题定位:

将Matlab生成的sin函数,手动修改为:

a = sin_parameter[0]*sin(j * kPI)+sin_parameter[1];

编译后烧写到Flash,程序运行正常,结果能输出,不会跑飞。

2个sin函数的区别,为去掉了除法。

请专家看一下,用Matlab生成的数学模型DSP代码,在仿真器能正常运行,而烧写到Flash后,执行到数学函数会跑飞。

目前初步怀疑是除法不能直接用于TI DSP,请专家大牛根据器件使用经验,提供参考意见,谢谢!