ARM Technical Support Knowledge Articles

NAMING CONVENTIONS FOR FUNCTION SYMBOLS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I have problems passing parameters from a C file to an assembly function. I think the problem is with the declarations.

My assembly function receives a pointer as an argument. The C prototype I'm using is:

extern unsigned char Function (unsigned char xdata *);

The assembler code is:

public  Function
Function:
  MOV   A,R7
  .
  .
  .
  RET

When I build my project, the linker outputs the warning Unresolved External Symbol for Function in the C file. If I change the function prototype to have a void argument list and if I pass no parameters to Function, the program compiles and links without warnings.

What could be the problem?

ANSWER

The C51 compiler adds an underline character ('_') to the beginning of function names to indicate that all arguments are passed in registers. This is documented in the Cx51 User's Guide, Chapter 6 under Program Objects. If you add an underline character ('_') before the function name in the assembler source file your project will build as you expect.

MORE INFORMATION

SEE ALSO

Article last edited on: 2002-02-15 00:00:00

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