诸位大侠:帮帮忙了
小弟在玩LPC1788的有关EEPROM程序编译出现了这样的警告:
warning: #1441-D: nonstandard cast on lvalue
结果把那些语句都优化掉了...没有相关的代码了。。。。。相关的程序如下是:
void EEPROM_Read(uint16_t page_offset,
uint16_t page_address,
void* data,
EEPROM_Mode_Type mode,
uint32_t count)
{
uint32_t i;
#ifdef __IAR_SYSTEMS_ICC__
#if (mode == MODE_8_BIT)
uint8_t *tmp = (uint8_t *)data;
#elif (mode == MODE_16_BIT)
uint16_t *tmp = (uint16_t *)data;
#else
uint32_t *tmp = (uint32_t *)data;
#endif
#endif
LPC_EEPROM->INT_CLR_STATUS = ((1 << EEPROM_ENDOF_RW)|(1 << EEPROM_ENDOF_PROG));
LPC_EEPROM->ADDR = EEPROM_PAGE_ADRESS(page_address)|EEPROM_PAGE_OFFSET(page_offset);
if(mode == MODE_8_BIT)
LPC_EEPROM->CMD = EEPROM_CMD_8_BIT_READ|EEPROM_CMD_RDPREFETCH;
else if(mode == MODE_16_BIT){
LPC_EEPROM->CMD = EEPROM_CMD_16_BIT_READ|EEPROM_CMD_RDPREFETCH;
if((page_offset &0x01)!=0) /* page_offset必须是2的整数倍 */
while(1);
}
else{
LPC_EEPROM->CMD = EEPROM_CMD_32_BIT_READ|EEPROM_CMD_RDPREFETCH;
if((page_offset & 0x03)!=0) /* page_offset必须是4的整数倍 */
while(1);
}
for(i=0;i<count;i++){ /* 读EEPROM中的数据 */
LPC_EEPROM->INT_CLR_STATUS = (1 << EEPROM_ENDOF_RW);
if(mode == MODE_8_BIT){ /* 以8位的模式读数据 */
#ifdef __IAR_SYSTEMS_ICC__
*tmp = (uint8_t)(LPC_EEPROM -> RDATA);
tmp++;
#else
*(((uint8_t *)data)++) = (uint8_t)(LPC_EEPROM -> RDATA);
#endif
page_offset +=1;
}
else if (mode == MODE_16_BIT){ /* 以16位的模式读数据 */
#ifdef __IAR_SYSTEMS_ICC__
*tmp = (uint16_t)(LPC_EEPROM -> RDATA);
tmp++;
#else
*(((uint16_t *)data)++) = (uint16_t)(LPC_EEPROM -> RDATA);
#endif
page_offset +=2;
}
else{ /* 以32位的模式读数据 */
#ifdef __IAR_SYSTEMS_ICC__
*tmp = (uint32_t)(LPC_EEPROM ->RDATA);
tmp++;
#else
*(((uint32_t *)data)++) = (uint32_t)(LPC_EEPROM ->RDATA);
#endif
page_offset +=4;
}
/* 等待读完成 */
while(!((LPC_EEPROM->INT_STATUS >> 26)&0x01));
if(page_offset >= EEPROM_PAGE_SIZE) {
page_offset = 0;
page_address++;
LPC_EEPROM->ADDR = EEPROM_PAGE_ADRESS(page_address)|EEPROM_PAGE_OFFSET(page_offset);
if(mode == MODE_8_BIT)
LPC_EEPROM->CMD = EEPROM_CMD_8_BIT_READ|EEPROM_CMD_RDPREFETCH;
else if(mode == MODE_16_BIT)
LPC_EEPROM->CMD = EEPROM_CMD_16_BIT_READ|EEPROM_CMD_RDPREFETCH;
else
LPC_EEPROM->CMD = EEPROM_CMD_32_BIT_READ|EEPROM_CMD_RDPREFETCH;
}
}
}
警告的四个语句分别是:
1、 LPC_EEPROM -> WDATA = *(((uint8_t *)data)++);
2、*(((uint8_t *)data)++) = (uint8_t)(LPC_EEPROM -> RDATA);
3、*(((uint16_t *)data)++) = (uint16_t)(LPC_EEPROM -> RDATA);
4、*(((uint16_t *)data)++) = (uint16_t)(LPC_EEPROM -> RDATA);
四个警告都一样:warning: #1441-D: nonstandard cast on lvalue
恳求诸位帮帮忙...该怎么解决这样的警告??????????
|