This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ARM Assembler v5.1.8 and the $defined() built-in function for conditional compilation

I am trying to convert a GNU assembly file to the TI assembler for arm. For some reason, the built-in function "$defined()" is giving me trouble. Right now, I am just trying to assemble a very basic file that only contains a single declaration surround by an .if statement:

        .if $defined(ABCD)
id      .cstring "Hello"
        .endif

The assembler outputs the following.

$ bin/armasm.exe test.asm
"test.asm", ERROR! at line 4: [E0004] Absolute, well-defined integer value
expected
.if $defined(ABCD)
"test.asm", ERROR! at line 4: [E0003] Unexpected trailing operand(s)
.if $defined(ABCD)
"test.asm", ERROR! at EOF: [E0300] The following symbols are undefined:
$defined
3 Assembly Errors, No Assembly Warnings
Errors in Source - Assembler Aborted



Can anybody help me figure this out? This construct is clearly supported by the compiler, per the example on page 98 in the User's Manual: http://www.ti.com/lit/ug/spnu118l/spnu118l.pdf

Thanks,

Jim

SOLUTION:

OK, so I added an extra $ to the beginning of $defined, and it works! Is the manual wrong, or is this just some convention I'm unaware of?

        .if $$defined(ABCD)
id      .cstring "Hello"
        .endif
  • For ARM only, all of the built-in functions start with $$ rather than $ as on the other targets.  This is not documented correctly in SPNU118L (see also section 4.9.1), but it should be corrected in the next version.