
UM017105-0511 Language Extensions
Zilog Developer Studio II – ZNEO™
User Manual
165
Placement of Consecutive Variables
The compiler also provides syntax to place several variables at consecutive addresses.
For example:
char ch1 _At 0xbef0;
char ch2 _At …;
char ch3 _At …;
This example places ch1 at address 0xbef0, ch2 at the next address (0xbef1) after ch1,
and
ch3 at the next address (0xbef2) after ch2. The _At … directive can only be used
after a previous
_At or _Align directive.
Alignment of a Variable
The following syntax can be used to declare a global or static variable aligned at a speci-
fied alignment:
char ch2 _Align 2; // ch2 is aligned at even boundary
char ch4 _Align 4; // ch4 is aligned at a four byte boundary
Only aligned variables with the rom or erom storage class specifiers can be initialized. The
aligned variables with the
near and far storage class specifiers cannot be initialized. The
uninitialized aligned variables are not initialized to zero by the compiler startup routine.
String Placement
When string constants (literals) such as "mystring" are used in a C program, they are
stored by the C-Compiler in RAM address space for the small memory model and in
ERAM address space for the large memory model. However, sometimes this default
placement of string constants does not allow you adequate control over your memory
usage. Therefore, language extensions are provided to give you more control over string
placement:
N"mystring". This constant defines a near string. The string is stored in RAM. The
address of the string is a _Near pointer.
F"mystring". This constant defines a far string. The string is stored in ERAM. The
address of the string is a _Far pointer.
R"mystring". This constant defines a ROM string. The string is stored in ROM. The
address of the string is a _Rom pointer.
Comentarios a estos manuales