Linking - Epson S5U1C63000A User Manual

Cmos 4-bit single chip microcomputer manual
Table of Contents

Advertisement

CHAPTER 5: LINKER

5.10 Linking

Linking rules
The linking process takes place in conformity with the following rules:
• Absolute sections are mapped ahead of relocatable sections, according to the absolute addresses
which were defined at the time of assembling. If an absolute section exceeds the available memory
area, an error will occur.
• The relocatable sections in the file of which the section start address was specified with an option
(-rcode, -rdata, -rbss) are mapped from the specified address. Other relocatable sections are mapped
from top of the relocatable CODE/DATA/BSS section.
• Basically, the relocatable sections except those that are specified with the -rcode, -rdata or -rbss option
are arranged successively in the order of processing. However, if a relocatable section cannot be
mapped subsequent to the previous mapped section, for instance, there is unused area indicated by
the ICE parameter file or an already mapped absolute section, the linker searches another area to map
the section. If there is no available area, an error will occur. A section is not divided into two or more
blocks when it is mapped.
After that, another section may be mapped in the vacant area if it is possible to map there.
Restrictions on linking
Note that all sections may not be mapped depending on each section size or address specifications
even if the relocatable object size is within the available memory size.
Example of linking
A sample case where two relocatable object files, "test1.o" and "test2.o", are linked together under the
following condition is described further below.
Memory configuration of the model
Code ROM:
Data ROM:
RAM:
Display, I/O memory: 0xf000 to 0xffff
Relocatable object files
test1.o
CODE1
(relocatable)
CODE2
(absolute 0x0100–) (.org is used.)
DATA1
(relocatable)
BSS1
(relocatable)
BSS2
(absolute 0xf000–)
Sample linker command file
-code 0x0000
-rcode test2.o = 0x0110 ; CODE section start address of test2.o
-data 0x8000
-bss 0x0000
-rbss test2.o = 0x0400 ; BSS section start address of test2.o
-o test.abs
test1.o
test2.o
When linking is executed with the commands defined above, the linker maps the sections of each
module in the manner graphically presented in Figure 5.10.2.
100
0x0000 to 0x1fff
0x8000 to 0x87ff
0x0000 to 0x07ff
(.org is used.)
Fig. 5.10.1 Structure of sample relocatable files
; Relocatable CODE section start address
; Relocatable DATA section start address
; Relocatable BSS section start address
; Output file name
; Input file 1
; Input file 2
EPSON
test2.o
CODE3
(relocatable)
CODE4
(relocatable)
DATA2
(absolute 0x8400–)
BSS3
(absolute 0xff00–)
BSS4
(relocatable)
(S1C63 FAMILY ASSEMBLER PACKAGE)
(.org is used.)
S5U1C63000A MANUAL

Advertisement

Table of Contents
loading

Table of Contents