Defining Macros - Texas Instruments TMS320C54x User Manual

Digital signal processors
Hide thumbs Also See for TMS320C54x:
Table of Contents

Advertisement

5.2 Defining Macros

You can define a macro anywhere in your program, but you must define the
macro before you can use it. Macros can be defined at the beginning of a
source file, in an .include/.copy file, or in a macro library. For more information
about macro libraries, see Section 5.4, Macro Libraries , on page 5-14.
Macro definitions can be nested, and they can call other macros, but all
elements of any macro must be defined in the same file. Nested macros are
discussed in Section 5.9, Using Recursive and Nested Macros , on page 5-22.
A macro definition is a series of source statements in the following format:
macname
.macro [ parameter
model statements or macro directives
[.mexit]
.endm
macname
.macro
[ parameters ]
model statements
macro directives
] [, ... , parameter
1
names the macro. You must place the name in the
source statement's label field. Only the first 32
characters of a macro name are significant. The
assembler places the macro name in the internal
opcode table, replacing any instruction or previous
macro definition with the same name.
identifies the source statement as the first line of a
macro definition. You must place .macro in the
opcode field.
are optional substitution symbols that appear as
operands for the .macro directive. Parameters are
discussed in Section 5.3, Macro Parameters/
Substitution Symbols , on page 5-6.
are instructions or assembler directives that are
executed each time the macro is called.
are used to control macro expansion.
Defining Macros
]
n
Macro Language
5-3

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C54x and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents