keil软件 startup是啥文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了keil软件 startup是啥文件相关的知识,希望对你有一定的参考价值。

stm32f10x_it
是一个中断处理文件.这是把中断函数写在这里面而已,没有用到中断的话就可以不添加进去,也可以去掉,将中断函数添加到其它.c文件里也行。startup
里是启动文件,一般是与芯片匹配的文件。library
里是stm32的库函数的文件,里面的文件名不是写着
nvic、gpio、adc等后缀吗,就是其相关的库函数文件。这些文件是由官方提供的,建立工程时直接复制过来就可以用了,不过要配置好工程。不需要在main中include,stm32f10x.h中已经包含了,所以main.c中要#include
"stm32f10x.h"。在工程中配置中设置好路径就可以了。你是用keil是吧,建议看看一些入门书籍,一般都有介绍。
参考技术A startup.s
它是一个汇编文件,它对单片机进行初化操作,为跳到main设置堆栈。在Keil
中可以不用这个文件。可能是Keil
已经我为我作过这一个步。

单片机成长之路(51基础篇) - 018 keil51的STARTUP.A51

STARTUP.A51原始文件:

  1 $NOMOD51;Ax51宏汇编器控制命令,禁止预定义的8051。使编译器不使能预定义的;8051符号,避免产生重复定义的错误。
  2 ;------------------------------------------------------------------------------
  3 ;  This file is part of the C51 Compiler package
  4 ;  Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
  5 ;  Version 8.01
  6 ;
  7 ;  *** <<< Use Configuration Wizard in Context Menu >>> ***
  8 ;------------------------------------------------------------------------------
  9 ;  STARTUP.A51:  This code is executed after processor reset.
 10 ;
 11 ;  To translate this file use A51 with the following invocation:
 12 ;
 13 ;     A51 STARTUP.A51
 14 ;
 15 ;  To link the modified STARTUP.OBJ file to your application use the following
 16 ;  Lx51 invocation:
 17 ;
 18 ;     Lx51 your object file list, STARTUP.OBJ  controls
 19 ;
 20 ;------------------------------------------------------------------------------
 21 ;
 22 ;  User-defined <h> Power-On Initialization of Memory
 23 ;
 24 ;  With the following EQU statements the initialization of memory
 25 ;  at processor reset can be defined:
 26 ;
 27 ; <o> IDATALEN: IDATA memory size <0x0-0x100>
 28 ;     <i> Note: The absolute start-address of IDATA memory is always 0
 29 ;     <i>       The IDATA space overlaps physically the DATA and BIT areas.
 30 IDATALEN        EQU     80H
 31 ;
 32 ; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF> 
 33 ;     <i> The absolute start address of XDATA memory
 34 XDATASTART      EQU     0     
 35 ;
 36 ; <o> XDATALEN: XDATA memory size <0x0-0xFFFF> 
 37 ;     <i> The length of XDATA memory in bytes.
 38 XDATALEN        EQU     0      
 39 ;
 40 ; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF> 
 41 ;     <i> The absolute start address of PDATA memory
 42 PDATASTART      EQU     0H
 43 ;
 44 ; <o> PDATALEN: PDATA memory size <0x0-0xFF> 
 45 ;     <i> The length of PDATA memory in bytes.
 46 PDATALEN        EQU     0H
 47 ;
 48 ;</h>
 49 ;------------------------------------------------------------------------------
 50 ;
 51 ;<h> Reentrant Stack Initialization
 52 ;
 53 ;  The following EQU statements define the stack pointer for reentrant
 54 ;  functions and initialized it:
 55 ;
 56 ; <h> Stack Space for reentrant functions in the SMALL model.
 57 ;  <q> IBPSTACK: Enable SMALL model reentrant stack
 58 ;     <i> Stack space for reentrant functions in the SMALL model.
 59 IBPSTACK        EQU     0       ; set to 1 if small reentrant is used.
 60 ;  <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
 61 ;     <i> Set the top of the stack to the highest location.
 62 IBPSTACKTOP     EQU     0xFF +1     ; default 0FFH+1  
 63 ; </h>
 64 ;
 65 ; <h> Stack Space for reentrant functions in the LARGE model.      
 66 ;  <q> XBPSTACK: Enable LARGE model reentrant stack
 67 ;     <i> Stack space for reentrant functions in the LARGE model.
 68 XBPSTACK        EQU     0       ; set to 1 if large reentrant is used.
 69 ;  <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
 70 ;     <i> Set the top of the stack to the highest location.
 71 XBPSTACKTOP     EQU     0xFFFF +1   ; default 0FFFFH+1 
 72 ; </h>
 73 ;
 74 ; <h> Stack Space for reentrant functions in the COMPACT model.    
 75 ;  <q> PBPSTACK: Enable COMPACT model reentrant stack
 76 ;     <i> Stack space for reentrant functions in the COMPACT model.
 77 PBPSTACK        EQU     0       ; set to 1 if compact reentrant is used.
 78 ;
 79 ;   <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
 80 ;     <i> Set the top of the stack to the highest location.
 81 PBPSTACKTOP     EQU     0xFF +1     ; default 0FFH+1  
 82 ; </h>
 83 ;</h>
 84 ;------------------------------------------------------------------------------
 85 ;
 86 ;  Memory Page for Using the Compact Model with 64 KByte xdata RAM
 87 ;  <e>Compact Model Page Definition
 88 ;
 89 ;  <i>Define the XDATA page used for PDATA variables. 
 90 ;  <i>PPAGE must conform with the PPAGE set in the linker invocation.
 91 ;
 92 ; Enable pdata memory page initalization
 93 PPAGEENABLE     EQU     0       ; set to 1 if pdata object are used.
 94 ;
 95 ; <o> PPAGE number <0x0-0xFF> 
 96 ; <i> uppermost 256-byte address of the page used for PDATA variables.
 97 PPAGE           EQU     0
 98 ;
 99 ; <o> SFR address which supplies uppermost address byte <0x0-0xFF> 
