preventing optimization in gcc 2.95.1
Jens Heilig
jens.heilig@gmx.de
Thu Sep 30 23:56:00 GMT 1999
The G wrote:
> I do the I/O port thing all the time.
> Note the volatile in my example, this is how:
>
> #define LED_REGISTER ( *(volatile unsigned char *)0x12345678)
(...)
> > Jens Heilig wrote in message
> > news: 37F21B26.3CF12059@gmx.de ...
> > I use gcc as a cross-compiler for an embedded m68k target.
> >
> > For access to memory-mapped IOs I defined two macros:
> > #define pBYTE(x) (*((ubyte *) (x)))
> > #define pWORD(x) (*((ushort *)(x)))
(...)
That did the trick. Actually, I didn't have to change the #defines for
the memory addresses, but a change to the macros was sufficient:
#define pBYTE(x) (*((volatile ubyte *) (x)))
works now. Actually it's the obvious place the volatile should go, but
for some reason I kept putting elsewhere (like: (ushort * volatile),
which did *not* work)
Thanks a lot!
jens
More information about the Gcc-help
mailing list