 | Discussion Forum |  |
|
|
inline assembly help linker errorNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Jim Nanney Posted 13-May-2002 18:30 GMT Toolset C51 |  inline assembly help linker error Jim Nanney
#include <reg5000.h>
#include <stdio.h>
void main(void);
void writebyte (unsigned char ch);
void main()
{
unsigned char ch;
ch=0x0A;
writebyte(ch);
}
void writebyte (unsigned char ch)
{
ACC=ch;
#pragma ASM
PUSH MCON
ORL MCON, #4
MOVX @R0, A
DEC R0
POP MCON
#pragma ENDASM
}
When compiling I get the following linker warning.
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: ?C_STARTUP
MODULE: rtc-func.obj (RTC_FUNC)
I followed the directions in the manual about in-line assembly and the ASM/ENDASM directives which stated
Right click on the file in the Project Window - Files Tab Choose Options for... to open Options - Properties page Enable Generate Assembler SRC file Enable Assemble SRC file.
I also tried adding the STARTINIT.A51 file and get the same linker warnings except that the warnings are in the STARTINIT.A51 file instead.
Any help out there? I know it has to be something simple... | | Read-Only Author Jim Nanney Posted 13-May-2002 18:38 GMT Toolset C51 |  RE: inline assembly help linker error Jim Nanney s/STARTINIT.A51/STARTUP.A51/g (meant STARTUP.a51 not STARTINIT.a51)
sorry (coffee depletion imminent) | | Read-Only Author Jim Nanney Posted 13-May-2002 19:57 GMT Toolset C51 |  RE: inline assembly help linker error Jim Nanney Doh!!
Just to follow up...
I found the answer here:
http://www.keil.com/support/docs/1980.htm
and for those too lazy to look above, here it is...
CAUSE
When you compile all your C modules with the SRC directive and the assembler, the linker does not detect the required C run-time libraries (because the files were assembled). In this case, you must add the libraries to your project manually.
RESOLUTION
For a project in the SMALL memory model that uses no floating point arithmetic, C51S.LIB is required.
For a project in the LARGE memory model that uses floating-point, C51FPL.LIB and C51L.LIB are required.
If a project uses floating arithmetic, it is important that C51FPx.LIB is included before the standard library file C51x.LIB. Otherwise printf and scanf will not work with floating-point numbers.
| | Read-Only Author Jon Young Posted 13-May-2002 20:01 GMT Toolset C51 |  RE: inline assembly help linker error Jon Young Just included a dummy C file into your project. Right now it thinks you are compiling a pure assemble routine, and it does not include the C runtime modules. | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|