You copied the Doc URL to your clipboard.

Compiler type attribute, __attribute__((bitband))

__attribute__((bitband)) is a type attribute that lets you bit-band type definitions of structures.

In Example 28, the unplaced bit-banded objects must be relocated into the bit-band region. This can be achieved by either using an appropriate scatter-loading description file or by using the --rw_base linker command-line option.

/* foo.c */

typedef struct {
  int i : 1;
  int j : 2;
  int k : 3;
} BB __attribute__((bitband));

BB value; // Unplaced object

void update_value(void)
{
  value.i = 1;
  value.j = 0;
}

/* end of foo.c */

Alternatively, you can use __attribute__((at())) to place bit-banded objects at a particular address in the bit-band region. See Example 29.

/* foo.c */

typedef struct {
  int i : 1;
  int j : 2;
  int k : 3;
} BB __attribute((bitband));

BB value __attribute__((at(0x20000040))); // Placed object

void update_value(void)
{
  value.i = 1;
  value.j = 0;
}

/* end of foo.c */

See also

Concepts
Reference
Other information
  • Technical Reference Manual for your processor.