100 ; <i> most 8051 variants use P2 as uppermost address byte
101 PPAGE_SFR       DATA    0A0H
102 ;
103 ; </e>
104 ;------------------------------------------------------------------------------
105 
106 ; Standard SFR Symbols 
107 ACC     DATA    0E0H
108 B       DATA    0F0H
109 SP      DATA    81H
110 DPL     DATA    82H
111 DPH     DATA    83H
112 
113                 NAME    ?C_STARTUP
114 
115 
116 ?C_C51STARTUP   SEGMENT   CODE
117 ?STACK          SEGMENT   IDATA
118 
119                 RSEG    ?STACK
120                 DS      1
121 
122                 EXTRN CODE (?C_START)
123                 PUBLIC  ?C_STARTUP
124 
125                 CSEG    AT      0
126                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ?C_STARTUP:     LJMP    STARTUP1
127 
128                 RSEG    ?C_C51STARTUP
129 
130 STARTUP1:
131 
132 IF IDATALEN <> 0
133                 MOV     R0,#IDATALEN - 1
134                 CLR     A
135 IDATALOOP:      MOV     @R0,A
136                 DJNZ    R0,IDATALOOP
137 ENDIF
138 
139 IF XDATALEN <> 0
140                 MOV     DPTR,#XDATASTART
141                 MOV     R7,#LOW (XDATALEN)
142   IF (LOW (XDATALEN)) <> 0
143                 MOV     R6,#(HIGH (XDATALEN)) +1
144   ELSE
145                 MOV     R6,#HIGH (XDATALEN)
146   ENDIF
147                 CLR     A
148 XDATALOOP:      MOVX    @DPTR,A
149                 INC     DPTR
150                 DJNZ    R7,XDATALOOP
151                 DJNZ    R6,XDATALOOP
152 ENDIF
153 
154 IF PPAGEENABLE <> 0
155                 MOV     PPAGE_SFR,#PPAGE
156 ENDIF
157 
158 IF PDATALEN <> 0
159                 MOV     R0,#LOW (PDATASTART)
160                 MOV     R7,#LOW (PDATALEN)
161                 CLR     A
162 PDATALOOP:      MOVX    @R0,A
163                 INC     R0
164                 DJNZ    R7,PDATALOOP
165 ENDIF
166 
167 IF IBPSTACK <> 0
168 EXTRN DATA (?C_IBP)
169 
170                 MOV     ?C_IBP,#LOW IBPSTACKTOP
171 ENDIF
172 
173 IF XBPSTACK <> 0
174 EXTRN DATA (?C_XBP)
175 
176                 MOV     ?C_XBP,#HIGH XBPSTACKTOP
177                 MOV     ?C_XBP+1,#LOW XBPSTACKTOP
178 ENDIF
179 
180 IF PBPSTACK <> 0
181 EXTRN DATA (?C_PBP)
182                 MOV     ?C_PBP,#LOW PBPSTACKTOP
183 ENDIF
184 
185                 MOV     SP,#?STACK-1
186 
187 ; This code is required if you use L51_BANK.A51 with Banking Mode 4
188 ;<h> Code Banking
189 ; <q> Select Bank 0 for L51_BANK.A51 Mode 4
190 #if 0   
191 ;     <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
192 EXTRN CODE (?B_SWITCH0)
193                 CALL    ?B_SWITCH0      ; init bank mechanism to code bank 0
194 #endif
195 ;</h>
196                 LJMP    ?C_START
197 
198                 END

 

以上是关于keil软件 startup是啥文件的主要内容,如果未能解决你的问题,请参考以下文章

Keil C中startup.a51的作用

Keil C中startup.a51的作用转

单片机成长之路(51基础篇) - 018 keil51的STARTUP.A51

stm32 开发中startup.s文件中常见的命令功能

安装TOMCAT之后点击BIN文件夹中的STARTUP.BAT是知识闪一下,启动不起来是啥问题呢?

单片机关于STARTUP.A51