beautypg.com

Zilog ZUSBOPTS User Manual

Page 348

background image

Program Configurations

UM017105-0511

320

Zilog Developer Studio II – ZNEO™
User Manual

1. To set up this configuration, you must place the CODE segment in ERAM at run time

and EROM at load time. Do this by adding the following linker commands in the

Additional Linker Directives

dialog box (see

Additional Directives

– see page 62):

change code=ERAM /* Run time CODE is in ERAM space */

copy code EROM /* Load time CODE is in EROM space */

define _low_code_copy = copy base of CODE

define _low_code = base of CODE

define _len_code = length of CODE

2. The linker COPY directive only designates the load addresses and the run-time

addresses for the segment. The actual copying of the segment must be performed by
the start-up code. For example if you are using the small model, copy and modify the
C startup provided in the installation under

src\boot\common\startupexs.asm

,

rewriting the relevant section as follows:

;

; Copy CODE into ERAM

;

LEA

R0,_low_code_copy

LEA

R1,_low_code

LD

R2,#_len_code+1

JP

clab1

clab0:

LD.B

R3,(R0++)

LD.B

(R1++),R3

clab1:

DJNZ

R2,clab0

XREF

_low_code_copy:EROM

XREF

_len_code:ERAM

XREF

_low_code:ERAM

3. Finally, add your modified start-up module to your project. Select the

Included in

Project

button in the

Objects and Libraries

page of the

Project Settings

dialog box

(see

C Start-up Module

– see page 66) and also add the modified source code file to

your project using the Add Files command from the

Project

menu.

Special Case: Partial Copy to ERAM

A special case of this configuration is when you want to copy program code from just one
C source file into ERAM, while retaining the rest of the code in EROM. This allows you
to gain the potential speed advantages of external RAM over external Flash for a specific
module. Perform the following steps:

1. Select the

Distinct Code Segment for Each Module

checkbox in the

Advanced

page in the

Project Settings

dialog box (see

page 59

).

This manual is related to the following products: