startup_BAT32A239.s 11.6 KB
Newer Older
李俭双's avatar
李俭双 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
;/**************************************************************************//**
; * @file     startup_BAT32A239.s
; * @brief    CMSIS Cortex-M ARMv6-M based Core Device Startup File for
; *           Device BAT32A239
; * @version  V1.00
; * @date     2019/04/24
; ******************************************************************************/
;/*
; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
; *
; * SPDX-License-Identifier: Apache-2.0
; *
; * Licensed under the Apache License, Version 2.0 (the License); you may
; * not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; */
;/*

;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;*/


; <h> Stack Configuration
;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Stack_Size      EQU     0x00000400

                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   Stack_Size
__initial_sp


; <h> Heap Configuration
;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Heap_Size       EQU     0x00000100

                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem        SPACE   Heap_Size
__heap_limit


                PRESERVE8
                THUMB


; Vector Table Mapped to Address 0 at Reset

                AREA    VECTOR, DATA, READONLY
                EXPORT  __Vectors
                EXPORT  __Vectors_End
                EXPORT  __Vectors_Size

__Vectors       DCD     __initial_sp              ; Top of Stack
                DCD     Reset_Handler             ; Reset Handler
                DCD     NMI_Handler               ; NMI Handler
                DCD     HardFault_Handler         ; Hard Fault Handler
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     SVC_Handler               ; SVCall Handler
                DCD     0                         ; Reserved
                DCD     0                         ; Reserved
                DCD     PendSV_Handler            ; PendSV Handler
                DCD     SysTick_Handler           ; SysTick Handler

                ; External Interrupts
; ToDo:  Add here the vectors for the device specific external interrupts handler
                DCD     IRQ00_Handler       	  ;  LVI IRQ 
                DCD     IRQ01_Handler       	  ;  INTP0 or INTP6  IRQ 
                DCD     IRQ02_Handler       	  ;  INTP1 or INTP7  IRQ 
                DCD     IRQ03_Handler       	  ;  INTP2 or INTP8  IRQ 
                DCD     IRQ04_Handler       	  ;  INTP3 or INTP9  IRQ 
                DCD     IRQ05_Handler       	  ;  INTP4 or INTP10 IRQ 
                DCD     IRQ06_Handler       	  ;  INTP5 or INTP11 IRQ 
                DCD     IRQ07_Handler       	  ;  ST2/SPI20/IIC20 IRQ
                DCD     IRQ08_Handler       	  ;  SR2/SPI21/IIC21 IRQ
                DCD     IRQ09_Handler       	  ;  SRE2 IRQ 
                DCD     IRQ10_Handler       	  ;  ST0/SPI00/IIC00 IRQ
                DCD     IRQ11_Handler       	  ;  SR0/SPI01/IIC01 IRQ
                DCD     IRQ12_Handler       	  ;  SRE0 or TM01H IRQ 
                DCD     IRQ13_Handler       	  ;  ST1/SPI10/IIC10 IRQ
                DCD     IRQ14_Handler       	  ;  SR1/SPI11/IIC11 IRQ
                DCD     IRQ15_Handler       	  ;  SRE1 or TM03H IRQ 
                DCD     IRQ16_Handler       	  ;  IICA or DIV IRQ
                DCD     IRQ17_Handler       	  ;  TM00 IRQ
                DCD     IRQ18_Handler       	  ;  TM01 IRQ
                DCD     IRQ19_Handler       	  ;  TM02 IRQ
                DCD     IRQ20_Handler       	  ;  TM03 IRQ
                DCD     IRQ21_Handler       	  ;  ADC IRQ
                DCD     IRQ22_Handler       	  ;  RTC or IT IRQ
                DCD     IRQ23_Handler       	  ;  KEY IRQ
                DCD     IRQ24_Handler       	  ;  CMP0 IRQ
                DCD     IRQ25_Handler       	  ;  CMP1 IRQ
                DCD     IRQ26_Handler       	  ;  TMA IRQ
                DCD     IRQ27_Handler       	  ;  TMM0 IRQ
                DCD     IRQ28_Handler       	  ;  TMM1 IRQ
                DCD     IRQ29_Handler       	  ;  TMB IRQ
                DCD     IRQ30_Handler       	  ;  TMC IRQ
                DCD     IRQ31_Handler       	  ;  FMC IRQ
__Vectors_End

__Vectors_Size  EQU     __Vectors_End - __Vectors

                AREA    RESET, CODE, READONLY


; Reset Handler

Reset_Handler   PROC
                EXPORT  Reset_Handler             [WEAK]
                IMPORT  SystemInit
                IMPORT  __main
                LDR     R0, =SystemInit
                BLX     R0
                LDR     R0, =__main
                BX      R0
                ENDP


; Dummy Exception Handlers (infinite loops which can be modified)

NMI_Handler\
                PROC
                EXPORT  NMI_Handler               [WEAK]
                B       .
                ENDP
HardFault_Handler\
                PROC
                EXPORT  HardFault_Handler         [WEAK]
                B       .
                ENDP
MemManage_Handler\
                PROC
                EXPORT  MemManage_Handler         [WEAK]
                B       .
                ENDP
BusFault_Handler\
                PROC
                EXPORT  BusFault_Handler          [WEAK]
                B       .
                ENDP
