Keil Logo

A51: Conditional Assembly Code


Information in this article applies to:

  • C51 All Versions

QUESTION

Is it possible to do conditional assembly with the A51 assembler? If so, why won't statements like the following work?

IF USE_SIMULATION == ENABLED

ANSWER

To create conditional assembly programs, you must use the $IF and $ENDIF directives in your assembly program with symbols you define with $SET or $RESET or symbols you define on the command line. IF does not work with those types of defined symbols. The following code:

$IF (USE_SIMULATION = ENABLED)
        nop
        nop
        nop
$ENDIF

should work as expected.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.