Page 237 - Programming Microcontrollers in C
P. 237
222 Chapter 5 Programming Large 8-Bit Systems
c -dlistcs +o %1.c
lnkh11 < %1.lnk
hexh11 -s -o %1.hex %1.h11
This file is called comp.bat and it is invoked by
comp <filename>
The %1 in the command file will be replaced by <filename> when
the command file is run. The first line of the command file tells the
compiler, named c, to execute with the options -dlistcs and +o.
The name of the file will be the filename entered on the command
line with a .c extension. The -dlistcs option causes a listing file
to be generated and saved in a file of the same name filename but
with an extension .ls. The +o option informs the compiler to create
a relocatable object module of the program.
The basic invocation syntax of the compiler is
c [options] file.[c | s | o ] [filen. [ c | s | o ] ]
Any portion of the command line in the above sequence that is
enclosed in square brackets [ ] is optional. Therefore, the only required
command line entry following the c call is the file name. (Refer to
the compiler manual for the variety of options that can be used on
this command line.)
Several files can be included on the command line. Each of these
files can have one of three extensions, c, s, or o. If the extension
is .c, the compiler expects a C program. If it is .s, the compiler
will process an assembly language program. When the extension is
.o, the compiler invokes the linker.
The compiler creates a relocatable object module that is linked
by the next line in the command file.
lnkh11 < %1.lnk
The direct call to the linker lnkh11 is handed a command file to
control the linking. Each program must have its own link command
file, and the extension of this file is .lnk. An example linker
command file is shown below. This command file is for a program
developed later in this chapter.