FAQ:Link

From GNU 68HC11/HC12
(Difference between revisions)
Jump to: navigation, search
 
(What is the memory.x?)
Line 4: Line 4:
  
 
===What is the memory.x?===
 
===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?
 +
 
===How does the linker know where memory.x is?===
 
===How does the linker know where memory.x is?===
 
===What does "region text is full" mean?===
 
===What does "region text is full" mean?===

Revision as of 23:59, 25 January 2006

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?

How does the linker know where memory.x is?

What does "region text is full" mean?

How can I put the soft registers in a specific section?

What is the page0 concept?

Memory Banks

What is the address problem with 68HC12 memory banks?

How can I link in several memory banks?

MC9S12DP256 Addressing Explained

Optimizations

How do I tell the compiler to use direct addressing mode to access data

How can I remove unused functions?

Misc

Where is _io_ports defined?

What does "linking files compiled for 16-bit integers and others for 32-bit integers" mean?

What is the crt0 and how can I remove it?

Personal tools