Hi,

Wenbing Ma schrieb:
> int main()
> {
> unsigned int a1,b1;
> 
>   b1=0x1234;
>   a1=*(unsigned int*)(b1);
> 
>   return 0;
> }

> Use 'sdcc main.c' to compile. SDCC reports "error 127: non-pointer type
> cast to generic pointer from type 'unsigned-int' to type 'unsigned-int
> generic *' ". Is it a limitation or a bug? 

the 8051 has several memory spaces and SDCC cannot safely guess
which one you would like to read from (here you likely want xdata
but it could just as well have been code memory). Use:

a1=*(__xdata unsigned int *)b1;

(and declare a1 as volatile so SDCC actually emits code)

Greetings,
Frieder

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to