UsageFault_Handler\
                PROC
                EXPORT  UsageFault_Handler        [WEAK]
                B       .
                ENDP
SVC_Handler\
                PROC
                EXPORT  SVC_Handler               [WEAK]
                B       .
                ENDP
DebugMon_Handler\
                PROC
                EXPORT  DebugMon_Handler          [WEAK]
                B       .
                ENDP
PendSV_Handler\
                PROC
                EXPORT  PendSV_Handler            [WEAK]
                B       .
                ENDP
SysTick_Handler\
                PROC
                EXPORT  SysTick_Handler           [WEAK]
                B       .
                ENDP
IRQ00_Handler\
                PROC
                EXPORT  IRQ00_Handler           [WEAK]
                B       .
                ENDP
IRQ01_Handler\
                PROC
                EXPORT  IRQ01_Handler           [WEAK]
                B       .
                ENDP
IRQ02_Handler\
                PROC
                EXPORT  IRQ02_Handler           [WEAK]
                B       .
                ENDP
IRQ03_Handler\
                PROC
                EXPORT  IRQ03_Handler           [WEAK]
                B       .
                ENDP
IRQ04_Handler\
                PROC
                EXPORT  IRQ04_Handler           [WEAK]
                B       .
                ENDP
IRQ05_Handler\
                PROC
                EXPORT  IRQ05_Handler           [WEAK]
                B       .
                ENDP
IRQ06_Handler\
                PROC
                EXPORT  IRQ06_Handler           [WEAK]
                B       .
                ENDP
IRQ07_Handler\
                PROC
                EXPORT  IRQ07_Handler           [WEAK]
                B       .
                ENDP
IRQ08_Handler\
                PROC
                EXPORT  IRQ08_Handler           [WEAK]
                B       .
                ENDP
IRQ09_Handler\
                PROC
                EXPORT  IRQ09_Handler           [WEAK]
                B       .
                ENDP
IRQ10_Handler\
                PROC
                EXPORT  IRQ10_Handler           [WEAK]
                B       .
                ENDP
IRQ11_Handler\
                PROC
                EXPORT  IRQ11_Handler           [WEAK]
                B       .
                ENDP
IRQ12_Handler\
                PROC
                EXPORT  IRQ12_Handler           [WEAK]
                B       .
                ENDP
IRQ13_Handler\
                PROC
                EXPORT  IRQ13_Handler           [WEAK]
                B       .
                ENDP
IRQ14_Handler\
                PROC
                EXPORT  IRQ14_Handler           [WEAK]
                B       .
                ENDP
IRQ15_Handler\
                PROC
                EXPORT  IRQ15_Handler           [WEAK]
                B       .
                ENDP
IRQ16_Handler\
                PROC
                EXPORT  IRQ16_Handler           [WEAK]
                B       .
                ENDP
IRQ17_Handler\
                PROC
                EXPORT  IRQ17_Handler           [WEAK]
                B       .
                ENDP
IRQ18_Handler\
                PROC
                EXPORT  IRQ18_Handler           [WEAK]
                B       .
                ENDP
IRQ19_Handler\
                PROC
                EXPORT  IRQ19_Handler           [WEAK]
                B       .
                ENDP
IRQ20_Handler\
                PROC
                EXPORT  IRQ20_Handler           [WEAK]
                B       .
                ENDP
IRQ21_Handler\
                PROC
                EXPORT  IRQ21_Handler           [WEAK]
                B       .
                ENDP
IRQ22_Handler\
                PROC
                EXPORT  IRQ22_Handler           [WEAK]
                B       .
                ENDP
IRQ23_Handler\
                PROC
                EXPORT  IRQ23_Handler           [WEAK]
                B       .
                ENDP
IRQ24_Handler\
                PROC
                EXPORT  IRQ24_Handler           [WEAK]
                B       .
                ENDP
IRQ25_Handler\
                PROC
                EXPORT  IRQ25_Handler           [WEAK]
                B       .
                ENDP
IRQ26_Handler\
                PROC
                EXPORT  IRQ26_Handler           [WEAK]
                B       .
                ENDP
IRQ27_Handler\
                PROC
                EXPORT  IRQ27_Handler           [WEAK]
                B       .
                ENDP
IRQ28_Handler\
                PROC
                EXPORT  IRQ28_Handler           [WEAK]
                B       .
                ENDP
IRQ29_Handler\
                PROC
                EXPORT  IRQ29_Handler           [WEAK]
                B       .
                ENDP
IRQ30_Handler\
                PROC
                EXPORT  IRQ30_Handler           [WEAK]
                B       .
                ENDP
IRQ31_Handler\
                PROC
                EXPORT  IRQ31_Handler           [WEAK]
                B       .
                ENDP


                ALIGN


; User Initial Stack & Heap

                IF      :DEF:__MICROLIB

                EXPORT  __initial_sp
                EXPORT  __heap_base
                EXPORT  __heap_limit

                ELSE

                IMPORT  __use_two_region_memory
                EXPORT  __user_initial_stackheap

__user_initial_stackheap PROC
                LDR     R0, =  Heap_Mem
                LDR     R1, =(Stack_Mem + Stack_Size)
                LDR     R2, = (Heap_Mem +  Heap_Size)
                LDR     R3, = Stack_Mem
                BX      LR
                ENDP

                ALIGN

                ENDIF


                END