TI中文支持网
TI专业的中文技术问题搜集分享网站

请问编译器提示 Error[Ta028]: Placing a located variable above 0xffff is not allowed 的原因是什么?

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应该还有空间。

LEI ZHENG2:

问题可能出在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

为什么会有这种差异?这个得查编译器的文档吧?

LEI ZHENG2:

回复 LEI ZHENG2:

问题是不是在 16位寻址 和 20位寻址上?

比如

http://www.deyisupport.com/question_answer/microcontrollers/msp430/f/55/t/30871.aspx

Susan Yang:

可以查看下文档

MSP430 IAR C/C++ Compiler  Reference Guide

http://perso.citi.insa-lyon.fr/afraboul/rts6/doc/EW430_CompilerReference.pdf   13页的Data storage

user3785308:

如 1楼所说,需要 修改配置, 如果超过16位 地址空间,就要选择 large~~

赞(0)
未经允许不得转载:TI中文支持网 » 请问编译器提示 Error[Ta028]: Placing a located variable above 0xffff is not allowed 的原因是什么?
分享到: 更多 (0)