Copy to eram program configuration – Zilog ZUSBOPTS User Manual
Page 346

Program Configurations
UM017105-0511
318
Zilog Developer Studio II – ZNEO™
User Manual
Write all of the executable program code (non-start-up code) under the CODE segment.
This segment belongs to EROM address space. To set up this configuration, you must
move the CODE segment from EROM to the RAM address space. Do this by adding the
following linker command in the
Additional Linker Directives
dialog box (see
change code=RAM /* The linker will then allocate code segment in
RAM */
To go back to the Default Program Configuration for production code, remove this direc-
tive from the
Additional Linker Directives
dialog box.
Special Case: Partial Download to RAM
A special case of this configuration is when you want to download program code from just
one assembly segment into RAM, while retaining the rest of the code in EROM. This
allows you to experiment with different partitions of your code, for instance if you are
considering the Partial Copy to RAM Program Configuration discussed in the
section on page 325. Perform the following steps:
1. Use a distinct segment name for the particular segment. For example:
Define main_TEXT, space=EROM
segment main_TEXT
; code goes here
2. Use the linker CHANGE directive to move the particular segment to RAM.
For example, to download the code for the
main_TEXT
segment to RAM, add the fol-
lowing linker command in the
Additional Linker Directives
dialog box (see
change main_TEXT = RAM
To go back to the Default Program Configuration for production code, remove this
directive from the
Additional Linker Directives
dialog box.
Copy to ERAM Program Configuration
The Copy to ERAM Program Configuration, shown in Figure 135, can be used for pro-
duction as well as development code. It is somewhat similar to the Default Program Con-
figuration, the only difference being that aside from the start-up code, the rest of the
executable program is downloaded into EROM, copied from EROM to ERAM by the
start-up code, and then executed from ERAM. The reason for choosing this configuration
is that while internal Flash on ZNEO-CPU-based devices can be accessed quickly enough
to keep up with the CPU, that might not be true of external Flash. If you have both exter-
nal Flash (as part of the EROM address range) and external RAM (as part of ERAM) in
your application and if the external RAM is faster than the external Flash, the user pro-
gram might execute faster on ERAM. Therefore, this configuration might be advantageous
if you want to execute your program from external memory (for example, because your