CCS关于volatile问题
当运行一下语句时;<br />unsigned int *iFlashAddr;<br />iFlashAddr=(volatile unsigned int*)0xffff;<br /><br />出现这样的错误提示:<br />"flash.c", line 49: error: a value of type "volatile unsigned int *" cannot be assigned to an entity of type "unsigned int *"<br /><br />请问这是为什么啊?如下
类型不匹配吧rr
该这样吧<br />iFlashAddr=*(volatile unsigned int*)0xffff这样
这样<br />iFlashAddr=*(volatile unsigned int*)0xffff<br /><br />就会这样了:<br />"flash.c", line 19: error: a value of type "unsigned int" cannot be assigned to an entity of type "unsigned int *"<br />唉
感觉这两句代码要实现的功能是将I/O空间或数据空间FFFFh地址的内容当作FLASH程序的首地址。<br />unsigned int iFlashAddr; <br />iFlashAddr=*(volatile unsigned int*)0xffff;<br /><br />or:<br /><br />unsigned int *iFlashAddr;<br />*(iFlashAddr)=*(volatile unsigned int*)0xffff;<br /><br /><br /> 定义 int iFlashAddr;iFlashAddr=*(volatile int *)0xffff; 受教了
应该是:
volatile unsigned int *iFlashAddr;
iFlashAddr = (volatile unsigned int *)0xffff; 那就改成
volatile unsigned int *iFlashAddr;
iFlashAddr=(volatile unsigned int*)0xffff; 8L正解,其他都是扯淡
页:
[1]