为何在自己定义的段中(FLASH中)无法烧入数据?[求助]
- UID
- 344283
- 性别
- 男
|
为何在自己定义的段中(FLASH中)无法烧入数据?[求助]
在Project.prm文件中自定义段地址如下所示:
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_ROM = READ_ONLY 0xC000 TO 0xC03F;
TESTROM = READ_ONLY 0xC040 TO 0xC07F;
ROM = READ_ONLY 0xC100 TO 0xFDFF;
Z_RAM = READ_WRITE 0x0040 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x043F;
END
PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
ZROM INTO Z_ROM;
TEST_ROM INTO TESTROM;
DEFAULT_RAM INTO RAM;
DEFAULT_ROM, ROM_VAR, STRINGS INTO ROM; /* In case you want to use as well, be sure the option -OnB=b is passed to the compiler. */
_DATA_ZEROPAGE, MY_ZEROPAGE INTO Z_RAM;
END
在main.c文件中操作如下:
#pragma CONST_SEG ZROM
const unsigned char test1[10]={
0x55,0xAA,0x55,0xAA
};
#pragma CONST_SEG TEST_ROM
const unsigned char test2[10]={
0xf8,0xf8,0xf8,0xf8,0x00
};
#pragma CONST_SEG DEFAULT
程序的烧写和运行都正常,但是,为什么在烧FLASH时,定义的test1和test2常量的数值并没有烧到FLASH中以0xC000和0xC040开始的地址中呢???
我用的芯片是MC69HC908GZ16。
恳请版主帮助!!!
|
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
如果你定义的常量在程序中没有使用,可能会被优化掉。你可以加一个volatile申明。 |
|
|
|
|
|