Error LNK:(1105) Can't allocate RAM space for stack label main_bp, which need 12 byte(s).

写单片机程序,得小气点儿,吝啬每一个字节,吝啬每一个bit。否则,就会报如下类似错误:Error LNK:(1105) Can't allocate RAM space for stack label main_bp, which need 12 byte(s).

 

如下代码定义了三个long(3*4byte=12byte),RAM内存紧张,于是报错。

 

void main() { unsigned long data=0x03e81388; unsigned long d=data>>16; unsigned long t=((d)*(d)); d=data&0x0000ffff; t=(t+((d)*(d))); t=sqrt_16(data);//0.1,0.5 //t=sqrt_16(0x10); while(1); } 

 

修改后的代码,只定义了2个long(需要8byte):这时就够用了,就无错误了……

void main() { unsigned long data=0x03e81388; //unsigned long d=data>>16; unsigned long t=((data>>16)*(data>>16));/ //d=data&0x0000ffff; t=(t+((data&0x0000ffff)*(data&0x0000ffff))); data=t; t=sqrt_16(data);//0.1,0.5 //t=sqrt_16(0x10); while(1); } 

你可能感兴趣的:(byte)