Keil Logo

BL51: UNRESOLVED EXTERNAL SYMBOL FOR MATH AND FP ROUTINES


Information in this article applies to:

  • C51 Version 5.50

SYMPTOMS

I have written the following code:

#pragma SRC

void main(void)
{
  volatile unsigned long x = 6367332, y = 47332, z;
  z = x * y;
  while(1);
}

Without the #pragma SRC, the file compiles and links just fine. With the #pragma SRC, it fails to link. I get the following:

WARNING 1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: ?C?LMUL
WARNING 2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: ?C?LMUL

What does it mean and how do I fix it?

CAUSE

In order to perform the long multiplication, a pre-written library routine called ?C?LMUL is used and is linked in from a library file stored in the C51\LIB folder.

When you convert your C code to assembler and assemble it, the linker cannot automatically find the routine in the correct library file.

The same problem arises for the other math and floating point library routines (not to be confused with library functions such as sqrt). This problem can easily be identifed as all the library routine symbols start with '?C?'.

RESOLUTION

You need to explicitly include the correct library file in your project. Below is a list of all the library files that may be found in the C51\LIB folder and their function. Depending on what you are doing and which memory model you are using, you can work out which files to include.

  • C51S.LIB - Math routines for the Small memory model
  • C51FPS.LIB - Floating point routines for the Small memory model
  • C51C.LIB - Math routines for the Compact memory model
  • C51FPC.LIB - Floating point routines for the Compact memory model
  • C51L.LIB - Math routines for the Large memory model
  • C51FPL.LIB - Floating point routines for the Large memory model

In the example given above, if the Small memory model was being used then the library file C51S.LIB would be added to the project.

MORE INFORMATION

SEE ALSO

Last Reviewed: Friday, July 15, 2005


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.