CHAPTER 5: LINKER
S5U1C63000A MANUAL EPSON 101
(S1C63 FAMILY ASSEMBLER PACKAGE)
test1.o test.abs
Data ROM area
RAM area
0x0000
0x0100
0x0110
0x8000
0x8400
0x0000
0x0400
0xf000
0xff00
0x00ff
0x010f
0x1fff
0x83ff
0x87ff
0x03ff
0x07ff
0xfeff
0xffff
CODE2
DATA1
DATA2
CODE3
CODE4
CODE1
BSS1
BSS4
BSS4
BSS3
Code ROM area
Display memory
I/O memory area
test1.o
CODE1 (relocatable)
DATA1 (relocatable)
BSS1 (relocatable)
CODE2 (absolute 0x0100–)
BSS2 (absolute 0xf000–)
test2.o
CODE3 (relocatable)
DATA2 (absolute 0x8400–)
BSS3 (absolute 0xff00–)
CODE4 (relocatable)
BSS4 (relocatable)
Fig. 5.10.2 Example of linking
The absolute sections CODE2, BSS2, DATA2 and BSS3 are mapped to the location specified in the
source files.
The start addresses of the CODE and BSS relocatable sections in "test2.o" is specified by the -rcode and
-rbss options, so CODE3 is mapped from address 0x0110 and CODE 4 follows CODE3. BSS4 is
mapped from address 0x0400.
Since the start addresses of the relocatable CODE, DATA and BSS sections in "test1.o" have not been
specified, they are mapped from the relocatable section start addresses specified by the -code, -data
and -bss options. First the linker will try to map CODE1 from address 0x0000 to address 0x00ff. If
CODE 1 is smaller than 0x100 words, CODE1 can be mapped from address 0x0000. In this example,
CODE1 is mapped behind CODE4 because CODE1 is larger than 0x100 words.
DATA1 is mapped from address 0x8000 and BSS1 is mapped from address 0x0000.
A section cannot be overlapped to other sections, therefore an error will occur if there is no free area
larger than the section size. For example, an error will occur if CODE2 is larger than 0x10 words.