Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
59
Добавлен:
14.04.2015
Размер:
1.37 Mб
Скачать

20

Chapter 2. Compiling with the Cx51 Compiler

 

 

Control Directives

The Cx51 compiler offers a number of control directives that you may use to control compilation. Directives are composed of one or more letters or digits and, unless otherwise specified, can be specified after the filename on the command line or within a source file using the #pragma directive. For example:

2

C51 testfile.c SYMBOLS

CODE

DEBUG

#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

21

 

 

The following table is an alphabetical list of the control directives. The underlined characters denote the abbreviation of the directive.

Directive

Class

 

Description

 

 

 

AREGS,

Object

 

Enable or disable absolute register (ARn) addressing.

 

 

 

NOAREGS

Source

 

Marks the beginning and the end of an inline assembly block.

 

 

 

ASM, ENDASM

 

 

 

2

BROWSE

Object

 

Enable generation of browser information.

 

 

CODE

Listing

 

Add an assembly listing to the listing file.

 

 

COMPACT

Object

 

Select COMPACT memory model.

 

 

 

COND,

Listing

 

Include or exclude source lines skipped by the preprocessor.

 

 

 

NOCOND

 

 

 

 

 

 

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

Source

 

Specify additional path names for include files.

 

 

 

INTERVAL

Object

 

Specify the interval for interrupt vectors for SIECO chips.

 

 

 

INTPROMOTE,

Object

 

Enable or disable ANSI integer promotion.

 

 

 

NOINTPROMOTE

 

 

 

 

 

 

INTVECTOR,

Object

 

Specify base address for interrupt vectors or disable vectors.

 

 

 

NOINTVECTOR

 

 

 

 

 

 

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,

Object

 

Enable or disable code to support the additional hardware

 

 

 

NOMOD517

 

 

features of the 80C517 and derivatives.

 

 

 

MODA2,

Object

 

Enable or disable dual DPTR register support for Atmel 82x8252

 

 

 

NOMODA2

 

 

and variants.

 

 

 

MODAB2,

Object

 

Enable or disable dual DPTR register support for Analog Device

 

 

 

NOMODAB2

 

 

MicroConverter ADuC B2 series.

 

 

 

MODDA,

Object

 

Enable or disable code to support the arithmetic accelerator

 

 

 

NOMODDA

 

 

available in Dallas 80C390, 80C400, and 5240.

 

 

 

MODDP2,

Object

 

Enable or disable dual DPTR register support for Dallas

 

 

 

NOMODDP2

 

 

Semiconductor 320, 520, 530, 550 and variants.

 

 

 

MODP2,

Object

 

Enable or disable dual DPTR register support for Philips and

 

 

 

NOMODP2

 

 

AtmelWM derivatives.

 

 

 

NOAMAKE

Object

 

Disable information records for Vision2 Update function.

 

 

 

NOEXTEND

Source

 

Disable Cx51 extensions to ANSI C.

 

 

 

OBJECT,

Object

 

Specify a name for the object file or suppress the object file.

 

 

 

NOOBJECT

 

 

 

 

 

 

OBJECTEXTEND

Object

 

Include additional variable type information in the object file.

 

 

 

ONEREGBANK

Object

 

Assume that only registerbank 0 is used in interrupt code.

 

 

 

 

 

22

 

 

Chapter 2. Compiling with the Cx51 Compiler

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Directive

Class

Description

 

 

 

 

OMF2

Object

Generate OMF2 output file format.

 

 

 

 

OPTIMIZE

Object

Specify the level of optimization performed by the compiler.

 

 

 

 

ORDER

Object

Allocate variables in the order of their appearance in the source

 

 

 

 

 

 

file.

 

 

 

 

PAGELENGTH

Listing

Specify the number of rows on the page.

 

2

 

 

PAGEWIDTH

Listing

Specify the 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 to use for absolute register accesses.

 

 

 

 

REGPARMS,

Object

Enable or disable register parameter passing.

 

 

 

 

NOREGPARMS

 

 

 

 

 

 

RET_PSTK ,

Object

Use reentrant stack for saving return addresses.

 

 

 

 

RET_XSTK

 

 

 

 

 

 

ROM

Object

Control generation of AJMP/ACALL instructions.

 

 

 

 

SAVE,

Object

Saves and restores settings for AREGS, REGPARMS and

 

 

 

 

RESTORE

 

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.

 

 

 

 

USERCLASS

Object

Renames memory class names for flexible variable location.

 

 

 

 

VARBANKING

Object

Enable far memory type variables.

 

 

 

 

WARNINGLEVEL

Listing

Select the level of Warning detection.

 

 

 

 

XCROM

Object

Assume ROM space for const xdata variables.

 

† 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.

Control directives and their arguments, with the exception of arguments specified with the DEFINE directive, are not case sensitive.

Соседние файлы в папке HLP