BL51: UNRESOLVED SYMBOL ?C_STARTUP

BL51: UNRESOLVED SYMBOL ?C_STARTUP


Information in this article applies to:

  • C51 All Versions

SYMPTOMS

When writing single-file projects using in-line assembly, the linker produces the following warning:

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
     SYMBOL:    ?C_STARTUP
     MODULE:    main.obj    (MAIN)

For example, the following program:

#include <reg52.h>

void main()  {
  unsigned char i;
  unsigned char cur[20];

  for( i = 0; i < 20; i++)  {
    #pragma asm
      mov   A, x;
      movc  A, @A+PC;
    #pragma endasm
  }
}

When compiled, assembled, and linker in µVision2, generates the warning above. To translate this file, you must enable the following 2 checkboxes in Project - Options for file - Properties:

  • Generate Assembler SRC File
  • Assembler SRC File

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.

When you are using µVision, you may simply add the require library file(s) to the project in the same way as you are adding source files.

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值