data的使用在Keil C51中有一点特殊,链接器会进行覆盖分析。
BL51: HOW DOES OVERLAY ANALYSIS WORK?
Information in this article applies to:
* C51 Version 5.50a
* C51 Version 6.10a
QUESTION
How does overlay analysis work in the C51 tools?
ANSWER
The C51 tools are designed to make optimal use of the limited memory resources of the 8051 microcontroller.
To provide the most efficient use of memory, automatic variables and function arguments are overlaid in memory according to a well-defined procedure.
First, the linker builds a call tree of your program. For example:
OVERLAY MAP OF MODULE: SAMPLE (SAMPLE)
SEGMENT DATA_GROUP
+--> CALLED SEGMENT START LENGTH
----------------------------------------------
?C_C51STARTUP ----- -----
+--> ?PR?MAIN?SAMPLE
?PR?