ARM Technical Support Knowledge Articles

UNRESOLVED EXTERNAL SYMBOL FOR MATH AND FP ROUTINES

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


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 C51LIB 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 C51LIB 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.

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

Article last edited on: 2005-07-15 13:16:07

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential