|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
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?
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.
Article last edited on: 2002-02-15 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?