Keil™, An ARM® Company

Technical Support

A51: ERROR 21 (EXPRESSION WITH FORWARD REFERENCE)


Information in this article applies to:

  • C51 Version 5.50a
  • C51 Version 6.00 Beta
  • C51 Version 6.00

SYMPTOMS

I receive the following error when I assemble my 8051 assembler source file.

*** ERROR #21 IN 3 (TEST.A51, LINE 3): EXPRESSION WITH FORWARD REFERENCE NOT PERMITTED

What causes this problem?

CAUSE

This problem is typically caused by a SET or EQU that is used with a label that is defined later in your program. For example, the following example code generates this error message.

cseg    at      0

jjj     equ     bob+1


start:  nop
        nop
        nop
        nop
bob:    nop
        nop
        nop
end

RESOLUTION

The A51 assembler must resolve SET and EQU definitions when they are declared. References to objects that are not defined at the time of the SET or EQU are not allowed. To resolve this problem, move the SET or EQU below the forward reference, or remove it from the SET or EQU.

MORE INFORMATION

Refer to the following for more information.

  • A51/A251 Assembler User's Guide 07.98 page 182, error message 21,

Last Reviewed: Sunday, March 12, 2000


Did this article provide the answer you needed?
 
Yes
No
Not Sure