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

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

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

问题描述:

 

将函数名存储在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 解决” 的相关文章

Xcode Warning: The Copy Bundle Resources build phase contains this target's Info.plist file

Xcode Warning: The Copy Bundle Resources build phase contains this target's Info.plist file

问题: 编译时,提示The Copy Bundle Resources build phase contains this target's Info.plist file 原因: Info.plist被添加到了Copy Bundle Resources里,原因不明。如图所示: 解决...

vs2012 与 win7 不兼容的问题

vs2012 与 win7 不兼容的问题

问题描述:安装VS2012后,打开提示与此版本的 Windows 不兼容 如下图: 一开始以为是VS2010不能安装在Win7 64bit上,后来发现有个补丁,安装好之后,就能使用了。 Update for Microsoft Visual Studio 2012 (KB2781514) http...

SSCOM无法保存窗口数据到文本文件

SSCOM无法保存窗口数据到文本文件

使用环境: Win7 64bit SSCOM 3.2 问题: “保存窗口”功能无效,每次都是提示error 如下图所示: 原因: 相应的目录根本不存在,请看错误窗口。 目录SAVE2017/3实际上并不存在,软件也没有自动新建该目录 解决办法: 在SSCOM同级目录下,新建...

“格林尼治时间”或将退休 明年全球将投票表决

          http://china.nfdaily.cn/content/2011-11/10/content_32922220.htm      &...

浅析电波表——美国WWVB码

浅析电波表——美国WWVB码

参考文献: http://www.nist.gov/pml/div688/grp40/wwvb.cfm http://tf.nist.gov/stations/wwvbtimecode.htm http://en.wikipedia.org/wiki/WWVB 一、WWVB码简介 WWVB与WWV...

在水晶报表中使用Code128条形码

在水晶报表中使用Code128条形码

核心重点:字符串如果直接用code128字体显示,是无法扫描出来的。 1.将code128条码字体拷贝到C:\Windows\fonts下 2 .在水晶报表里的【字段资源管理器】的【公式字段】中新建一个公式字段例如我命名为Code128 3.在新建的字段单击鼠标右键 选择编辑 在报表自定义函数中新建...

发表评论

访客

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