beautypg.com

C program setup, Assembly program setup – Zilog ZUSBOPTS User Manual

Page 342

background image

Program Configurations

UM017105-0511

314

Zilog Developer Studio II – ZNEO™
User Manual

C Program Setup

The C program setup for the Download to ERAM Program Configuration is similar to the
Default Program Configuration with some additional steps as described in this section.

The C-Compiler by default generates the executable program code under one unified seg-
ment named CODE. The CODE segment belongs to EROM address space. To set up this
configuration, you must move this CODE segment from EROM to ERAM address space.
Do this by adding the following linker command in the

Additional Linker Directives

dia-

log box (see the

Additional Directives

section on page 62):

change code=ERAM /* The linker will then allocate code segment in

ERAM */

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 ERAM

A special case of this configuration is to download program code from just one C source
file into ERAM, while retaining the rest of the code in EROM. This example is included
for completeness because similar cases of partitioning the code are discussed for the other
configurations that are covered in this chapter.

Perform the following steps:

1. Select the

Distinct Code Segment for Each Module

checkbox in the

Advanced

page in the

Project Settings

dialog box (discussed on

page 59

). This option directs

the C-Compiler to generate different code segment names for each file.

2. Use the linker CHANGE directive to move the particular segment to ERAM.

For example, to download the code for

main.c

to ERAM, add the following linker

command in the

Additional Linker Directives

dialog box (see

Additional Directives

– see page 62):

change main_TEXT = ERAM

To go back to the Default Program Configuration for production code, remove this
directive from the

Additional Linker Directives

dialog box.

Assembly Program Setup

The Assembly program setup for the Download to ERAM Program Configuration is simi-
lar to the Default Program Configuration with some additional guidelines, as described in
this section.

Write all of the executable program (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 ERAM address space by adding the following linker

This manual is related to the following products: