beautypg.com

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

Page 338

background image

Program Configurations

UM017105-0511

310

Zilog Developer Studio II – ZNEO™
User Manual

Figure 132 and the other program configuration figures omit physical address and interface
information to emphasize that, once the address ranges have been defined in the project
setup, most memory locations can be expressed symbolically in terms of the functional
space (address range) in which they are located.

C Program Setup

This is the default setup provided by the development tools. You do not have to perform
any additional steps to achieve this configuration. A point to note is that if the C program
is a large model program, the data and stack reside in ERAM by default, so selecting the
large model is not appropriate unless the target has external random access memory that
you have configured in the target setup and added to the ERAM linker address range.

Assembly Program Setup

As an assembly user, you can choose either to use the default segments or to define and
use your own segments in various address spaces. To avoid problems, you must observe
the following guidelines to achieve the same configuration as that used in the default C
program configuration:

Locate the reset vector routine in the internal memory portion of ROM. For example:

vector reset = _startup

define ROMSEG, space=ROM, org=%70

segment ROMSEG

_startup: ; startup code here

; any external memory interface initialization should be done here

; any RAM/ERAM data copying should be done here

Locate the rest of the executable program in EROM. For example:

segment CODE

; program code goes here

Locate the initialized constant data in ROM/EROM.

Only allocate space for data in RAM/ERAM using the DS assembler directive and
make sure to not perform any initializations using the DB/DW/DL directive for such
data. Any initializations of RAM/ERAM data should be done in your code. For exam-
ple:

segment NEAR_BSS

val: DS 4

; allocate 4 uninitialized bytes: OK

segment code

ld r0, #%12345678

ld val, r0

; initialize ram location val as part of code: OK

Note:

This manual is related to the following products: