Minor feature for ld

Ian Lance Taylor ian@airs.com
Tue Sep 3 13:10:00 GMT 2002


Pete Gonzalez <pgonzalez@bluel.com> writes:

> But then it occurred to me that the hacks could be eliminated,
> if you could just map variables onto the ports.  In fact, most of
> cases could be handled with ordinary C bitfields:
> 
>    __attribute__((section("/0x400000C/"))) struct {
>      int priority : 2;
>      TDataPage tileDataPage : 2;
>      bool enableMosaic : 1;
>      // etc.
>    } REG_BG2CNT __attribute__((packed));

It seems to me that you can still do that in C.

struct REG_BG2CNT_T {
  int priority : 2;
  TDataPage tileDataPage : 2;
  bool enableMosaic : 1;
  // etc.
} __attribute__((packed));

#define REG_BG2CNT ((struct REG_BG2CNT_T *)(0x40000C))

REG_BG2CNT->priority = 1;

Ian



More information about the Binutils mailing list