ARM Technical Support Knowledge Articles

LOCATE SYNTAX ERRORS WHEN USING MACROS

Applies to: A51 Macro Assembler

Answer


Information in this article applies to:


QUESTION

I wrote the following small assembler program using macros:

ISAIN   MACRO   IO_ADDR
        MOV     ADDRPORT,#IO_ADDR
        MOVX    A,@R0
        ENDM

        ISAIN   0x1f

        END

These syntax errors were generated. What is wrong with my code?

                       1
                       2     ISAIN   MACRO   IO_ADDR
                       3             MOV     ADDRPORT,#IO_ADDR
                       4             MOVX    A,@R0
                       5             ENDM
                       6
                       7             ISAIN   0x1f
*** _________________________________________^
*** ERROR #A45 IN 8 (x.a51, LINE 7): UNDEFINED SYMBOL (PASS-2)
                      10
                      11             END

ANSWER

The syntax problem is within the macro you have written. You should include the macros in the listing. This is enabled under uVision with Project - Options for Target - Listing - Assembler Listing - Assembler Listings - Macros - All Expansions or from the command line with the GEN assembler directive.

Then you can see the real syntax problem:

                       7             ISAIN   0x1f
0000                   8+1           MOV     ADDRPORT,#0x1f
*** _________________________________________^
*** ERROR #A45 IN 8 (x.a51, LINE 7): UNDEFINED SYMBOL (PASS-2)
0003 E2                9+1           MOVX    A,@R0
                      10

In your code, the symbol ADDRPORT is not defined, which caused the syntax problem.

SEE ALSO

Article last edited on: 2004-04-27 21:31:48

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential