Segment Naming Conventions
Objects generated by the Cx51 Compiler (program code, program data, and constant data) are stored in segments which are units of code or data memory. A segment may be relocatable or may be absolute. Each relocatable segment has a type and a name. This section describes the conventions used by the Cx51 Compiler for naming these segments.
Segment names include a module_name which is the name of the source file in which the object is declared. In order to accommodate a wide variety of existing software and hardware tools, all segment names are converted and stored in uppercase.
Each segment name has a prefix that corresponds to the memory type used for the segment. The prefix is enclosed in question marks (?). The following is a list of the standard segment name prefixes:
| Segment Prefix | Memory Type | Description |
|---|---|---|
| ?PR? | program | Executable program code |
| ?CO? | code | Constant data in program memory |
| ?BI? | bit | Bit data in internal data memory |
| ?BA? | bdata | Bit-addressable data in internal data memory |
| ?DT? | data | Internal data memory |
| ?FD? | far | Far memory (RAM space) |
| ?FC? | const far | Far memory (constant ROM space) |
| ?ID? | idata | Indirectly-addressable internal data memory |
| ?PD? | pdata | Paged data in external data memory |
| ?XD? | xdata | Xdata memory (RAM space) |
| ?XC? | const xdata | Xdata memory (constant ROM space) |
The segment name is assigned based on the memory model of the function.
Small Model Segment Naming Conventions
| Information | Segment Type | Segment Name |
|---|---|---|
| Program code | code | ?PR?function_name?module_name |
| Local variables | data | ?DT?function_name?module_name |
| Local bit variables | bit | ?BI?function_name?module_name |
Compact Model Segment Naming Conventions
| Information | Segment Type | Segment Name |
|---|---|---|
| Program code | code | ?PR?function_name?module_name |
| Local variables | pdata | ?PD?function_name?module_name |
| Local bit variables | bit | ?BI?function_name?module_name |
Large Model Segment Naming Conventions
| Information | Segment Type | Segment Name |
|---|---|---|
| Program code | code | ?PR?function_name?module_name |
| Local variables | xdata | ?XD?function_name?module_name |
| Local bit variables | bit | ?BI?function_name?module_name |
reference: http://www.keil.com/support/man/docs/c51/c51_ap_segname.htm
Cx51编译器段命名规范
本文介绍Cx51编译器中程序代码、数据及常量数据的存储方式,即通过不同类型的内存段进行组织。文章详细列举了各种段类型及其对应的内存类型,并针对不同的内存模型(小型、紧凑型、大型)描述了具体的段命名约定。
2274

被折叠的 条评论
为什么被折叠?



