|
|||||||||||
Technical Support On-Line Manuals Linker User Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Methods of placing functions and data at specific addresses
7.2.4 Methods of placing functions and data at specific addressesThere are various methods available to place functions and data at specific addresses. Where they are required, the compiler normally produces RO, RW, ZI, and XO
sections from a single source file. These sections contain all the code and data from the
source file.
Placing functions and data at specific addressesTo place a single function or data item at a fixed address, you must enable the linker to process the function or data separately from the rest of the input files. The linker allows you to place a section at a specific address as
follows:
To place a function or variable at a specific address it must be placed in its own section.
There are several ways to do this:
Related conceptsRelated referenceExample of how to place a variable at a specific address without scatter-loadingThis example shows how to modify your source code to place code and data at specific addresses, and does not require a scatter file. To place code and data at specific addresses without a scatter file:
In this example,
__attribute__((at(
specifies that the global variable gSquared is to be placed
at the absolute address . gSquared
is placed in the execution region ER$$.ARM.__at_ and load region LR$$.ARM.__at_ .NoteAlthough the address is specified as in the source file,
the region names and section name addresses are normalized to eight hexadecimal digits.The memory map shows:
… Load Region LR$$.ARM.__at_0x00005000 (Base: 0x00005000, Size: 0x00000000, Max: 0x00000004, ABSOLUTE) Execution Region ER$$.ARM.__at_0x00005000 (Base: 0x00005000, Size: 0x00000004, Max: 0x00000004, ABSOLUTE, UNINIT) Base Addr Size Type Attr Idx E Section Name Object 0x00005000 0x00000004 Zero RW 13 .ARM.__at_0x00005000 main.o Related referenceExample of how to place a variable in a named section with scatter-loadingThis example shows how to modify your source code to place code and data in a specific section using a scatter file. To modify your source code to place code and data in a specific
section using a scatter file:
In this example,
__attribute__((section("foo"))) specifies that the global variable
gSquared is to be placed in a section called
foo . The scatter file specifies that the
section foo is to be placed in the ER3 execution region.The memory map shows:
Load Region LR1 (Base: 0x00000000, Size: 0x00001570, Max: 0x00020000, ABSOLUTE) … Execution Region ER3 (Base: 0x00010000, Size: 0x00000010, Max: 0x00002000, ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object 0x00010000 0x0000000c Code RO 3 .text function.o 0x0001000c 0x00000004 Data RW 15 foo main.o … NoteIf you omit*(foo)
from the scatter file, the section is placed in the region of the same type. That is
RAM in this example. Related referenceExample of how to place a variable at a specific address with scatter-loadingThis example shows how to modify your source code to place code and data at a specific address using a scatter file. To modify your source code to place code and data at a specific address
using a scatter file:
The memory map shows that the variable is placed in the
ER2 execution region at address :… Execution Region ER2 (Base: 0x00001578, Size: 0x0000ea8c, Max: 0xffffffff, ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object 0x00001578 0x0000000c Code RO 3 .text function.o 0x00001584 0x0000ea7c PAD 0x00010000 0x00000004 Data RO 15 .ARM.__at_0x10000 main.o… In this example, the size of
ER1 is unknown. Therefore, gValue might be placed in ER1 or ER2 . To make sure that gValue is
placed in ER2 , you must include the corresponding selector
in ER2 and link with the --no_autoat command-line option. If you omit --no_autoat , gValue is to placed in a separate load region LR$$.ARM.__at_ that contains the execution region ER$$.ARM.__at_ .Related reference | ||||||||||
|
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.