beautypg.com

Zilog ZUSBOPTS User Manual

Page 339

background image

UM017105-0511

Program Configurations

Zilog Developer Studio II – ZNEO™

User Manual

311

segment NEAR_BSS

val: dl %12345678

; incorrect usage for production code, as RAM does

; not retain value across power cycles: NOT OK

If your application has a lot of such initializations, this approach can be tedious. In
that case, an alternative is to use the linker COPY directive and perform the physical
copy for all of the RAM data as a single loop in the startup. An example can be found
in the C startup provided in the installation under

src\boot\common\start-

ups.asm

:

;

; Copy ROM data into internal RAM

;

LEA

R0,_low_near_romdata

LEA

R1,_low_neardata

LD

R2,#_len_neardata+1

JP lab10

lab9:

LD.B R3,(R0++)

LD.B

(R1++),R3

lab10:

DJNZ R2,lab9

The installation also includes the following linker directives:

COPY NEAR_DATA EROM

define _low_near_romdata = copy base of NEAR_DATA

define _low_neardata = base of NEAR_DATA

define _len_neardata = length of NEAR_DATA

In the above linker directives,

NEAR_DATA

is the RAM segment containing initialized

data:

segment NEAR_DATA

val1: dl %12345678

val2: dl %23456789

val3: dl %3456789A

The linker

COPY

directive only designates the load addresses and the run-time

addresses for the segments. The actual copying of the data must be performed by the
user code as shown above.

Assembly users can perform their own external interface setup in the start-up code.
This can be made easier if you take advantage of some definitions provided by the
Configure Target dialog box (see the

Setup

section on page 76). An example can be

found in the C startup provided in the installation under

src\boot\com-

mon\startupexs.asm

. The ZDS II IDE generates the following linker directives

based on your settings in the Target Configure dialog box:

DEFINE __EXTCT_INIT_PARAM = $c0

This manual is related to the following products: