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/TMS320F2.8377万D:内存分配失败:不确定全局阵列的存储位置

Guru**** 2539500 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/619956/ccs-tms320f28377d-memory-allocation-fail-not-sure-where-the-global-arrays-are-getting-stored

部件号:TMS320F2.8377万D

工具/软件:Code Composer Studio

您好,

我正在尝试使用"extern float"定义5个数组,并使用全局变量访问它们。但由于错误#1.0099万-D,我无法生成代码,如下所示

在上图中,我假定错误是由于"gamma _air[31]"和"V0[31]"数组(在"sinetab.c"文件中定义)引起的。 但我不知道为什么和如何在这里发生内存分配失败。以及如何避免这种情况。 我还有另外3个这样的变量,它们是以同样的方式解密的,需要在这个程序中被调用来进行计算。

我将在下面附上一个虚拟代码以供理解

#include "F28x_Project.h" // Device Headerfile和示例包括文件
#include "math.h"


extern float V0[31];// wavenumber
extern float st0[31]; //线强度
//---- 为洛伦天线———— //
extern float gma_air[31];//空气增宽系数
extern float gma_self[31];//自宽coeff
extern float eP[31];//较低状态能量

alpha_Voigt[900]={{0}};

float p = 1;









gamma x_c2H2 = 1;float x_air;t=27;float float float;t=0;0.75 float float float float = 0;float float fup;float float float = 0

双C1=0;
双C2=0;
//double c3=0;
double c4=0;


#define C3 0.9664.6037万5191359</xmt-block>519.1359万 ;

#define z 1.4388

UINT16 j =0;

void main(void)
{
p = 1;//压力(以bar为单位)
X_C2H2 = x_C2H2/100;
X_air = 1 - x_C2H2;
T = T + 273;//温度单位为k

c4 = pow (T0/T,(double) n);

用于(j=0;j<31;j++)
{
c1 =(1-exp (-1*(double)(z*V0[j]/T)));
c2 =(1-exp (-1*(double)(z*V0[j]/t0)));
gamma airj =(float)((double) gamma空气[j]*c4);

}

}

我还附加了“sinetab.c”文件的代码

/* sinetab.c *//

表段声明
//#pragma data_section(QuadratureTable,"QuadratureTableSection")

//正交查找表:包含5个正弦曲线数据点的象限
// C2H2的HITRAN
//线中心(Wavenumber cm-1)
连接浮点V0[31]={ 6532.8262
		,6533.2727 ,6533.3195 6533.3724 ,6533.3711 6533.3724 ,6533.375 ,6533.4872 ,6533.5458 ,6533.678 , 6533.9707 ,6534.0623

		,6534.36345 ,6534.3641 ,6534.4024 , 6534.4074 ,6534.4342 ,6534.4565 ,6534.6889 ,6534.7226 , 6534.9115 ,6534.9353 ,6535.2999

		,6535.3511 ,6535.389 , 6535.4305 ,6535.4351 ,6535.4751 ,6535.4819 ,6535.9152 ,6535.9549 ,

};

// st0 =线强度*N,(N=2.479E19)
常量浮点st0[31]={
		1.46E-04,1.25E-04,1.33E-04,2.07E-04,3.99E-04, 4.89E-04,6.91E-05,5.37E-04,2.46E-03,4.96E-06, 1.79E-04,7.85E-05,
		3.00E-01,6.18E-04,5.21E-06, 2.18E-04,3.76E-03,1.25E-03,9.85E-05,3.92E-06, 2.33E-04,4.39E-04,3.55E-04,3.71E-04,
1.24E-04,1.64E-04,1.49E-04,7.00E-05,2.10E-04, 1.93E-03,4.91E-04

};

//空气扩宽高效
的常量浮子gamma _air[31]={ 0.082
		,0.0787 ,0.0777 ,0.082 ,0.0777 , 0.0768 ,0.082 ,0.0768 ,0.094 ,0.0541 , 0.0768 ,0.0616 ,0.082 ,0.0777 ,0.0597 ,

		0.0777 ,0.1043 ,0.1043 ,0.0635 ,0.0578 , 0.0808 ,0.0808 ,0.0777 ,0.0768 ,0.0768 , 0.0756 ,0.0756 ,0.0808 ,0.0808 ,0.0985 ,

		

0.0756 };

//自宽系数
。const float gama_self[31]={ 0.158
,0.147 ,0.144 ,0.158 ,0.144 , 0.141 ,0.158 ,0.141 ,0.18 ,0.101 , 0.141 ,0.113 ,0.158 ,0.144 ,0.11 , 0.144 ,0.191 ,0.191 ,0.116

,0.107 , 0.154 ,0.154 ,0.144 ,0.141 ,0.141 , 0.138 ,0.138 ,0.154 ,0.154 ,0.185 ,
0.138 };

//低状态能量
常量浮点Ep [31]={ 1425.5081
		,1483.8367 ,1526.817 ,1543.2997 ,1526.858 , 1445.4238 ,1543.312 ,1442.9182 ,22.9686 ,1564.9755 ,1443.2827 ,

		1319.4218 ,105.885 ,944.0663 ,1493.152 ,943.2125 , 614.0444 ,614.0549 ,1259.9725 ,1557.4917 ,1555.3862 , 1446.7444 ,1512.1445

		,1557.4784 ,1557.5341 ,1475.7936 , 1478.5311 ,1564.5485 ,1564.5677 ,13.7813 ,1476.2665

};

请帮助我解决此内存分配问题。 感谢您提前提供的帮助