beautypg.com

Epson S5U1C62000A User Manual

Page 113

background image

S5U1C62000A MANUAL

EPSON

101

(S1C60/62 FAMILY ASSEMBLER PACKAGE)

CHAPTER 6: LINKER

test1.o

CODE1

(relocatable)

BSS1

(relocatable)

CODE2

(absolute 0x000–)

BSS2

(absolute 0xe00–)

test.abs

ROM area

RAM area

CODE2

0x0000

0x0110

0x000

0x500

0x600

0xe00

0xf00

0x010f

0x1fff

0x4ff

0x5ff

0xdff

0xeff

0xfff

CODE3

CODE4

CODE1

BSS1

BSS2

BSS3

BSS4

test2.o

CODE3

(relocatable)

BSS3

(absolute 0xf00–)

CODE4

(relocatable)

BSS4

(relocatable)

Fig. 6.10.2 Example of linking

The absolute sections CODE2, BSS2 and BSS3 are mapped to the location specified in the source files.
The start addresses of the relocatable sections in "test2.o" is specified by the -rcode and -rbss options,
so CODE3 is mapped from address 0x110 and CODE 4 follows CODE3. BSS4 is mapped from address
0x600.
Since the start addresses of the relocatable CODE and BSS sections in "test1.o" have not been specified,
they are mapped from the relocatable section start addresses specified by the -code and -bss options.
First the linker will try to map CODE1 from address 0x0100 to address 0x010f. If CODE2 is smaller
than 0x100 words and CODE 1 is smaller than 0x10 words, CODE1 can be mapped from address
0x0100. In this example, CODE1 is mapped behind CODE4 because CODE1 is larger than 0x10 words.
When the -or option is specified, the linker will try to map CODE1 in the same page as one of the
already mapped sections that has many branching relationships.
BSS1 is mapped from address 0x500, however it may be mapped behind BSS4 if BSS1 is larger than
0x100 words.
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 0x110 words.