![background image](http://html.mh-extra.com/html/texas-instruments/tms320c54x/tms320c54x_user-manual_1097113194.webp)
Macro Libraries
5-14
5.4
Macro Libraries
One way to define macros is by creating a macro library. A macro library is a
collection of files that contain macro definitions. You must use the archiver to
collect these files, or members, into a single file (called an archive). Each
member of a macro library contains one macro definition. The files in a macro
library must be unassembled source files. The macro name and the member
name must be the same, and the macro filename’s extension must be .asm.
For example:
Macro Name
Filename in Macro Library
simple
simple.asm
add3
add3.asm
You can access the macro library by using the .mlib assembler directive.
The syntax is:
.mlib
macro library filename
When the assembler encounters the .mlib directive, it opens the library and
creates a table of the library’s contents. The assembler enters the names of
the individual members within the library into the opcode tables as library
entries; this redefines any existing opcodes or macros that have the same
name. If one of these macros is called, the assembler extracts the entry from
the library and loads it into the macro table.
The assembler expands the library entry in the same way it expands other
macros. You can control the listing of library entry expansions with the .mlist
directive. For more information about the .mlist directive, see Section 5.8,
Formatting the Output Listing, on page 5-21. Only macros that are actually
called from the library are extracted, and they are extracted only once. For
more information about the .mlib directive, see page 4-67.
You can create a macro library with the archiver by simply including the desired
files in an archive. A macro library is no different from any other archive, except
that the assembler expects the macro library to contain macro definitions. The
assembler expects
only macro definitions in a macro library; putting object
code or miscellaneous source files into the library may produce undesirable
results.
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......