keil startup.a51 文件

来源:互联网 发布:用友软件t6价格 编辑:程序博客网 时间:2024/05/20 17:09

第一部分 keil  启动代码

Startup Code

Startup code is executed immediately upon reset of the target system. The Keil startup code performs (optionally) the following operations in order:

启动代码是单片机复位后最先执行的代码,keil 中的启动代码通常按顺序 完成以下操作

  • Clears internal data memory (清空内部数据内存)
  • Clears external data memory  (清空外部数据内存)
  • Clears paged external data memory  (清空分页的外部数据内存)
  • Initializes the small model reentrant stack and pointer (初始化小模型可重入栈和指针)
  • Initializes the large model reentrant stack and pointer  
  • Initializes the compact model reentrant stack and pointer
  • Initializes the 8051 hardware stack pointer   初始化8051硬件栈指针
  • Transfers control to code that initializes global variables or to the main C function if there are no initialized global variables  

     将控制权交给全局变量初始代码段,或者如果没有全局代码初始段时交给c语言的main 函数

Following is a list of the startup files that are available. (keil 中可用的启动代码文件)

Startup FileDescriptionSTARTUP.A51Startup code for classic 8051 devices. (这个就是8051系列的启动代码文件了)START_AD.A51Startup code for Analog Devices MicroConverter devices.START390.A51Startup code for Dallas DS80C390/400/41x/5240/5250 contiguous mode devices.START4XX.A51Startup code for Dallas DS89C420/430/440/450 devices.STARTLPC.A51Startup code for NXP LPC700 devices series.START900.A51Startup code for NXP LPC90x - LPC93x devices series.START950.A51Startup code for NXP LPC95x - LPC99x devices series.START_MX.A51Startup code for NXP 80C51MX devices.START751.A51Startup code for NXP 80C75x devices.START_XC.A51Startup code for Infineon XC800 devices.STARTUP32.A51Startup code for ST uPSD32xx devices.STARTUP34.A51Startup code for ST uPSD33xx devices.STARTUP34.A51Startup code for ST uPSD34xx devices.

Copy the appropriate startup file from the \KEIL\C51\LIB\ folder into your project folder and make any changes to the copy.

Each startup file provides assembly constants you may change to control the operations performed at startup.

启动代码文件位于 \KEIL\C51\LIB\  , 你可以通过修改启动代码文件里的如下常量来匹配自己的程序


Name   DescriptionIDATALEN

Specifies the number of bytes of idata to clear to 0. The default is 80h because most 8051 derivatives contain at least 128 bytes of internal data memory. Use a value of 100h for the 8052 and other derivatives that have 256 bytes of internal data memory

.指明idata存储区被清零的大小, 8051系列芯片至少包含128B 内部数据内存,一般默认值为80h。 8052系列或者其他芯片(内部数据内存为256B)使用100h。

XDATASTART

Specifies the initial xdata address to clear to 0

.

XDATALENIndicates the number of bytes of xdata to clear to 0. The default is 0.PDATASTARTSpecifies the initial pdata address to clear to 0.PDATALENSpecifies the number of bytes of pdata to clear to 0. The default is 0.IBPSTACKSpecifies whether or not the small model reentrant stack pointer (?C_IBP) should be initialized. A value of 1 causes this pointer to be initialized. A value of 0 prevents initialization of this pointer. The default is 0.IBPSTACKTOPSpecifies the top of the small model reentrant stack. The default is 0xFF in idata memory.

The Cx51 Compiler does not check to see if the stack area available satisfies the requirements of the application. It is your responsibility to perform such a test.XBPSTACKSpecifies whether or not the large model reentrant stack pointer (?C_XBP) should be initialized. A value of 1 causes this pointer to be initialized. A value of 0 prevents initialization of this pointer. The default is 0.XBPSTACKTOPSpecifies the top of the large model reentrant stack. The default is 0xFFFF in xdata memory.

The Cx51 Compiler does not check to see if the stack area available satisfies the requirements of the application. It is your responsibility to perform such a test.PBPSTACKSpecifies whether the compact model reentrant stack pointer (?C_PBP) should be initialized. A value of 1 causes this pointer to be initialized. A value of 0 prevents initialization of this pointer. The default is 0.PBPSTACKTOPSpecifies the top of the compact model reentrant stack. The default is 0xFF in pdata memory.

The Cx51 Compiler does not check to see if the stack area available satisfies the requirements of the application. It is your responsibility to perform such a test.PPAGEENABLEEnables (a value of 1) or disables (a value of 0) Port 2 initialization for pdata memory access. The default is 0. pdata addressing uses Port 2 for the upper address (or page) byte.PPAGE

Specifies the value to write to Port 2 of the 8051 for pdata memory access. This value represents the xdata memory page to use for pdata. This is the upper 8 bits of the absolute address range to use for pdata. For example, if the pdata area begins at address 1000h (page 10h) in xdata memory, PPAGEENABLE should be set to 1, andPPAGE should be set to 10h. You must specify the starting pdata address to use to the BL51 Linker using the PDATA directive. For example:

BL51 input modules PDATA (1050H)

Neither the BL51 Linker nor the Cx51 Compiler checks to see if the PDATA directive and thePPAGE startup constant are correctly specified. You must ensure that these parameters contain suitable values.


原创粉丝点击