beautypg.com

Segment naming – Zilog Z8F0130 User Manual

Page 270

background image

Using the ANSI C-Compiler

UM013037-1212

246

Zilog Developer Studio II – Z8 Encore!
User Manual

If you do not have any initialized global or static variables in far memory, the start-up
code does not have to set the initialized global and static far variables to their initial
value from ROM.

As an example, for the small model:

far int val = 20; // Not OK to skip initializing far data:

// Initialized global in far memory

int val = 20; // OK to skip initializing far data:

// Initialized global in near memory

For the large model:

int val = 20; // Not OK to skip initializing far data:

// Initialized global in far memory

near int val = 20; // OK to skip initializing far data:

// Initialized global in near memory

Alternatively, if your application does require global or static variables in far memory
to have initialized values and you perform the initialization in your program as part of
the code, the start-up code does not have to perform this function.

For example:

far int val;

void main (void)

{

val = 20; // Initialization performed as part of the code

}

This can be achieved by adding the following code just before

segment startup

:

COPYERAM SET FALSE

For the Z8 Encore! 16K XP Series CPUs, if you do not have any code in PRAM, the
start-up code does not have to copy the PRAM code from ROM to its PRAM location.

This can be achieved by adding the following code just before

segment startup

:

COPYPRAM SET FALSE

For Z8 Encore! microcontroller devices with small Flash memory sizes especially, the pre-
ceding steps can be very useful to reduce the code size of the C start-up module.

Segment Naming

The compiler places code and data into separate segments in the object file. The different
segments used by the compiler are listed in the following table.