KEIL C51 Call Tree
KEIL中函数的调用在其帮助文档中有一个详细的解释,引用如下:
The Call Tree
The best way to demonstrate how the call tree is generates is with an example. Based on the following program flowchart, the startup code calls the main C function which subsequently calls func_a, func_b, and func_c sequentially. The functions call no other routines in our program.

The arguments and local variables of func_a, func_b, and func_c meet the rules listed in theTheory of Operation and, therefore, may be overlaid. The source code for this flowchart is as follows:
char func_a (char arg1, char arg2, char arg3)
{
return (arg1+arg2+arg3);
} int func_b (int arg1, int arg2, int arg3)
{
return (arg1+arg2+arg3);
}
long func_c (long arg1, long arg2, long arg3)
{
return (arg1+arg2+arg3);
}
void main (void)
{
char var_a;
int var_b;
long var_c;
var_a = func_a(1,2,3);
var_b = func_b(1,2,3);
var_c = func_c(1,2,3); while (1); }
When the program is linked, the linker generates a call tree which it outputs to the map file.
FUNCTION/MODULE BIT_GROUP DATA_GROUP
--> CALLED FUNCTION/MODULE START STOP START STOP
====================================================
?C_C51STARTUP ----- ----- ----- -----
+--> ?PR?MAIN?MAIN
MAIN/MAIN ----- ----- 0008H 000EH
+--> ?PR?FUNC_A?MAIN
+--> ?PR?FUNC_B?MAIN
+--> ?PR?FUNC_C?MAIN
FUNC_A/MAIN ----- ----- 000FH 0011H
FUNC_B/MAIN ----- ----- 000FH 0014H
FUNC_C/MAIN ----- ----- 000FH 001AH
Based on the call tree, the linker reserves the memory used by the functions' arguments and local variables. The linker creates several specialOverlay Groups (BIT_GROUP, DATA_GROUP, and so on) that contain the overlaid segments.
As you can see from the call tree above, the DATA_GROUP for func_a, func_b, and func_c starts at 000Fh. This shows that the linker believes the arguments and variables for these functions may be safely overlaid. Refer to the memory map for the memory range used by the _DATA_GROUP_.
START STOP LENGTH ALIGN RELOC MEMORY CLASS SEGMENT NAME
=========================================================================
* * * * * * * * * * * D A T A M E M O R Y * * * * * * * * * * * * *
000000H 000007H 000008H --- AT.. DATA "REG BANK 0"
000008H 00001AH 000013H BYTE UNIT DATA _DATA_GROUP_
00001BH 00001BH 000001H BYTE UNIT IDATA ?STACK
Note
- The linker generates overlay information that is accurate. However, in some instances the default analysis of the call tree is ineffective or incorrect. This occurs with functions that are called by both the main program and an interrupt and with functions called through function pointers.
- Functions that are called by the main program root and by an interrupt service routine or functions that are called by two or more interrupts may not be overlaid.
- Functions called through pointers require special handling within the linker in order for overlaying to work properly. This topic is discussed inFunction Pointers.
KEIL C51 Call Tree的更多相关文章
- Keil C51 中的函数指针和再入函数
函数指针是C语言中几个难点之一.由于8051的C编译器的独特要求,函数指针和再入函数有更多的挑战需要克服.主要由于函数变量的传递.典型的(绝大部分8051芯片)函数变量通过堆栈的入栈和出栈命令来传递. ...
- Keil C51中函数指针的使用
函数指针在C语言中应用较为灵活.在单片机系统中,嵌入式操作系统.文件系统和网络协议栈等一些较为复杂的应用都大量地使用了函数指针.Keil公司推出的C51编译器是事实上80C51 C编程的工业标准,它针 ...
- Keil C51汉字显示的bug问题
一.缘起 这两天改进MCU的液晶显示方法,采用“即编即显”的思路,编写了一个可以直接显示字符串的程序.如程序调用disstr("我是你老爸");液晶屏上就会显示“我是你老爸”. 二 ...
- KEIL、uVision、RealView、MDK、KEIL C51区别比较
KEIL uVision,KEIL MDK,KEIL For ARM,RealView MDK,KEIL C51,KEIL C166,KEIL C251 从接触MCS-51单片机开始,我们就知道有一个 ...
- Keil C51程序调试过程
用Keil C51编写程序时,经常需要调试,如果不是经常用这个软件的话,很容易忘记这些调试步骤,现在举一个例子“验证延迟函数delay()使其延迟的时间为500ms”说明. 源程序写完后,就可以调试了 ...
- Keil C51软件的使用
进入 Keil C51 后,屏幕如下图所示.几秒钟后出现编辑界 启动Keil C51时的屏幕 进入Keil C51后的编辑界面 简单程序的调试:学习程序设计语言.学习某种程序软件,最好的方法是直接操作 ...
- Keil c51现No Browse information available
keil c51 不能使用:Go to Definition of....的解决方法 最近使用keil c51 开发usb固件,当向vc一样使用Go to Definition of....时,出现警 ...
- Keil C51总线外设操作问题的深入分析
阅读了<单片机与嵌入式系统应用>2005年第10期杂志<经验交流>栏目的一篇文章<Keil C51对同一端口的连续读取方法>(原文)后,笔者认为该文并未就此问题进行 ...
- KEIL C51 中嵌入汇编以及C51与A51间的相互调用
如何在 KEIL C51(v6.21) 中调用汇编函数的一个示例 有关c51调用汇编的方法已经有很多帖子讲到,但是一般只讲要点,很少有对整个过程作详细描述,对于初学者是不够的,这里笔者通过一个简单例子 ...
随机推荐
- 智能卡 APTU命令
一条命令APDU含有一个头标和一个本体.本体可有不同长度,或者在相关数据字段为空时,整个可以不存 在. 头标由四个数据元组成,它们是类CLA(ClAss)字节,命令INS(INStructic,n)字 ...
- 自制单片机之七……RS232串口
在我的板子上其它的部分都已完成了,现在就剩下RS232串口了.串口对于单片机很重要,有了它就可以和PC通信了,可以用PC来控制你的单片机,也可以将你单片机上采集的数据传到PC上. 留的位置好像有点挤. ...
- Qt编程之数据流图(dataflow diagram)的编写
不知道怎么搞. 在网上搜了一些资料,说是有提供的Demo样例 https://forum.qt.io/topic/18472/dataflow-programming-gui/4 http://sta ...
- wikioi3052 多米诺
题目描述 Description 一个矩形可以划分成M*N个小正方形,其中有一些小正方形不能使用.一个多米诺骨牌占用两个相邻的小正方形.试问整个区域内最多可以不重叠地放多少个多米诺骨牌且不占用任何一个 ...
- UVA 11478 Halum (差分约束)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...
- openstack组件手动部署整合
preface:当你完全且正确的配置好整个OpenStack ENV 你将能看到的和体验到的!!! 我们先来看看简单效果吧,祝君能在这条路上走的更远,更好;
- eucimage
- hibernate分页查询的各种方法
统计总数: public Integer countAll1() { String hql = "select count(*) from News as news"; List ...
- 有关JAVA基础学习中的集合讨论
很高兴能在这里认识大家,我也是刚刚接触后端开发的学习者,相信很多朋友在学习中都会遇到很多头疼的问题,希望我们都能够把问题分享出来,把自己的学习思路整理出来,我们一起探讨一起成长. 今天我 ...
- 跟我一起学extjs5(17--Grid金额字段单位MVVM方式的选择)
跟我一起学extjs5(17--Grid金额字段单位MVVM方式的选择) 这一节来完毕Grid中的金额字段的金额单位的转换.转换旰使用MVVM特性,整体上和控制菜单的几种模式类似.首先 ...