Keil Logo

A51: Error 45 (Undefined Symbol (Pass-2))


Information in this article applies to:

  • C51 Version 5.50

SYMPTOMS

I am trying to assemble the RTX51 Tiny configuration file CONF_TNY.A51. I open the file in µVision and click on the Compile button and I receive the following error message:

Error 45: Undefined symbol (pass-2)

for the very last line of the file which is:

?RTX_STACKERROR:  STACK_ERROR

What is wrong with that line? I haven't modified the file in any way.

CAUSE

Nothing is wrong with the last line. What has happened is that the assembler has gone through the entire file looking for the definition of a symbol. It has reached the last line and still not found the definition. The assembler then generates the error and it appears that the cause is the last line because that is where the assembler stopped.

RESOLUTION

To find out which symbol or symbols caused the problem you need to look at the symbol table in the generated .LST listing file:

SYMBOL TABLE LISTING
------ ----- -------

N A M E             T Y P E  V A L U E   ATTRIBUTES

?RTX51_TINY_CONFIG  N NUMB   -----
?RTX?CODE. . . . .  C SEG    0004H       REL=UNIT
?RTX_CLOCK . . . .  N NUMB   EC78H   A
?RTX_CURRENTTASK .  D ADDR   000DH   A
?RTX_FREESTACK . .  N NUMB   0014H   A
?RTX_RAMTOP. . . .  N NUMB   00FFH   A
?RTX_REGISTERBANK.  N NUMB   0008H   A
?RTX_ROBINTIME . .  D ADDR   000CH   A
?RTX_SAVEACC . . .  D ADDR   000AH   A
?RTX_SAVEPSW . . .  D ADDR   000BH   A
?RTX_STACKERROR. .  C ADDR   0000H   R   SEG=?RTX?CODE
?RTX_TIMESHARING .  N NUMB   0000H   A
EA . . . . . . . .    ----   -----
FREE_STACK . . . .  N NUMB   0014H   A
INT_CLOCK. . . . .  N NUMB   1388H   A
INT_REGBANK. . . .  N NUMB   0001H   A
RAMTOP . . . . . .  N NUMB   00FFH   A
TIMESHARING. . . .  N NUMB   0000H   A

Here you can see that all the symbols except for EA have been defined.

You would then need to go through and figure out why the symbol wasn't defined. The definition may have been left out or mistyped.

In this case EA is not defined in the CONF_TNY.A51 file and isn't supposed to be.

Choose A51 Assembler from the Options menu and click on the Object tab.

There is an option to Define 8051 SFRs. Check this option and rebuild the CONF_TNY.A51 file. RTX51 Tiny requires that the 8051 SFRs are defined by the assembler. That's why this directive is required.

EA will now be defined as can be seen in the new symbol table:

SYMBOL TABLE LISTING
------ ----- -------

N A M E             T Y P E  V A L U E   ATTRIBUTES

?RTX51_TINY_CONFIG  N NUMB   -----
?RTX?CODE. . . . .  C SEG    0004H       REL=UNIT
?RTX_CLOCK . . . .  N NUMB   EC78H   A
?RTX_CURRENTTASK .  D ADDR   000DH   A
?RTX_FREESTACK . .  N NUMB   0014H   A
?RTX_RAMTOP. . . .  N NUMB   00FFH   A
?RTX_REGISTERBANK.  N NUMB   0008H   A
?RTX_ROBINTIME . .  D ADDR   000CH   A
?RTX_SAVEACC . . .  D ADDR   000AH   A
?RTX_SAVEPSW . . .  D ADDR   000BH   A
?RTX_STACKERROR. .  C ADDR   0000H   R   SEG=?RTX?CODE
?RTX_TIMESHARING .  N NUMB   0000H   A
EA . . . . . . . .  B ADDR   00A8H.7 A
FREE_STACK . . . .  N NUMB   0014H   A
INT_CLOCK. . . . .  N NUMB   1388H   A
INT_REGBANK. . . .  N NUMB   0001H   A
RAMTOP . . . . . .  N NUMB   00FFH   A
TIMESHARING. . . .  N NUMB   0000H   A

MORE INFORMATION

  • Refer to NOMOD51 in the Ax51 User's Guide.

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.