If i do not use Bit Banding feature on ATSAM3N, this region, it will used by the compiler for the program? Or it will stay unused?

What if my program, randomly (by itself) should need to assign and access this region?


2 Answers 2


The linker controlled by a link script (not the compiler), places variables and code at specific memory locations. Normally, the linker script does not attempt to place variables or code, within the Bit-band regions.

So, unless you write a liner script to explicitly place something into the bit-band regions' address ranges, the linker will not normally place anything there.

However, those regions are just 'overlays'; bit-banding only provides an alternative address range to access the RAM or peripherals which are already accessible with their own 'real' addresses. The Bit-band regions do not provide any extra storage, just a different access mechanism, so IMHO it is a bit misleading to ask "Or it will stay unused?".

Put another way, the compiler+linker can use all available RAM, irrespective of using Bit-band addresses to access it. Bit-band addressing is only extra addressing hardware.

Bit-band addressing is used to access peripheral registers or RAM as individual bits. This can be very useful to implement atomic bit-access, or faster access to individual bits, for example to control pins connected to ports.

Each Bit-band address contains a 1-bit value. So they are useful for boolean values, but little else.

The easy way to take advantage of bit-band functionality to test or update bits within RAM or peripherals is via C/C++. ARM documentation, and the books by J.Yiu, explain how to exploit bit band addressing; set the value of unsigned int (32 bit) pointer to an address within the bit-band range, e.g.
volatile uint32_t GPIOA_BASE = (uint32_t*) 0x40010800; (not correct bit-band address)

Then any access to memory or peripheral registers via a correctly initialised pointer variable will actually read or write a single bit within the real RAM or peripheral register:
*GPIOA_BASE = 1; // set bit to true

  • \$\begingroup\$ Old answer, still useful in 2018! Cortex M newbie. \$\endgroup\$
    – Leroy105
    Jan 18, 2018 at 2:09

According to chapter 6.7 in "The Definitive Guide to ARM Cortex M3/M4 Processors" by J.Yiu there are two memory regions which are also bit-band regions. Both of them can be used like normal memory or by accessing single bits via the bit-band alias.
Furthermore using the bit-band feature requires assembly code or to explicitly point to the band-alias address when using C/C++. C or C++ compilers will not use the band-alias otherwise and thus use of bit-banding is the programmers choice. The linker could possibly use the bit-band region as normal SRAM or Peripherals Memory.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.