|
|||||||||||
|
Technical Support On-Line Manuals Linker User Guide |
Linker User GuidePlacing functions and data at specific addresses
Normally, the compiler produces RO, RW and ZI sections from a single source file. These regions contain all the code and data from the source file. To 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 has two methods that enable you to place a section at a specific address:
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:
This example shows how to modify your source code to place code and data at specific addresses, and does not require a scatter file:
In this example, NoteAlthough the address is specified as 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
This example shows how to modify your source code to place code and data in a specific section using a scatter file:
In this example, The memory map shows:
Load Region LR1 (Base: 0x00000000, Size: 0x000015d0, 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 This example shows how 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
...
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
| ||||||||||
|
|||||||||||