FAQ:Link
From GNU 68HC11/HC12
Revision as of 23:59, 25 January 2006 by Stephane.Carrez (Talk | contribs)
This FAQ section deals with the GNU linker. The linker is the tool that you will use to do the final link and create the final binary based on one or several object files and libraries.
Contents |
Mapping Programs to Memory
What is the memory.x?
The memory.x file is used when you use the m68hc11elfb linker script. It defines memory banks that tell the linker where to put the text, data and other program sections. The name of memory banks are specified within the linker script. A typical memory.x file defines the MEMORY banks as follows:
MEMORY { page0 (rwx) : ORIGIN = 0x0, LENGTH = 256 text (rx) : ORIGIN = 0xE000, LENGTH = 2048 data : ORIGIN = 0x0, LENGTH = 0 }
This definition creates 3 memory banks:
- page0 represents a the HC11/HC12 region for direct addressing mode. This memory bank must always be completely included in the [0..0x0ff] interval.
- text represents the memory bank where the linker will put the .text sections which contains the code. In most cases it represents the ROM of the board (but it can also represent RAM).
- data represents the memory bank used to put the initialized and non-initialized data. This bank usually represents RAM.
See Also How does the linker know where memory.x is?