ARM: LOCATING VARIABLES AT ABSOLUTE MEMORY ADDRESSES

QUESTION

I need to locate a variable at a fixed memory address. How can I
do this using C source code?

BACKGROUND

There are many reasons to store an array variable, such as a table
or function to specific address. A checksum might need to be at a
certain address. A function might need to be placed at a particular
memory location. Depending on what compiler is used, there are
options for setting a specific memory area.

See more in the
Language extension compatibility: attributes in the Migration
and Compatibility Guide, in the subsection Migrating
__attribute__((at(address))) and zero-initialized
__attribute__((section("name"))). It shows how to to define a
variable at a fixed memory address. The following definition also
makes a correct memory reservation, so that the area cannot be
used twice.

Keil CARM C Compiler (a deprecated product)
Use either pointer definitions (as shown above) or _at_
keyword to define a variable at a fixed memory address. As with the
RealView C Compiler, the following definition also makes a correct
memory reservation, so that the area cannot be used twice.

Important information

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.