Assembly program setup – Zilog ZUSBOPTS User Manual
Page 349

UM017105-0511
Program Configurations
Zilog Developer Studio II – ZNEO™
User Manual
321
This directs the C-Compiler to generate different code segment names for each file.
2. Add the linker commands to place the particular segment in ERAM at run time and
EROM at load time.
For example, to copy the code for
main.c
to ERAM, add the following linker com-
mands in the
Additional Linker Directives
dialog box (see
change main_TEXT=ERAM /* Run time main_TEXT is in ERAM space */
copy main_TEXT EROM /* Load time main_TEXT is in EROM space */
define _low_main_copy = copy base of main_TEXT
define _low_main = base of main_TEXT
define _len_main = length of main_TEXT
3. 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 main_TEXT into ERAM
;
LEA
R0,_low_main_copy
LEA
R1,_low_main
LD
R2,#_len_main+1
JP
mlab1
mlab0:
LD.B
R3,(R0++)
LD.B
(R1++),R3
mlab1:
DJNZ
R2,mlab0
XREF
_low_main_copy:EROM
XREF
_len_main:ERAM
XREF
_low_main:ERAM
4. Finally, add your modified start-up module to your project by selecting the
Included
in Project
button in the
Objects and Libraries
page of the
Project Settings
dialog
– see page 66) and also add the modified source code file
to your project using the Add Files command from the
Project
menu.
Assembly Program Setup
The Assembly program setup for the Copy to ERAM Program Configuration is similar to
the Default Program Configuration with some additional guidelines, as described in this
section.