Forum : 8051
Original Post
Post Information | Post |
---|---|
February 23, 2007 - 10:14am
|
Dear Member, Regards, |
Forum : 8051
Post Information | Post |
---|---|
February 23, 2007 - 10:14am
|
Dear Member, Regards, |
Hello,
if you prefix your assembly routine name by a question mark like in 'public ?asm_try', it means that you define this routine as reentrant.
So in the Try_ASM0.c file, you should define the external function like this:
extern void asm_try(void) reentrant;
About the P1 symbol undefined, two options:
- 'Options->Project->MA51->Source' ==> check 'Define symbols for the 8051 function registers', OR
- add the line
$include(reg51.inc)
at the beginning of ASM_TEST.A51.
regards,
Lionel
Dear Lionel,
Thanks for the answer. After I do what you suggested, there is another error in linker process : ERROR100: UNRESOLVED EXTERNAL SYMBOL: asm_try(TRY_ASM0). What shall I do? What page in MA51 and LX51 document shall I read? Thank you for your help.
Regards,
Because your function does not handle any parameter, the naming is just "asm_try" (see the listing of the C file). In that case, you have to name the assembly function asm_try instead of ?asm_try (just remove the question mark).
Francis
on the subject of calling asm from C there is one simple surefire way that solves all hassle.
make a skeleton function in C and use the generated asm as the base for your assembly code. All naming conventions, register use and who knows what else, will come out right.
Erik