Keil Logo

C51: Inline Assembly Generates Target Out of Range


Information in this article applies to:

  • C51 All Versions

QUESTION

I have added a complex in-line assembly function to my C source file, but I am now getting the following error:

error A51: TARGET OUT OF RANGE

Is this a Compiler problem?

ANSWER

No, it is not a Compiler problem, but an issue of your source code.

You are very likely getting this error on a short JMP instruction (SJMP, JNZ, JZ, CJNE, JC, DJNZ). TARGET OUT OF RANGE indicates that the address specified in the instruction cannot be reached by this instruction.

You may solve this problem with a small change in your source code.

For example, when the following instruction generates the error A51: TARGET OUT OF RANGE:

       JNZ     label

You may re-write this code with:

       JZ      Hlabel
       JMP     label
Hlabel:

MORE INFORMATION

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.