beautypg.com

Zilog EZ80F916 User Manual

Page 270

background image

UM014423-0607

Using the Linker/Locator

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

250

Examples

To make a copy of a code segment in ROM, use the following procedure:

1. In the assembly code, define a code segment (for example,

codeseg

) to be a segment

located in RAM. This is the run-time location of

codeseg

.

2. Use the following linker command:

COPY codeseg ROM

The linker places the actual contents associated with

codeseg

in ROM (the load time

location) and associates RAM (the run-time location) addresses with labels in

codeseg

.

NOTE: You need to copy the

codeseg

contents from ROM to RAM at run time as part of the

startup routine. You can use the

COPY BASE OF

and

COPY TOP OF

linker expressions to

get the base address and top address of the contents in ROM. You can use the BASE OF
and TOP OF linker expressions to get the base address and top address of

codeseg

.

To copy multiple segments to RAM, use the following procedure:

1. In the assembly code, define the segments (for example,

strseg

,

text

, and

codeseg

) to be segments located in RAM. This is the run-time location of the

segments.

2. Use the following linker commands:

CHANGE strseg=codeseg

CHANGE text=codeseg

COPY codeseg RAM

The linker renames

strseg

and

text

as

codeseg

and performs linking as described

in the previous example. You need to write only one loop to perform the copy from
ROM to RAM at run time, instead of three (one loop each for

strseg

,

text

, and

codeseg

).

To allocate a string segment in ROM but not generate the initialization, use the following
procedure:

1. In the assembly code, define the string segment (for example,

strsect

) to be a

segment located in ROM.

2. Use the following linker command:

COPY strsect NULL

The linker associates all the labels in

strsect

with an address in ROM and does not

generate any loadable data for

strsect

. This is useful when ROM is already

programmed separately, and the address information is needed for linking and
debugging.

This manual is related to the following products: