当前位置:首页 > 技术心得 > 正文内容

BL51: WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS 解决

xjtudll8年前 (2018-04-21)技术心得15550

问题描述:

 

将函数名存储在table里,通过函数指针的方式调用函数。

编译提示:

BL51: WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS

使用环境:

C51 Version 7.00

代码例程(使用Keil官方资料来说明):

文件名是:EXAMPLE1.C

void func1 (unsigned char *msg) {

  ;

}

void func2 (void) {

  unsigned char uc;

  func1("xxxxxxxxxxxxxxx");

}

code void (*func_array[])() = { func2 };

void main( void ) {

  (*func_array[0])();

}

编译的时候就会提示:

*** WARNING 13: RECURSIVE CALL TO SEGMENT

SEGMENT: ?CO?EXAMPLE1

CALLER: ?PR?FUNC2?EXAMPLE1

原因:

In this program example, func2 defines a constant string ("xxx...xxx") which is located in the constant code segment ?CO?EXAMPLE1. The definition:

code void (*func_array[])() = { func2 };

generates a reference between segment ?CO?EXAMPLE1 (where the code table is located) and the executable code segment ?PR?FUNC2?EXAMPLE1. Since func2 also refers to segment ?CO?EXAMPLE1, BL51 assumes that there is a recursive call.

官方的解决办法:

RESOLUTION

To avoid this problem, you must manually remove the reference between func2 and the ?CO?EXAMPLE1 segment. The following overlay directive does that:

bl51 EXAMPLE1.OBJ IX OVERLAY (?CO?EXAMPLE1 ~ FUNC2, MAIN ! FUNC2)

?CO?EXAMPLE1 ~ FUNC2 deletes the implied call reference between func2 and the code constant segment in the example. Then, MAIN ! FUNC2adds a reference between MAIN and FUNC2. This is required because main calls func2 indirectly. Note that automatic overlay analysis does not allow for references made to functions via pointers. References of this type must be manually implemented, as in the example above.

另一个办法:

将code void (*func_array[])() = { func2 }; 放在另一个C文件里,这样就规避了所谓的递归调用了。

 

参考文献:

http://www.keil.com/support/docs/2379.htm

http://blog.csdn.net/avideointerfaces/article/details/32687899

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://www.xjtudll.cn/Exp/497/

标签: keil
分享给朋友:

“BL51: WARNING L13 (RECURSIVE CALL TO SEGMENT) WITH CONSTANTS 解决” 的相关文章

Proteus 7.7 SP2破解及下载

不得不说,Proteus升级的太快,7.6SP4国人还没破解完好,7.7 SP2和谐版就有了。我倒。 Proteus 7.7 SP2相比7.6 SP4只是多了几个PIC和MSP430的模型,貌似MSP430新增的还是2xx系列。 下载地址: 国外网站,请单击进入网页下载,只能用单线程,多线程下载器无...

C#中实现VB中的CreateObject方法

经常看到有些VB的例子中直接用个CreateObject就可调用系统功能(大多是COM对象),像用户设定,网络设定等等。虽然C#中可以通过使用VB的命名空间的方法来调用CreateObject函数,但是这样比较没什么用,因为生成的对象的所带有的方法都不能使用。C#中还可以直接用添加引用的方式来调用一...

IAR STM8 #pragma optimize 指令

IAR STM8 #pragma optimize 指令

参考资料:http://blog.csdn.net/niepangu/article/details/38066319 #pragma optimize= none  //one of none, low, medium, high, size, or speed放在被优化函数前 ...

NSWindow——设定窗口位置

NSWindow——设定窗口位置

 1、记忆窗口的位置 何为记忆窗口位置 ,即下次打开窗口的位置跟上次退出时一样。 如果是用代码,请参考: 记忆窗口位置    http://cocoa.venj.me/blog/remember-window-position/ 在xib文件中设定,见图...

windows环境下TortoiseSVN多仓库(repository)转移合并(修改+转载)

http://www.lilin.net/blog/?p=1346 问题: 两个不同的版本库,放在不同的及其上,各有数个项目在里面,为了统一管理,我现在都集中在一个仓库内,然后用金山快盘,多个机器同步。 回答: 完美包含版本信息,把双库融合,方便管理同步。 自己尝试后发现问题...

PHP安装之后没有php.ini文件

问题: 多数教程都说修改php.ini,但是在安装目录里找了半天,根本没有php.ini,只有: php.ini-development php.ini-production 答案: 其实php.ini就是上述两个文件任选一修改而来。 当然,测试的话更合适的是php.ini-develo...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。