Compiler
Operation
-
Compiling
and
Assembling
a
Program
3.4
Compiling
and
Assembling
a
Program
The compiler creates a single assembly language source file
as
output,
which
you can assemble and link to form
an
executable object module. You can
compile several C source programs, assemble each
of
them, and then
link
them
together. (The
TMS34010
Assembly Language Tools User's Guide describes
the TMS3401
0 assembler and linker.)
Example
3-1 and Example
3-2
show
two
different methods
for
compiling and
assembling a C program. Both
of
these examples compile and assemble a C
source file called
program.
c and create
an
object file called
program.
obj.
Example 3-1 shows
how
you can accomplish this
by
invoking the pre-
processor, the parser, the code generator, and the
assembler in separate steps.
Example
3-2
shows
how
you can use a batch file for compiling and assembl-
ing a file in one step.
Example
3-1.
Method
1 -
Invoking
Each
Tool
Individually
1)
Invoke the preprocessor; use
program.
c for input:
gspcpp
program
C
Pre-Processor,
Version
3.xx
(c)
Copyright
1988,
Texas
Instruments
Incorporated
This creates
an
output
file called
program.
cpp.
2)
Invoke the parser; use
program.
cpp
for input:
gspcc
Jilrogram
C
Comp~ler,
Version
3.xx
(c)
Copyright
1988,
Texas
Instruments
Incor~orated
"program.c"
==)
main
This creates
an
output
file called
program.
if.
3)
Invoke the code generator; use
program.
if
for input:
gspcg
program
C
Codegen,
Version
3.xx
(c)
Copyright
1988,
Texas
Instruments
Incorporated
"program.c"
==)
main
This creates
an
output
file called
program.
asm.
4)
Assemble
program.
asm:
gspa
program
COFF
Assembler,
Version
3.xx
(c)
Copyright
1988,
Texas
Instruments
Incorporated
PASS 1
PASS 2
No
Errors,
No
Warnings
This creates
an
output
file named
program.
obj
Two
batch files,
gspc
and
gspq,
are
included
as
part
of
the
TMS34010
C
compiler
package. The batch files expect C source files
as
input; each pro-
duces object
files that can be linked. The batch files
are
essentially the same;
however,
gspc
produces diagnostic and· progress messages
while
gspq
is a
3-11