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

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

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

问题描述:

 

将函数名存储在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://xjtudll.cn/Exp/497/

标签: keil
分享给朋友:

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

解决android studio弹出

解决android studio弹出"waiting for debugger"

方式一: 这种方法可能需要配置环境变量 win+R -> cmd -> adb kill-server,adb start-server 方式二: 当点击debug app时(卡在"waiting for debug"),则如图点击,然后点击确定即可! 本文为转载...

CTE递归限制次数

CTE递归限制次数

https://blog.csdn.net/weixin_30247159/article/details/98657005 CTE可以用来取递归,网上资料很多,这里就不再叙述了,今天遇到的需求是要限制只取2级,然后加了个临时的lev with tree as ( select [Cu...

ios ble:didDiscoverPeripheral没有回调

参考资料: http://stackoverflow.com/questions/26320578/diddiscoverperipheral-not-been-called-after-advertising-another-ios-device 问题: 启动scan之后,didDiscoverP...

用Allegro导出DXF/DWG格式文件

用Allegro导出DXF/DWG格式文件

在硬件系统设计过程中,有时需要导出PCB文件的二维模型用以设计对应的结构件。 以下内容介绍的是采用Cadence套件中的Allegro软件将brd文件导出为DXF文件。1.在Allegro中打开brd文件,设置好要导出的layer,选择File->Export->DXF 2....

手表晶体管ppm和月差之间的关系

对于手表而言,月差是个比较重要的参数,月差太大,隔段时间手表就不准了,老要调时,对于懒人和完美主义者来说,就太麻烦了。当然,如果你不太在意时间的准确度,就无所谓了。 ppm是英文part per million的缩写,表示百万分之几,在不同的场合与某些物理量组合,常用于表示器件某个直流参数的精度。它...

51单片机内部扩展RAM

51单片机内部扩展RAM

一直想写一篇关于51RAM的文章,网上看到这篇文章,觉得讲的比较详细,我就不献丑了,转载过来了。初学者可以看看。 原文网址:http://www.jhmcu.com/index.php/mcu-internal-expansion-ram-application/ 单片机内部RAM:共256个单元...

发表评论

访客

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