Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->Running the Compiler from the Command Line

When the compiler is run from within the Embedded Development Studio, the command line options will be automatically generated in accordance with the settings made in the Project->Settings->Compiler tab plus the compiler command line options specified for the selected Family Member in the target.ini file.  These command line options will be displayed at the beginning of the compile process if the Display command line option is checked in the Project->Settings->General tab.

This section describes these command line options and also describes how the compiler can be run from the command line.

The C compiler is run from the command line with the command:

CL [sfiles] [/options]

where    [sfiles] is a list (separated by spaces) of source files to be compiled
and    [/options] is a list (separated by spaces) of compiler, cross assembler and linker options.

The filenames and options may be in any order on the command line but note that the first filename is used to create the filename for the program code.

The C source filenames must have an extension otherwise they are assumed to be object files which are included in the link but are not compiled.  If a file has the extension .ASM it is assumed to be an assembler code file and the cross assembler is invoked to assemble it.

Each source file is compiled (or assembled if the file is an assembler code file) to create a relocatable object module.  This object module is placed in a file whose name is the same as that of the source file but with a .OBJ extension.

Unless the /c option is used, these object code files will be linked to create the final program code (by default in S record format).  The default library files are automatically searched for any unresolved references.  The default library files will depend upon which chip the program is being compiled for.

The filename used for the program code is the same as the first source filename but with no extension.  The link map is placed in a file with a filename constructed from the name of the first source filename but with a .MAP extension.

The compiler options are described in the following section.  See the section describing the cross assembler for the cross assembler options and the section describing the linker for the linker options.  An example command line is:


This command line will compile files MAIN.C and CALCS.C to produce object files MAIN.OBJ and CALCS.OBJ.  File IO.ASM will be assembled to produce object file IO.OBJ.  Files MAIN.OBJ, CALCS.OBJ, IO.OBJ and TIMER.OBJ are then linked to produce program code file MAIN and a link map file MAIN.MAP.

/Fc is a compiler option and this causes the compiler to create commented assembly code listings for the C files in MAIN.LST and CALCS.LST.  (The cross assembler also creates a listing file IO.LST but this is created whether or not the /Fc option is used.)

/NOROM is a linker option which tells the linker that the program code and data share the same address space.

/DTEST causes the identifier TEST to be defined.