Keil C Segment 命名规则

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?programExecutable program code
?CO?codeConstant data in program memory
?BI?bitBit data in internal data memory
?BA?bdataBit-addressable data in internal data memory
?DT?dataInternal data memory
?FD?farFar memory (RAM space)
?FC?const farFar memory (constant ROM space)
?ID?idataIndirectly-addressable internal data memory
?PD?pdataPaged data in external data memory
?XD?xdataXdata memory (RAM space)
?XC?const xdataXdata memory (constant ROM space)

The segment name is assigned based on the memory model of the function.

Small Model Segment Naming Conventions

 

InformationSegment TypeSegment Name
Program codecode?PR?function_name?module_name
Local variablesdata?DT?function_name?module_name
Local bit variablesbit?BI?function_name?module_name

Compact Model Segment Naming Conventions

 

InformationSegment TypeSegment Name
Program codecode?PR?function_name?module_name
Local variablespdata?PD?function_name?module_name
Local bit variablesbit?BI?function_name?module_name

Large Model Segment Naming Conventions

 

InformationSegment TypeSegment Name
Program codecode?PR?function_name?module_name
Local variablesxdata?XD?function_name?module_name
Local bit variablesbit?BI?function_name?module_name

reference: http://www.keil.com/support/man/docs/c51/c51_ap_segname.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值