 |
Cx51 User's Guide |
 |
|
|
|
|
XCROM Compiler Directive
| Abbreviation | XC |
| Arguments |
None.
|
| Default |
All xdata variables are initialized during the execution of
the startup code.
|
| µVision |
Options — C51 — Misc controls.
|
| Description |
The XCROM directive causes the compiler to store
initialization for const xdata variables directly in ROM
memory rather than using a table entry in ?C?INITSEG. This
allows you to use xdata memory for constants and frees up code memory
for your application program.
Note
-
Some new 8051 devices provide memory management units that can
map ROM space into the xdata memory area.
-
For classic 8051 devices, you may use a ROM device instead of a
RAM for the xdata space.
|
| See Also | STRING |
| Example |
// "Hello World\n" is stored in a ROM that
// is addressed in the xdata memory space.
#pragma XCROM // Enable const xdata ROM
const char xdata text [] = "Hello World\n";
void main (void) {
printf (text);
}
|
Related Knowledgebase Articles
|
|
|