beautypg.com

Interrupt support, Interrupt keyword – Zilog ZUSBOPTS User Manual

Page 190

background image

Language Extensions

UM017105-0511

162

Zilog Developer Studio II – ZNEO™
User Manual

tively. The local variables (nonstatic) and parameters are always allocated in RAM
address space, and any address specifiers, if used on them, are ignored.

Use of the small memory model does not impose any restriction on your code size.
The limitations of the small model are due to the somewhat limited amount of 16-bit
addressable RAM. Current ZNEO CPU parts offer up to 4KB of internal RAM, and
the ZDS II GUI restricts the total RAM linker address space (internal and external) to
16KB. If the local data and parameters exceed the available RAM size, then the small
memory model cannot be used. If the local data and parameters are within the RAM
size, but along with global data they exceed the RAM size, then the small model can
still be used but only by selectively placing the global data in the extended RAM
(ERAM) address space using the

_Far

keyword. Because ERAM is always located in

external memory, this solution requires adding external memory to your system.

Large Memory Model

In the large memory model, global variables are allocated in the ERAM address space.
The address of these variables is 32 bits. The locals and parameters are allocated on
stack, which is located in ERAM address space. The address of a local or parameter is
a 32-bit address. The global variables can be manually placed into the RAM, ROM, or
EROM address space by using the

_Near

,

_Rom

, and

_Erom

address specifiers,

respectively. The local variables (nonstatic) and parameters are always allocated in the
ERAM address space, and any address specifiers, if used on them, are ignored.

In the large memory model, the local and global data and parameters can span the
entire ERAM space, which can be configured at the user’s discretion to be much
larger than the space available in the RAM address space. Besides the requirement to
implement an external memory interface, the costs of using the large model are that
32-bit addressing is required to access the variables in ERAM, causing an increase in
code size. Also, pointers to these data are 32 bits, which might increase the data space
requirements if the application uses lots of pointers. It is possible that the application
might run more slowly if accesses to external memory require wait states. To reduce
the impact of some of these issues, you can selectively place your more frequently
accessed global and static data in RAM using the

_Near

keyword.

Interrupt Support

To support interrupts, the ZNEO C-Compiler provides the Interrupt Keyword and Inter-
rupt Vector Setup functions, as described below.

interrupt Keyword

Functions that are preceded by

#pragma interrupt

or are associated with the interrupt

storage class are designated as interrupt handlers. These functions should neither take
parameters nor return a value. The compiler stores the machine state at the beginning of

This manual is related to the following products: