Keil Logo

Directives

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

CA testfile.c SYMBOLS CODE DEBUG

or

#pragma SYMBOLS CODE DEBUG

The source file to compile is testfile.c and SYMBOLS, CODE, and DEBUG are the directives.

Control directives may be divided into three groups:

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

Note

  • The syntax is the same for the command line and #pragma. Multiple options, however, may be specified on the #pragma line.
  • Some directives may be specified only once at the beginning of a source file. If one of these directives is specified more than once, the compiler generates a fatal error and aborts compilation.

The following table is an alphabetical list of the control directives available in the CARM Compiler.

Directive Group Description
ARM Object Generates code for native ARM CPU mode.
BIGENDIAN1 Object Generates code for big endian configuration.
BROWSE1 Object Enables source browser information.
CODE1 Listing Includes generated assembly in the listing file.
COND Listing Includes (in the listing file) conditional source lines skipped by the preprocessor.
DEBUG1 Object Includes debugging information in the object file.
DEFINE3 Source Defines preprocessor names on the command line.
EJECT2 Listing Inserts a form feed character into the listing file.
FLOAT64 Object Enables 64-bit floating-point math support.
INCDIR1 Source Sets additional include file paths.
INIT2 Object Signals variables that should be initialized at startup.
INTERWORK Object Generates veneers to allow code to be used from ARM and THUMB CPU mode.
LISTINCLUDE Listing Adds contents of include files into the listing file.
NOALIAS1 Object Ignores write operations through pointers when optimizing.
NOCOND Listing Excludes (from the listing file) conditional source lines skipped by the preprocessor.
NOEXTEND1 Source Disables extensions to ANSI C.
NOINIT2 Object Signals variables that should not be initialized at startup.
NOINTERWORK Object Generates code that can only be used from the current CPU mode.
NOOBJECT1 Object Disables object file generation.
NOPRINT1 Listing Disables listing file generation.
OBJECT1 Object Specifies the name for the object file.
OPTIMIZE Object Specifies the level of optimization performed by the compiler.
PACK Object Specifies the boundary for structure packing.
PAGELENGTH1 Listing Specifies the number of lines on a page in the listing file.
PAGEWIDTH1 Listing Specifies the number of characters on a line in the listing file.
PREPRINT1 Listing Produces a preprocessor listing file with expanded macros.
PREPRINTONLY1 Listing Produces a preprocessor listing file with expanded macros and halts.
PRINT1 Listing Specifies the name for the listing file.
RESTORE2 Object Restores settings for the OPTIMIZE directive.
SAVE2 Object Saves settings for the OPTIMIZE directive.
SIGNED_CHAR1 Object Defaults all char types to signed.
SYMBOLS1 Listing Includes a symbol list in the listing file.
TABS1 Listing Specifies the tab character expansion width for the listing file.
THUMB1 Object Generate code for native ARM CPU mode.
WARNING2 Listing Changes the level of a warning.
WARNINGLEVEL1 Listing Selects the level of warning detection.

Note

  1. These directives apply to the entire source file and may be specified only once on the command line or at the beginning of the source file using the #pragma statement. They may not be used more than once in a source file.
  2. These directives may not be specified on the command line. They may only be specified in the source file.
  3. Directives and arguments, with the exception of arguments specified with the DEFINE directive, are not case sensitive.
  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.