如何在DSP编程中定义一个较大的数组?编译出错怎么办??

568991873   2015-4-21 09:30 楼主
我在定义正弦表时出现了这个错误
for object ".ebss", size 0x1164 (page 1).  Available ranges:
   RAML4        size: 0x1000       unused: 0x1000       max hole: 0x1000   

undefined first referenced                                
  symbol       in file                                    
该如何定义下面这个正弦表呢???
sin_table[] =
{
   0,0.02094242,0.041875654,0.06279052,0.083677843,0.104528463,0.125333234,0.146083029,0.166768747,0.187381315,
   0.207911691,0.22835087,0.248689887,0.268919821,0.289031797,0.309016994,0.328866647,0.348572047,0.368124553,
   0.387515586,0.406736643,0.425779292,0.444635179,0.463296035,0.481753674,0.5,0.518027009,0.535826795,
   0.553391549,0.570713568,0.587785252,0.604599115,0.62114778,0.63742399,0.653420604,0.669130606,0.684547106,
   0.699663341,0.71447268,0.728968627,0.743144825,0.756995056,0.770513243,0.783693457,0.796529918,0.809016994,
   0.821149209,0.832921241,0.844327926,0.85536426,0.866025404,0.87630668,0.886203579,0.89571176,0.904827052,
   0.913545458,0.921863152,0.929776486,0.937281989,0.94437637,0.951056516,0.957319498,0.963162567,0.968583161,
   0.973578903,0.978147601,0.982287251,0.985996037,0.989272333,0.992114701,0.994521895,0.996492859,0.998026728,
   0.99912283,0.999780683,1,0.999780683,0.99912283,0.998026728,0.996492859,0.994521895,0.992114701,0.989272333,
   0.985996037,0.982287251,0.978147601,0.973578903,0.968583161,0.963162567,0.957319498,0.951056516,0.94437637,
   0.937281989,0.929776486,0.921863152,0.913545458,0.904827052,0.89571176,0.886203579,0.87630668,0.866025404,
   0.85536426,0.844327926,0.832921241,0.821149209,0.809016994,0.796529918,0.783693457,0.770513243,0.756995056,
   0.743144825,0.728968627,0.71447268,0.699663341,0.684547106,0.669130606,0.653420604,0.63742399,0.62114778,
   0.604599115,0.587785252,0.570713568,0.553391549,0.535826795,0.518027009,0.5,0.481753674,0.463296035,
   0.444635179,0.425779292,0.406736643,0.387515586,0.368124553,0.348572047,0.328866647,0.309016994,0.289031797,
   0.268919821,0.248689887,0.22835087,0.207911691,0.187381315,0.166768747,0.146083029,0.125333234,0.104528463,
   0.083677843,0.06279052,0.041875654,0.02094242,0,-0.02094242,-0.041875654,-0.06279052,-0.083677843,
   -0.104528463,-0.125333234,-0.146083029,-0.166768747,-0.187381315,-0.207911691,-0.22835087,-0.248689887,
   -0.268919821,-0.289031797,-0.309016994,-0.328866647,-0.348572047,-0.368124553,-0.387515586,-0.406736643,
   -0.425779292,-0.444635179,-0.463296035,-0.481753674,-0.5,-0.518027009,-0.535826795,-0.553391549,-0.570713568,
   -0.587785252,-0.604599115,-0.62114778,-0.63742399,-0.653420604,-0.669130606,-0.684547106,-0.699663341,
   -0.71447268,-0.728968627,-0.743144825,-0.756995056,-0.770513243,-0.783693457,-0.796529918,-0.809016994,
   -0.821149209,-0.832921241,-0.844327926,-0.85536426,-0.866025404,-0.87630668,-0.886203579,-0.89571176,
   -0.904827052,-0.913545458,-0.921863152,-0.929776486,-0.937281989,-0.94437637,-0.951056516,-0.957319498,
   -0.963162567,-0.968583161,-0.973578903,-0.978147601,-0.982287251,-0.985996037,-0.989272333,-0.992114701,
   -0.994521895,-0.996492859,-0.998026728,-0.99912283,-0.999780683,-1,-0.999780683,-0.99912283,-0.998026728,
   -0.996492859,-0.994521895,-0.992114701,-0.989272333,-0.985996037,-0.982287251,-0.978147601,-0.973578903,
   -0.968583161,-0.963162567,-0.957319498,-0.951056516,-0.94437637,-0.937281989,-0.929776486,-0.921863152,
   -0.913545458,-0.904827052,-0.89571176,-0.886203579,-0.87630668,-0.866025404,-0.85536426,-0.844327926,
   -0.832921241,-0.821149209,-0.809016994,-0.796529918,-0.783693457,-0.770513243,-0.756995056,-0.743144825,
   -0.728968627,-0.71447268,-0.699663341,-0.684547106,-0.669130606,-0.653420604,-0.63742399,-0.62114778,
   -0.604599115,-0.587785252,-0.570713568,-0.553391549,-0.535826795,-0.518027009,-0.5,-0.481753674,-0.463296035,
   -0.444635179,-0.425779292,-0.406736643,-0.387515586,-0.368124553,-0.348572047,-0.328866647,-0.309016994,
   -0.289031797,-0.268919821,-0.248689887,-0.22835087,-0.207911691,-0.187381315,-0.166768747,-0.146083029,
   -0.125333234,-0.104528463,-0.083677843,-0.06279052,-0.041875654,-0.02094242
};
谢谢啊

回复评论 (3)

我用的C2000,在液晶显示的时候,貌似也是数组太大编译不过,我看到网上说在数组前加上const可以解决,试了一下解决了,不过自己也不知道什么原因,LZ可以一试
点赞  2015-4-21 09:48
楼主的现象,是因为 RAML4的空间太小的原因。

在C2000器中,ROM区有已经固化了的专门的正弦波表,不用自己定义。

如果楼主所用器件没有这个ROM区,可以象楼上所说,将它修饰为const,这样,编译器就将它放到ROM中了,不再占用RAM。

如果楼主的器件中的RAM还有很大空间,可以将CMD文件中的 RAML4改大一些。

点赞  2015-4-21 11:49
把.ebss放到RAM区中大于0x1164的空间
点赞  2015-4-21 12:50
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复