Keil Logo

OMF2 Compiler Directive






The C51 Compiler, by default, generates Intel OMF51 object modules.
The CX51 Compiler, by default, generates OMF2 object modules.


Project — Select Device — Use LX51 instead of BL51.


The OMF2 directive enables the OMF2 file format which provides detailed symbol type checking across modules and eliminates the historic limitations of the Intel OMF51 file format.

The OMF2 file format is required to use the following features of the Cx51 Compiler:

  • Variable Banking: The VARBANKING directive enables use of the far memory type.
  • XDATA ROM: Using the const xdata memory type specifies that XDATA variables are located in ROM.
  • RAM Strings: The STRING directive specifies that string constants are located in xdata or far space.
  • Dallas 390/400/5240/5250 Contiguous Mode: The ROM (D512K) and ROM (D16M) directives enable the contiguous mode of the Dallas Semiconductor 390 and variants.

The OMF2 file format requires the extended LX51 Linker/Locater and cannot be used with the BL51 Linker/Locater.


#pragma O2

Related Knowledgebase Articles

  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.