Keil Logo

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);
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.