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调用汇编的方法已经有很多帖子讲到,但是一般只讲要点,很少有对整个过程作详细描述,对于初学者是不够的,这里笔者通过一个简单例子 ...
随机推荐
- javascript 中ASCII字符值转换
char-->ascii var a = "123"; a.charAt(1).charCodeAt();ascii-->char String.fro ...
- 【转】关于Adapter的The content of the adapter has changed问题分析 关于Adapter的The content of the adapter has changed问题分析
原文网址:http://www.cnblogs.com/monodin/p/3874147.html 1.问题描述 1 07-28 17:22:02.162: E/AndroidRuntime(167 ...
- cf442B Andrey and Problem
B. Andrey and Problem time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- J2EE学习路线
第一部分: JAVA语言基础知识.包括异常.IO流.多线程.集合类.数据库.(切记基础知识一定要时时刻刻巩固,注意,如果你是想以最快速度学习J2EE,关于Java中的Swing知识点,就只做了解) ...
- python3-day4(re正则表达式,冒泡)
一.正则表达式常用 1.re.match:只尝试从字符串的查找,后面不作查找. 例子: import re text="aabcdefg123123" m=re.match('a' ...
- python高级编程:有用的设计模式2
# -*- coding: utf-8 -*- __author__ = 'Administrator' #python高级编程:有用的设计模式 #代理 """ 代理对一 ...
- Django之上传文件
使用Form表单上传文件 upload.html <!DOCTYPE html> <html lang="en"> <head> <met ...
- Codeforces Round #143 (Div. 2) (ABCD 思维场)
题目连链接:http://codeforces.com/contest/231 A. Team time limit per test:2 seconds memory limit per test: ...
- docke 网络配置2
一,docker 的bridge模式是和vmware中的nat模式类似的,但是如果想要弄成和vmwae中的bridge怎么办呢? 说明,bridge模式获取的Ip是与宿主机的ip是出于同一个网段的. ...
- C#基础:集合
C#中的数组实现为 System.Array 类的实例,它们只是集合类(Collection Classes)中的一种类型.集合类一般用于处理对象列表,其功能比简单数组要多,功能大多是通过实现 ...