由于开发过程中需要接收大量数据到单片机中进行处理,所以需要6kb的连续数据存储空间,查看手册时单片机的数据存储空间为64kb,分成sfr空间,x,y空间,但我不想占用这些空间,还有一个空间是未用的x数据ram空间,用于提供程序空间可视性,我想把数据申请到这个空间,我用的是mplab ide v8.89 c30的编译器
我用的address(0x8000)属性指定数据的首地址,编译可以通过,如下:
Data Memory Usage
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0x6e (110)
.ndata 0x86e 0 0x30 (48)
.nbss 0x89e 0 0x8 (8)
_0119dd90516b4eb9 0x8000 0 0x19c8 (6600)
Total data memory used (bytes): 0x1a6e (6766) 83%
请问这样做可以吗?数据存在这里对我的程序空间的访问有什么影响吗?
而且当我申请的空间达到8kb时,编译结果如下
Data Memory Usage
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0x6e (110)
.ndata 0x86e 0 0x30 (48)
.nbss 0x89e 0 0x8 (8)
_0119dd90516b511e 0x8000 0 0x2260 (8800)
Total data memory used (bytes): 0x2306 (8966) 110%
编译可以顺利通过,但当我用sim进行仿真时会报错:
ADC-W0008: Minimum Tad time is 667 ns, it is 250 ns
ADC-W0008: Minimum Tad time is 667 ns, it is 250 ns
CORE-E0011: Trap due to unimplemented RAM or PSV memory access, occurred from instruction at 0x000170
ADC-W0008: Minimum Tad time is 667 ns, it is 250 ns
ADC-W0008: Minimum Tad time is 667 ns, it is 250 ns
CORE-E0011: Trap due to unimplemented RAM or PSV memory access, occurred from instruction at 0x000170 |