微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > STARTUP.A51文件分析

STARTUP.A51文件分析

时间:11-27 来源:互联网 点击:
$NOMOD51;Ax51宏汇编器控制命令,禁止预定义的8051。使编译器不使能预定义的;8051符号,避免产生重复定义的错误。

;------------------------------------------------------------------------------
;This file is part of the C51 Compiler package
;Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
;------------------------------------------------------------------------------
;STARTUP.A51:This code is executed after processor reset.
;
;To translate this file use A51 with the following invocation:
;
;A51 STARTUP.A51
;
;To link the modified STARTUP.OBJ file to your application use the following
;BL51 invocation:
;
;BL51 , STARTUP.OBJ
;BL51是Keil使用的链接器(Linker),这是命令行的使用格式,一般不用,使用IDE环境,

;用project管理,有相应的按钮可以实现该功能.
;------------------------------------------------------------------------------
;
;User-defined Power-On Initialization of Memory---初始化RAM单元
;
;With the following EQU statements the initialization of memory---用下面的EQU声明初

;始化ram单元
;at processor reset can be defined:
;
;; the absolute start-address ofIDATAmemory is always 0
IDATALENEQU80H; the length ofIDATAmemory in bytes.--根据你选用的芯片可以适

;当的修改这些值。IDATALEN只是一个标号,EQU只是做宏一样的替换,类似于C语;言中的#define uint (unsigned int),以上的代码使得程序以后在碰到IDATALEN时替换;成80H

XDATASTARTEQU0H; the absolute start-address ofXDATAmemory--以下

;两项根据目标系统的外设配置和连接自己修改
XDATALENEQU0H; the length ofXDATAmemory in bytes.

PDATASTARTEQU0H; the absolute start-address ofPDATAmemory
PDATALENEQU0H; the length ofPDATAmemory in bytes.
;
;Notes:The IDATA space overlaps physically the DATA and BIT areas of the
;8051 CPU. At minimum the memory space occupied from the C51
;run-time routines must be set to zero.
;------------------------------------------------------------------------------
;
;Reentrant Stack Initilization--注意:再入堆栈的方向区别于芯片自带的堆栈的生长方

;式,自顶向下生长的!而SP是是自底向上的!
;--且再入堆栈是由编译器自己管理的,一般不必去关心,只是在有再入函数的时候,根据

;函数的存储器模式使用相应的RAM空间做为再入堆栈。
;The following EQU statements define the stack pointer for reentrant
;functions and initialized it:
;Keil C默认情况不是用堆栈来传递参数的,所以造成函数不可重入,Keil要求用户显示声

;明函数是否具有可重入属性,以便为C函数调用初始化栈。
;Stack Space for reentrant functions in theSMALL model.
IBPSTACKEQU0; set to 1 if small reentrant is used.
IBPSTACKTOPEQU0FFH+1; set top of stack to highest location+1.
;
;Stack Space for reentrant functions in theLARGE model.
XBPSTACKEQU0; set to 1 if large reentrant is used.
XBPSTACKTOPEQU0FFFFH+1; set top of stack to highest location+1.
;
;Stack Space for reentrant functions in theCOMPACT model.
PBPSTACKEQU0; set to 1 if compact reentrant is used.
PBPSTACKTOPEQU0FFFFH+1; set top of stack to highest location+1.
;不同内存模式下的堆栈。Keil编译器中有三种模式设置:
;Small:所有的变量都放在内部RAM区
;Compact:所有变量在默认情况下都会放在外部RAM的低256字节中(可由R0寻址)
;Large:所有变量都放在外部RAM中(DPTR寻址)
;这是由51处理器繁多的寻址模式导致的,不同的寻址模式有不同的效率
;
;------------------------------------------------------------------------------
;
;Page Definition for Using theCompact Modelwith 64 KByte xdata RAM
;
;The following EQU statements define the xdata page used for pdata
;variables. The EQU PPAGE must conform with the PPAGE control used
;in the linker invocation.
;
PPAGEENABLEEQU0; set to 1 if pdata object are used.
;
PPAGEEQU0; define PPAGE number.
;
PPAGE_SFRDATA0A0H; SFR that supplies uppermost address byte
;(most 8051 variants use P2 as uppermost address byte)很多的外部页面寻址以P2

;口为

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top