目前,我在1在prm文件中定义如下:
SEGMENTS
...
/* Here we use logical addressing */
RAM_D8 = READ_WRITE 0xD81000 TO 0xD81FFF;
RAM_D9 = READ_WRITE 0xD91000 TO 0xD91FFF;
RAM_DA = READ_WRITE 0xDA1000 TO 0xDA1FFF;
RAM_DB = READ_WRITE 0xDB1000 TO 0xDB1FFF;
RAM_DC = READ_WRITE 0xDC1000 TO 0xDC1FFF;
RAM_DD = READ_WRITE 0xDD1000 TO 0xDD1FFF;
RAM_DE = READ_WRITE 0xDE1000 TO 0xDE1FFF;
RAM_DF = READ_WRITE 0xDF1000 TO 0xDF1FFF;
RAM_E0 = READ_WRITE 0xE01000 TO 0xE01FFF;
RAM_E1 = READ_WRITE 0xE11000 TO 0xE11FFF;
RAM_E2 = READ_WRITE 0xE21000 TO 0xE21FFF;
RAM_E3 = READ_WRITE 0xE31000 TO 0xE31FFF;
RAM_E4 = READ_WRITE 0xE41000 TO 0xE41FFF;
RAM_E5 = READ_WRITE 0xE51000 TO 0xE51FFF;
RAM_E6 = READ_WRITE 0xE61000 TO 0xE61FFF;
RAM_E7 = READ_WRITE 0xE71000 TO 0xE71FFF;
RAM_E8 = READ_WRITE 0xE81000 TO 0xE81FFF;
RAM_E9 = READ_WRITE 0xE91000 TO 0xE91FFF;
RAM_EA = READ_WRITE 0xEA1000 TO 0xEA1FFF;
RAM_EB = READ_WRITE 0xEB1000 TO 0xEB1FFF;
RAM_EC = READ_WRITE 0xEC1000 TO 0xEC1FFF;
RAM_ED = READ_WRITE 0xED1000 TO 0xED1FFF;
RAM_EE = READ_WRITE 0xEE1000 TO 0xEE1FFF;
RAM_EF = READ_WRITE 0xEF1000 TO 0xEF1FFF;
RAM_F0 = READ_WRITE 0xF01000 TO 0xF01FFF;
RAM_F1 = READ_WRITE 0xF11000 TO 0xF11FFF;
RAM_F2 = READ_WRITE 0xF21000 TO 0xF21FFF;
RAM_F3 = READ_WRITE 0xF31000 TO 0xF31FFF;
RAM_F4 = READ_WRITE 0xF41000 TO 0xF41FFF;
RAM_F5 = READ_WRITE 0xF51000 TO 0xF51FFF;
RAM_F6 = READ_WRITE 0xF61000 TO 0xF61FFF;
RAM_F7 = READ_WRITE 0xF71000 TO 0xF71FFF;
RAM_F8 = READ_WRITE 0xF81000 TO 0xF81FFF;
RAM_F9 = READ_WRITE 0xF91000 TO 0xF91FFF;
RAM_FA = READ_WRITE 0xFA1000 TO 0xFA1FFF;
RAM_FB = READ_WRITE 0xFB1000 TO 0xFB1FFF;
RAM_FC = READ_WRITE 0xFC1000 TO 0xFC1FFF;
RAM_FD = READ_WRITE 0xFD1000 TO 0xFD1FFF;
/* RAM_FE = READ_WRITE 0xFE1000 TO 0xFE1FFF; intentionally not defined: equivalent to RAM: 0x2000..0x2FFF */
/* RAM_FF = READ_WRITE 0xFF1000 TO 0xFF1FFF; intentionally not defined: equivalent to RAM: 0x3000..0x3FFF */
...
END
PLACEMENT
...
PAGED_RAM INTO /* when using banked addressing for variable data, make sure to specif the option -D__FAR_DATA on the compiler command line */
RAM_D8, RAM_D9, RAM_DA, RAM_DB, RAM_DC, RAM_DD, RAM_DE, RAM_DF,
RAM_E0, RAM_E1, RAM_E2, RAM_E3, RAM_E4, RAM_E5, RAM_E6, RAM_E7,
RAM_E8, RAM_E9, RAM_EA, RAM_EB, RAM_EC, RAM_ED, RAM_EE, RAM_EF,
RAM_F0, RAM_F1, RAM_F2, RAM_F3, RAM_F4, RAM_F5, RAM_F6, RAM_F7,
RAM_F8, RAM_F9, RAM_FA, RAM_FB, RAM_FC, RAM_FD;
...
END
在主程序中定义如下:
#pragma DATA_SEG _RPAGE_SEG PAGED_RAM
unsigned char pagedRamVariable = 0xAA;
#pragma DATA_SEG DEFAULT
unsigned char * pointerToVariable;
void main(void)
{
//write a value
pagedRamVariable=0xBB;
//Initialize pointer to point at address of pagedRamVariable
pointerToVariable=&pagedRamVariable;
//write another value via use of pointer
*pointerToVariable=0x20;
for(;;)
{ }
}
但是,在仿真模式下,pagedRamVariable数据却是在2100‘L的地址,即默认的RAM区(RAM_FE),而不是指定的RAM_D8区。请问一下,这是什么地方出错了呢? |