#pragma SYMBOLS CODE DEBUG
In the above examples, SYMBOLS, CODE, and DEBUG are all control directives.
testfile.c is the source file to be compiled.
NOTE
The syntax is the same for the command line and the #pragma directive.
Multiple options, however, may be specified on the #pragma line.
Typically, each control directive may be specified only once at the beginning of
a source file. If a directive is specified more than once, the compiler
generates a
fatal error and aborts compilation. Directives that may be specified more than
once are so noted in the following sections.
Directive Categories
Control directives can be divided into three groups: source controls, object
controls, and listing controls.
Source controls define macros on the command line and determine the name
of the file to be compiled.
Object controls affect the form and content of the generated object module
(*.OBJ). These directives allow you to specify the optimizing level or
include debugging information in the object file.
Listing controls govern various aspects of the listing file (*.LST), in
particular its format and specific content.
Keil Software — Cx51 Compiler User’s Guide 23
The following table is an alphabetical list of the control directives.
Unterlined
characters denote the abbreviation of the directive.
Directive Class Description
AREGS,
NOAREGS
Object Enable or disable absolute register (ARn) addressing.
ASM, ENDASM Object Marks the beginning and the end of an inline assembly block.
BROWSE † Object Enable generation of browser information.
CODE † Listing Add an assembly listing to the listing file.
COMPACT † Object Select COMPACT memory model.
COND,
NOCOND †
Listing Include or exclude source lines skipped from the preprocessor.
DEBUG † Object Include debugging information in the object file.
DEFINE Source Define preprocessor names in the Cx51 invocation line.
DISABLE Object Disables interrupts for the duration of a function.
EJECT Listing Inserts a form feed character into the listing file.
FLOATFUZZY Object Specify number of bits rounded during floating compare.
INCDIR, ID † Source Specify additional path names for include files.
INTERVAL † Object Specify the interval for interrupt vectors for SIECO chips.
INTPROMOTE,
NOINTPROMOTE †
Object Enable or disable ANSI integer promotion.
INTVECTOR,
NOINTVECTOR †
Object Specify base address for interrupt vectors or disable vectors.
LARGE † Object Select LARGE memory model.
LISTINCLUDE Listing Display contents of include files in the listing file.
MAXARGS † Object Specify size of variable argument lists.
MOD517,
NOMOD517
Object Enable or disable code to support the additional hardware
features of the 80C517 and derivatives.
MODA2,
NOMODA2
Object Enable or disable dual DPTR register support for Atmel 82x8252
and variants.
MODDP2,
NOMODDP2
Object Enable or disable dual DPTR register support for Dallas
Semiconductor 320, 520, 530, 550 and variants.
MODP2,
NOMODP2
Object Enable or disable dual DPTR register support for Philips and
Temic derivatives.
NOAMAKE † Object Disable information records for AutoMAKE.
NOEXTEND † Source Disable Cx51 extensions to ANSI C.
OBJECT,
NOOBJECT †
Object Enable object file and optionally specify name or suppress the
object file.
OBJECTEXTEND † Object Include additional variable type information in the
object file.
ONEREGBANK Object Assume that only registerbank 0 is used in interrupt code.
OMF2 † Object Generate OMF2 output file format.
OPTIMIZE Object Specify the level of optimization performed by the compiler.
24 Chapter 2. Compiling with Cx51
2
Directive Class Description
ORDER † Object Variables are allocated in the order in which they appear in the
source file.
PAGELENGTH † Listing Specify number of rows on the page.
PAGEWIDTH † Listing Specify number of columns on the page.
PREPRINT † Listing Produce a preprocessor listing file where all macros are
expanded.
PRINT, NOPRINT † Listing Specify a name for the listing file or disable the
listing file.
REGFILE † Object Specify a register definition file for global register
optimization.
REGISTERBANK Object Select the register bank that is used for absolute register
accesses.
REGPARMS,
NOREGPARMS
Object Enable or disable register parameter passing.
RET_PSTK †,
RET_XSTK †
Object Use reentrant stack for saving return addresses.
ROM † Object Control generation of AJMP/ACALL instructions.
SAVE,
RESTORE
Object Saves and restores settings for AREGS, REGPARMS and
OPTIMIZE directives.
SMALL † Object Select SMALL memory model. (Default.)
SRC † Object Create an assembler source file instead of an object module.
STRING † Object Locate implicit string constants to xdata or far memory.
SYMBOLS † Listing Include a list of all symbols used within the module in the
listing
file.
VARBANKING † Object Use library set for variable banking support.
WARNINGLEVEL † Listing Selects the level of Warning detection.
† These directives may be specified only once on the command line or at the
beginning of a source
file using in the #pragma statement. They may not be used more than once in a
source file.
具体的讲就是在程序中加:
#pragma SRC
用C51编译一遍后去掉该行将编译输出的SRC文件再用ASM51编译一边