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

STARTUP.A51注解

时间:11-26 来源:互联网 点击:
$NOMOD51;使编译器不使能预定义的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

;at processor reset can be defined:

;

;

; the absolute start-address of IDATA memory is always 0

IDATALENEQU80H; the length of IDATA memory in bytes.--根据你选用的芯片可以适

;当的修改这些值。

;(例如所用的是52系列,该值修改为100H,即可初始化时将全部IDATA清0。如不更改,初始化时默认只清RAM的前128个字节,高128字节中的值全是0xff)

XDATASTARTEQU0H; the absolute start-address of XDATA memory--以下

;两项根据目标系统的外设配置和连接自己修改

XDATALENEQU0H; the length of XDATA memory in bytes.

PDATASTARTEQU0H; the absolute start-address of PDATA memory

PDATALENEQU0H; the length of PDATA memory 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--注意堆栈的方向:别的芯片自带的堆栈的生长方

;式是自顶向下生长的!而51的SP是自底向上的!(但51的再入堆栈也是自顶向下生长的)

;--且再入堆栈是由编译器自己管理的,一般不必去关心,只是在有再入函数的时候,根据

;函数的存储器模式使用相应的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 the SMALL 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 the LARGE 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 the COMPACT 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 the Compact Model with 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