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.
IAR WorkBench 5.1,使用msp430f2618,main memory 0x03100 - 0x1FFFF,想将变量存入flash,比如
const double data @ 0xFC00 = 0.1; 这样没有问题。可如果将变量存储在0xFFFF之外,比如
const double data @ 0x1FC00 = 0.1; 则会报错 Error[Ta028]: Placing a located variable above 0xffff is not allowed
请问为什么不能将变量放置在高于0x0FFFF的地址? flash应该还有空间。
问题可能出在iar 编译器的设置上, general options-->data model,有small,medium,large三个选项
同样的程序,
const double data01 @ 0x1FC00 = 0.1;
double *p;
p = (double *)(0x1FC00);
选择large,无报错,无警告
选择medium,无报错,有警告
p = (double *)(0x1FC00); <---Warning[Pe1053]: conversion from integer to smaller pointer
选择small,有报错,有警告
p = (double *)(0x1FC00); <---Warning[Pe1053]: conversion from integer to smaller pointer
const double data01 @ 0x1FC00 = 0.1; <-----Error[Ta028]: Placing a located variable above 0xffff is not allowed
为什么会有这种差异?这个得查编译器的文档吧?
问题是不是在 16位寻址 和 20位寻址上?
比如
http://www.deyisupport.com/question_answer/microcontrollers/msp430/f/55/t/30871.aspx
可以查看下文档
MSP430 IAR C/C++ Compiler Reference Guide
http://perso.citi.insa-lyon.fr/afraboul/rts6/doc/EW430_CompilerReference.pdf 13页的Data storage