3.15 Compiler type attribute, __attribute__((bitband))

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

In the following example, 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, as in the following example:
/* 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 */
Related concepts
3.14 Compiler and processor support for bit-banding
3.16 --bitband compiler command-line option
3.17 How the compiler handles bit-band objects placed outside bit-band regions
Related reference
9.54 __attribute__((bitband)) type attribute
9.60 __attribute__((at(address))) variable attribute
7.13 --bitband
Related information
Scatter-loading Features
--rw_base=address linker option
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.