This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Bitfields accesses (causing problems to some ARM hardware)


> > Do you have any suggestion how it should be handled. Could we
> fixed it in that
> > way that we will consider "volatile" for example and generate
> code for that as
> > for real bit-field. Or maybe do you know how to change source to
> get desired
> > effect.
>
> My suggestion:
> Use a union of the struct and an int for a temporary variable.
> Declare the I/O port as volatile int.  To read the port, assign its value
> to the int part of the union, and then look at the various fields in your
> temporary variable.  Likewise, to write, assemble the value in your
> temporary
> variable, and then assign it as an integer to the port register.

It's easy but looks very heavy in code there are a lot of playing with those
bitfields.
Actualy I was looking for way to change structure definition but leave all
accesses as is.

Thanks
Igor


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]