8.17 --bitband

Bit-bands all non const global structure objects. It enables a word of memory to be mapped to a single bit in the bit-band region. This enables efficient atomic access to single-bit values in SRAM and Peripheral regions of the memory architecture.

For peripherals that are width sensitive, byte, halfword, and word stores or loads to the alias space are generated for char, short, and int types of bitfields of bit-banded structs respectively.

Restrictions

The following restrictions apply:

  • This option only affects struct types. Any union type or other aggregate type with a union as a member cannot be bit-banded.

  • Members of structs cannot be bit-banded individually.

  • Bit-banded accesses are generated only for single-bit bitfields.

  • Bit-banded accesses are not generated for const objects, pointers, and local objects.

  • Bit-banding is only available on some processors. For example, the Cortex-M4 and Cortex-M3 processors.

Example

In this example, the writes to bitfields i and k are bit-banded when compiled using the --bitband command-line option.

typedef struct {
  int i : 1;
  int j : 2;
  int k : 1;
} BB;
BB value;
void update_value(void)
{
  value.i = 1;
  value.k = 1;
}
Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.