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.
例如一个长度为64字节的一维数组,想将其写入在MSP430的0xFA00开始的位置,即编译后这个数组的起始位置为0xFA00,C程序中如何处理呢?
Yun Zhang,
您好!
在定义这个数组的时候,可以采用以下的方式:
const [数据类型] 变量名 @ 地址
比如
const char Array[3] @ 0xFA00 = {0, 1, 2};
希望对您有所帮助!
Charles,
在《Code Composer Studio™ v4.2 User's Guide for MSP430™ User's Guide》www.ti.com/.../slau157s.pdf 29页有这种用法。
以下为相应段落:
”
The scheme implemented in the IAR compiler using either the @ operator or the #pragma location directive is not supported with the CCS compiler:
/* IAR C Code */
__no_init char alpha @ 0x0200; /* Place ‘alpha' at address 0x200 */
#pragma location = 0x0202
const int beta;
“
const char alpha @ 0x0200;也是可以的。
见过Jason用过@这种用法,学习来的。但是在CCS中不支持。
QQ群内有人提出这种处理方式,添加一个汇编文件定义:
新建汇编文件.ASM
文件内容
ORG 0FA00H
数据
END
汇编文件添加到工程中,不用调用的
你好,
第一,
你可以按照鸵鸟蝈蝈的方式:
const [数据类型] 变量名 @ 地址
const char Array[3] @ 0xFA00 = {0, 1, 2};
第二,
你也可以选择使用FRAM的MSP430。
直接const char xxx