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.

CCS DSP280049数组长度



你好,我想定义一个1000个元素的数组,编译出错。请问有啥办法解决呢/?或者数组元素更多的怎么办?

Uint16 SPIRcv1a[1000],SPIRcv1b[1000];
Uint16 SPIRcv2a[1000],SPIRcv2b[1000];

出错提示:#148 declaration is incompatible with "Uint16 SPIRcv1a[500]" (declared at line 200 of "D:\1_MY Project\2021\1_Pro\G00121_MFHz\2_Pro\1_DSP\2_DSP PowerBLOCK\Include\Software.h")

  • 您可以尝试运行相同的代码,但减小数组大小。例如,将512个整数的数组减少为10个整数。如果这可行(如果C2000芯片继续在调试窗口中正确执行代码),则问题出在内存管理中。

    如果在函数中声明这些数组,请在CCS设置中增加堆栈大小。您可能还需要增加.cmd文件中的堆栈大小。如果这些数组是全局数组,请检查cmd文件中的ebss大小。您可以在下面查看链接。它将为您提供有关内存部分的更多信息。

    http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking

    若还是不行的话,一般有2中选择:

    1、如果数据时const类型,可以定义在flash里面;2、外扩SRAM。