Direct I/O reads/writes from C programs (volatile)

Wynn Rostek
Thu Mar 18 03:41:00 GMT 1999

At 11:45 AM 3/17/99 -0800, you wrote:
>>As far as memory mapped I/O, there have been some recent posts here on that
>>subject, but one possibility is something like this:
>>unsigned char * addr = (unsigned char *) 0x12345678;
>>unsigned char ch;

>It might be a good idea to declare addr as pointing to a volatile to
>avoid undesired compiler optimization.
>volatile unsigned char * addr = (unsigned char *) 0x12345678;

I've been working on getting some start up code written, and I noticed that
adding volatile will force the compiler to use an automatic.  (I was using
register) I ended up coding several sections as in line assembler. (Hadn't
checked the RAM yet, so no stack to create automatics on.)


New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

More information about the crossgcc mailing list