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.
CC430F5137的RAM很小,一些大的数组需要定义到flash中,以节省RAM的空间,使用const关键字可以将数组定义到flash中,sin_tab[512]和cos_tab[512]两个数组,按照此种方法操作,
const float sin_tab[512]=
{
0, 0.0061, 0.0123, 0.0184, 0.0245, 0.0307, 0.0368, 0.0429, 0.0491, 0.0552,
0.0613, 0.0674, 0.0736};
但是编译报错
Error[e16]: Segment DATA16_Z (size: 0x20df align: 0x1) is too long for segment definition. At least 0x10e1 more bytes needed. The problem occurred while processing the segment placement command "-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I,DATA16_HEAP+_DATA16_HEAP_SIZE=1C00-2BFD", where at the moment of placement the available memory ranges were "CODE:1c00-2bfd" Reserved ranges relevant to this placement: 1c00-2bfd DATA16_I
请各位前辈指点一下
long li4,
加了const关键字后,是可以将数据放到flash中的,但是这些数据就是常量了,在程序运行过程中就不能就行更改了。CCS中的话,会哟一个详细的map文件出来,你可以看到.const的具体地址,就是在FLASH中的。IAR应该也有对应的map文件的。你可以看看。
可以放在Flash区的,之前写的一段代码如下:
//ADTempData
const uint RT_ADTable[]=
{
682,692,702,714,722,731,741,751,760,768,
};
您好:
const float sin_tab[]=
{
0, 0.0061, 0.0123, 0.0184, 0.0245, 0.0307, 0.0368, 0.0429, 0.0491, 0.0552,
0.0613, 0.0674, 0.0736};
我也是这样定义的,但是编译报错
Error[e16]: Segment DATA16_Z (size: 0x20df align: 0x1) is too long for segment definition. At least 0x10e1 more bytes needed. The problem occurred while processing the segment placement command "-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I,DATA16_HEAP+_DATA16_HEAP_SIZE=1C00-2BFD", where at the moment of placement the available memory ranges were "CODE:1c00-2bfd" Reserved ranges relevant to this placement: 1c00-2bfd DATA16_I
long li4,
我查了一下,IAR可以通过设置option,调出来的。
查看一下这个链接:http://bbs.21ic.com/icview-110858-1-1.html
希望对你有帮助!