Texas Instruments TMS470R1x Barcode Reader User Manual


 
Getting Started With the C Compiler
5-8
3) Also by default, the shell creates a COFF object file as output; however,
if you use the –z option, the output is an
executable
object module. The
following examples show two ways of creating an executable object
module:
a) The example in step 2 creates an object file called function.obj. To
create an executable object module, run the linker separately by
invoking lnk470 as in the following example:
lnk470 –c function.obj lnk32.cmd –o function.out –l rts32.lib
The –c linker option tells the linker to observe the C language linking
conventions. The linker command file, lnk32.cmd, is shipped with the
code generation tools. The –o option names the output module,
function.out; if you don’t use the –o option, the linker names the output
module a.out. The –l option names the runtime-support library. You
must have a runtime-support library before you can create an execut-
able object module; the prebuilt runtime-support libraries rts32.lib and
rts16.lib are included with the code generation tools.
b) In this example, use the –z shell option, which tells the shell program
to run the linker. The –z option is followed by linker options.
cl470 –o function.c –z lnk32.cmd –o function.out –l rts32.lib
For more information on linker commands, see the
Linker Description
chapter of the
TMS470R1x Assembly Language Tools User’s Guide.
4) The TMS470R1x compiler package also includes an
interlist utility
. This
program interlists the C source statements as comments in the assembly
language compiler output, allowing you to inspect the assembly language
generated for each line of C. To run the interlist utility, invoke the shell pro-
gram with the –s option. For example:
cl470 –s function –z lnk32.cmd –o function.out
The output of the interlist utility is written to the assembly language file
created by the compiler. (The shell –s option implies –k; that is, when you
use the interlist utility, the assembly file is automatically retained.)