Invocation 
and 
Operation 
of 
the 
TMS34010 
C 
Compiler 
3.5 
Assembling 
a  C 
Program 
The  GSPC  batch  file 
automatically 
produces  and  assembles 
TMS34010 
as-
sembly language source from  C programs, The assembly language source file 
is 
available 
under 
the name 
<input 
file>,ASM, 
If 
you 
wish 
to 
see 
an 
assembler 
listing 
of 
the file, 
you 
must 
explicitly 
assemble this file using the 
-I 
option 
of 
the 
GSP assembler,  • 
Appendix 
E is 
an 
example 
showing 
the assembly  language produced  from  C 
programs, 
3.6 
Archiving 
a  C 
Program 
C  program 
object 
files  may be  archived  using the  GSPAR  archiver  program, 
Libraries 
should 
be  organized  so 
that 
all  references 
to 
external  symbols 
or 
functions 
are  defined 
within 
the same  library 
or 
in  a 
following 
library,  See the 
TMS34010 
Assembly 
Language Tools User's Guide 
for 
more information, 
3.7 
Linking a  C 
Program 
Modular 
code is an 
important 
concept 
in 
writing 
software 
because it simplifies 
the tasks 
of 
debugging 
and 
porting, 
To 
make 
this 
modularization 
possible, the 
programmer 
must 
have 
the 
capability 
to 
link 
separate 
modules 
into 
one exe-
cutable program, The 
TMS3401 
0  C 
environment 
offers 
this 
capability 
by 
pro-
viding 
an  assembler 
that 
produces 
object 
code 
which 
is  linkable 
by 
the 
TMS34010 
linker. 
In 
the 
simplest case, a C program consisting 
of 
modules 
prog1, 
prog2, etc, can 
be 
linked 
to 
produce 
an 
executable 
output 
file called 
prog,out 
by 
invoking 
the 
linker 
as 
follows: 
gsplnk 
~ 
~ 
prog.out 
progl.obj 
prog2.obj 
~ 
rts.lib 
[flib.libJ 
For 
further 
information, 
refer 
to 
the 
TMS34010 
Assembly 
Language  Tools 
User's Guide, 
3.7.1 
Run-Time 
Initialization 
All 
C programs 
must 
be  linked 
with 
an 
object 
module 
called boot.obj, 
which 
contains 
code 
and  data 
for 
initializing 
the 
run-time 
environment,  This 
is 
the 
first 
code 
executed 
when 
the 
program begins 
running, 
and 
it 
has the 
following 
responsi bi I ities: 
•  Sets 
up 
the 
system stack. 
•  Processes 
the 
run-time 
initialization  table  and  auto-initializes 
global 
variables, 
•  Disables 
interrupts and calls 
-main. 
Boot.obj 
is 
supplied 
in 
the 
run-time 
support 
object 
library RTS,LI 
B, 
If 
you 
use 
the 
C 
code 
option 
with 
GSPLNK 
and 
include 
RTS,LlB in 
your 
link 
control 
file, 
boot.obj 
is 
automatically 
linked  in  (see  Section  3,7,3,  The 
-c 
Option 
in  the 
Linker). 
Alternatively, 
you 
can  use  the  archiver  GSPAR 
to 
extract 
boot.obj 
from 
the library and 
link 
it 
in explicitly. 
3-7