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.

关于2407A的CMD文件



请问如果我想将一部分全局变量放在B0B1空间内,一部分放在SARAM内,如何来配置CMD文件?我试了用以下配置,但编译时提示我cannot allocate .bss in B0B1 (page 1),我的配置如下

-stack 500h

... ...

B0B1 : origin = 0200h , length = 0200h /* DARAM B0B1 */
SARAM : origin = 0800h , length = 0800h /* SARAM */

... ...

.bss : { } > B0B1 PAGE 1
.bss : { } > SARAM PAGE 1
.stack : { } > SARAM PAGE 1

  • Baohua,

    你的全局变量总共有多少个?

    像你在CMD这么编写的话,是不会把变量分配给B0B1加上SARAM的,CCS会首先判断B0B1空间是否足够大存放所有变量,如果足够,就放在B0B1,如果不够大,则放在SARAM中。

    另外关于B0这个空间:

    If the on-chip RAM configuration control bit (CNF) is set to 0, the reconfigurable data dual-access RAM (DARAM) block B0 is mapped to data space; otherwise, B0 is mapped to program space. Blocks B1 and B2 are mapped to data memory space only, at addresses 0300−03FF and 0060−007F, respectively. Blocks 0 and 1 contain 256 words, while block 2 contains 32 words

    这里显示当CMF = 0时,B0映射为程序空间,而我认为变量是属于数据空间的,所以这也有可能是编译警告的原因。

    Eric

  • Eric,

    在我的配置中CNF=0,即B0被配置成了数据存储区。另外我目前的全局变量数量已经超出了B0B1的存储空间,所以我想将全局变量一部分存在B0B1中,超出部分存在SARAM中,是否可行?如果可以,如何配置?谢谢!

    Wang Baohua

  • Baohua,

    全局变量超过BOB1的空间,你上面帖子的那种定义方法是不可以的,因为正如我解释的一样,编译器只会找一个段有空间足够大来放变量。

    如果你要一些变量放在BOB1,

    可以用下面语法:

    #pragma DATA_SECTION(变量名称, "BOB1");

    变量定义

    Eric