ARM Technical Support Knowledge Articles

COMMENTS IN ASSEMBLY BLOCKS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOM

When I try to place a comment in an assembly block or inside a C source file, such as:

#pragma asm
        mov R1, A  ; save function's return value
#pragma endasm

The compiler generates an error, thinking the apostrophe is a single quote.

CAUSE

Inline assembly code is parsed by the C compiler (which does not recognize the semicolon as the beginning of a comment).

RESOLUTION

Comments in ASM blocks should use C comment syntax. The example above compiles if changed to the following:

#pragma asm
        mov R1, A  // save function's return value
#pragma endasm

SEE ALSO

Article last edited on: 2005-05-24 10:29:47

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