__attribute__((bitband)) is a type attribute
that is used to bit-band type definitions of structures.
In Example 7, 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.
Example 7. Unplaced object
/* 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, __attribute__((at())) can
be used to place bit-banded objects at a particular address in the
bit-band region. See Example 8.
Example 8. Placed object
/* 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 */
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.