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.

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

Other Parts Discussed in Thread: MSP430F2618

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

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

  • 可以查看下文档

    MSP430 IAR C/C++ Compiler  Reference Guide

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

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