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

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

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

问题描述:

 

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

WCF:在 ServiceModel 客户端配置部分中,找不到引用协定

环境:VS2010 + C#(DLL) + WCF 即我使用C#编写了一个DLL,在DLL里面远程调用WCF服务,然后EXE程序在调用DLL里面的接口时,出现了如下错误: System.InvalidOperationException: 在 ServiceModel 客户端配置部分中,找不到引用协...

IAR STM8嵌入汇编

IAR STM8嵌入汇编

IAR嵌入汇编:使用asm或者__asm,推荐使用__asm。 void delay_n_nop(uint8 N) { // 用C语言的话 会跟编译器的优化有关 /*     uint8 i;     for (i=N; i>0; i...

运放主要参数

集成运放的参数较多,其中主要参数分为直流指标和交流指标。 其中主要直流指标有输入失调电压、输入失调电压的温度漂移(简称输入失调电压温漂)、输入偏置电流、输入失调电流、输入偏置电流的温度漂移(简称输入失调电流温漂)、差模开环直流电压增益、共模抑制比、电源电压抑制比、输出峰-峰值电压、最大共模输入电压...

回历与公历换算

伊斯兰教历以希吉来为纪元,“希吉来”是阿拉伯语“迁移”一词的音译,系指公元622年9月24日穆罕默德率众由麦加迁往麦地那之事。为使公历纪年元旦与阿拉伯太阴历纪年(以月亮绕地球一周而又与太阳相会,为一个月)岁首相合,特定儒略历622年7月16日(公历62...

eclipse导入外部工程

eclipse导入外部工程

File -> Import -> Android...

C#让TextBox滚动条一直位于最下部

TextChanged事件 滚动条自动处于TextBox最下部需要在Form1类中加上下段代码:   private void txtReceiveMsgChanged(object sender, EventArgs e) {     //...

发表评论

访客

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