1;/**************************************************************************//**
2; * @file     startup_psoc6_01_cm0plus.s
3; * @brief    CMSIS Core Device Startup File for
4; *           ARMCM0plus Device Series
5; * @version  V5.00
6; * @date     02. March 2016
7; ******************************************************************************/
8;/*
9; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
10; *
11; * SPDX-License-Identifier: Apache-2.0
12; *
13; * Licensed under the Apache License, Version 2.0 (the License); you may
14; * not use this file except in compliance with the License.
15; * You may obtain a copy of the License at
16; *
17; * www.apache.org/licenses/LICENSE-2.0
18; *
19; * Unless required by applicable law or agreed to in writing, software
20; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22; * See the License for the specific language governing permissions and
23; * limitations under the License.
24; */
25
26                PRESERVE8
27                THUMB
28
29; Vector Table Mapped to Address 0 at Reset
30
31                AREA    RESET, DATA, READONLY
32                EXPORT  __Vectors
33                EXPORT  __Vectors_End
34                EXPORT  __Vectors_Size
35
36                IMPORT |Image$$ARM_LIB_STACK$$ZI$$Base|
37                IMPORT |Image$$ARM_LIB_STACK$$ZI$$Length|
38
39__Vectors       DCD    |Image$$ARM_LIB_STACK$$ZI$$Base| + |Image$$ARM_LIB_STACK$$ZI$$Length| ; Top of Stack
40
41                DCD     Reset_Handler             ; Reset Handler
42
43                DCD     0x0000000D                ; NMI Handler located at ROM code
44                DCD     HardFault_Handler         ; Hard Fault Handler
45                DCD     0                         ; Reserved
46                DCD     0                         ; Reserved
47                DCD     0                         ; Reserved
48                DCD     0                         ; Reserved
49                DCD     0                         ; Reserved
50                DCD     0                         ; Reserved
51                DCD     0                         ; Reserved
52                DCD     SVC_Handler               ; SVCall Handler
53                DCD     0                         ; Reserved
54                DCD     0                         ; Reserved
55                DCD     PendSV_Handler            ; PendSV Handler
56                DCD     SysTick_Handler           ; SysTick Handler
57
58                ; External interrupts                           Description
59                DCD     NvicMux0_IRQHandler                   ; CM0+ NVIC Mux input 0
60                DCD     NvicMux1_IRQHandler                   ; CM0+ NVIC Mux input 1
61                DCD     NvicMux2_IRQHandler                   ; CM0+ NVIC Mux input 2
62                DCD     NvicMux3_IRQHandler                   ; CM0+ NVIC Mux input 3
63                DCD     NvicMux4_IRQHandler                   ; CM0+ NVIC Mux input 4
64                DCD     NvicMux5_IRQHandler                   ; CM0+ NVIC Mux input 5
65                DCD     NvicMux6_IRQHandler                   ; CM0+ NVIC Mux input 6
66                DCD     NvicMux7_IRQHandler                   ; CM0+ NVIC Mux input 7
67                DCD     NvicMux8_IRQHandler                   ; CM0+ NVIC Mux input 8
68                DCD     NvicMux9_IRQHandler                   ; CM0+ NVIC Mux input 9
69                DCD     NvicMux10_IRQHandler                  ; CM0+ NVIC Mux input 10
70                DCD     NvicMux11_IRQHandler                  ; CM0+ NVIC Mux input 11
71                DCD     NvicMux12_IRQHandler                  ; CM0+ NVIC Mux input 12
72                DCD     NvicMux13_IRQHandler                  ; CM0+ NVIC Mux input 13
73                DCD     NvicMux14_IRQHandler                  ; CM0+ NVIC Mux input 14
74                DCD     NvicMux15_IRQHandler                  ; CM0+ NVIC Mux input 15
75                DCD     NvicMux16_IRQHandler                  ; CM0+ NVIC Mux input 16
76                DCD     NvicMux17_IRQHandler                  ; CM0+ NVIC Mux input 17
77                DCD     NvicMux18_IRQHandler                  ; CM0+ NVIC Mux input 18
78                DCD     NvicMux19_IRQHandler                  ; CM0+ NVIC Mux input 19
79                DCD     NvicMux20_IRQHandler                  ; CM0+ NVIC Mux input 20
80                DCD     NvicMux21_IRQHandler                  ; CM0+ NVIC Mux input 21
81                DCD     NvicMux22_IRQHandler                  ; CM0+ NVIC Mux input 22
82                DCD     NvicMux23_IRQHandler                  ; CM0+ NVIC Mux input 23
83                DCD     NvicMux24_IRQHandler                  ; CM0+ NVIC Mux input 24
84                DCD     NvicMux25_IRQHandler                  ; CM0+ NVIC Mux input 25
85                DCD     NvicMux26_IRQHandler                  ; CM0+ NVIC Mux input 26
86                DCD     NvicMux27_IRQHandler                  ; CM0+ NVIC Mux input 27
87                DCD     NvicMux28_IRQHandler                  ; CM0+ NVIC Mux input 28
88                DCD     NvicMux29_IRQHandler                  ; CM0+ NVIC Mux input 29
89                DCD     NvicMux30_IRQHandler                  ; CM0+ NVIC Mux input 30
90                DCD     NvicMux31_IRQHandler                  ; CM0+ NVIC Mux input 31
91
92__Vectors_End
93
94__Vectors_Size  EQU     __Vectors_End - __Vectors
95                EXPORT __ramVectors
96                AREA    RESET_RAM, READWRITE, NOINIT
97__ramVectors    SPACE   __Vectors_Size
98
99
100                AREA    |.text|, CODE, READONLY
101
102
103; Weak function for startup customization
104;
105; Note. The global resources are not yet initialized (for example global variables, peripherals, clocks)
106; because this function is executed as the first instruction in the ResetHandler.
107; The PDL is also not initialized to use the proper register offsets.
108; The user of this function is responsible for initializing the PDL and resources before using them.
109;
110Cy_OnResetUser  PROC
111                EXPORT  Cy_OnResetUser            [WEAK]
112                BX      LR
113                ENDP
114
115; Reset Handler
116Reset_Handler   PROC
117                EXPORT  Reset_Handler             [WEAK]
118                IMPORT  __main
119
120                ; Define strong function for startup customization
121                BL      Cy_OnResetUser
122
123                ; Disable global interrupts
124                CPSID I
125
126                ; Copy vectors from ROM to RAM
127                LDR r1, =__Vectors
128                LDR r0, =__ramVectors
129                LDR r2, =__Vectors_Size
130Vectors_Copy
131                LDR r3, [r1]
132                STR r3, [r0]
133                ADDS r0, r0, #4
134                ADDS r1, r1, #4
135                SUBS r2, r2, #4
136                CMP r2, #0
137                BNE Vectors_Copy
138
139                ; Update Vector Table Offset Register. */
140                LDR r0, =__ramVectors
141                LDR r1, =0xE000ED08
142                STR r0, [r1]
143                dsb 0xF
144
145                LDR     R0, =__main
146                BLX     R0
147
148                ; Should never get here
149                B       .
150
151                ENDP
152
153; Dummy Exception Handlers (infinite loops which can be modified)
154NMI_Handler         PROC
155                    EXPORT  NMI_Handler               [WEAK]
156                    B       .
157                    ENDP
158
159Cy_SysLib_FaultHandler PROC
160                    EXPORT  Cy_SysLib_FaultHandler    [WEAK]
161                    B       .
162                    ENDP
163
164HardFault_Handler   PROC
165                    EXPORT HardFault_Handler          [WEAK]
166                    movs r0, #4
167                    mov r1, LR
168                    tst r0, r1
169                    beq L_MSP
170                    mrs r0, PSP
171                    bl L_API_call
172L_MSP
173                    mrs r0, MSP
174L_API_call
175                    bl Cy_SysLib_FaultHandler
176                    ENDP
177
178SVC_Handler         PROC
179                    EXPORT  SVC_Handler               [WEAK]
180                    B       .
181                    ENDP
182PendSV_Handler      PROC
183                    EXPORT  PendSV_Handler            [WEAK]
184                    B       .
185                    ENDP
186SysTick_Handler     PROC
187                    EXPORT  SysTick_Handler           [WEAK]
188                    B       .
189                    ENDP
190
191Default_Handler     PROC
192                    EXPORT  Default_Handler                       [WEAK]
193                    EXPORT  NvicMux0_IRQHandler                   [WEAK]
194                    EXPORT  NvicMux1_IRQHandler                   [WEAK]
195                    EXPORT  NvicMux2_IRQHandler                   [WEAK]
196                    EXPORT  NvicMux3_IRQHandler                   [WEAK]
197                    EXPORT  NvicMux4_IRQHandler                   [WEAK]
198                    EXPORT  NvicMux5_IRQHandler                   [WEAK]
199                    EXPORT  NvicMux6_IRQHandler                   [WEAK]
200                    EXPORT  NvicMux7_IRQHandler                   [WEAK]
201                    EXPORT  NvicMux8_IRQHandler                   [WEAK]
202                    EXPORT  NvicMux9_IRQHandler                   [WEAK]
203                    EXPORT  NvicMux10_IRQHandler                  [WEAK]
204                    EXPORT  NvicMux11_IRQHandler                  [WEAK]
205                    EXPORT  NvicMux12_IRQHandler                  [WEAK]
206                    EXPORT  NvicMux13_IRQHandler                  [WEAK]
207                    EXPORT  NvicMux14_IRQHandler                  [WEAK]
208                    EXPORT  NvicMux15_IRQHandler                  [WEAK]
209                    EXPORT  NvicMux16_IRQHandler                  [WEAK]
210                    EXPORT  NvicMux17_IRQHandler                  [WEAK]
211                    EXPORT  NvicMux18_IRQHandler                  [WEAK]
212                    EXPORT  NvicMux19_IRQHandler                  [WEAK]
213                    EXPORT  NvicMux20_IRQHandler                  [WEAK]
214                    EXPORT  NvicMux21_IRQHandler                  [WEAK]
215                    EXPORT  NvicMux22_IRQHandler                  [WEAK]
216                    EXPORT  NvicMux23_IRQHandler                  [WEAK]
217                    EXPORT  NvicMux24_IRQHandler                  [WEAK]
218                    EXPORT  NvicMux25_IRQHandler                  [WEAK]
219                    EXPORT  NvicMux26_IRQHandler                  [WEAK]
220                    EXPORT  NvicMux27_IRQHandler                  [WEAK]
221                    EXPORT  NvicMux28_IRQHandler                  [WEAK]
222                    EXPORT  NvicMux29_IRQHandler                  [WEAK]
223                    EXPORT  NvicMux30_IRQHandler                  [WEAK]
224                    EXPORT  NvicMux31_IRQHandler                  [WEAK]
225
226NvicMux0_IRQHandler
227NvicMux1_IRQHandler
228NvicMux2_IRQHandler
229NvicMux3_IRQHandler
230NvicMux4_IRQHandler
231NvicMux5_IRQHandler
232NvicMux6_IRQHandler
233NvicMux7_IRQHandler
234NvicMux8_IRQHandler
235NvicMux9_IRQHandler
236NvicMux10_IRQHandler
237NvicMux11_IRQHandler
238NvicMux12_IRQHandler
239NvicMux13_IRQHandler
240NvicMux14_IRQHandler
241NvicMux15_IRQHandler
242NvicMux16_IRQHandler
243NvicMux17_IRQHandler
244NvicMux18_IRQHandler
245NvicMux19_IRQHandler
246NvicMux20_IRQHandler
247NvicMux21_IRQHandler
248NvicMux22_IRQHandler
249NvicMux23_IRQHandler
250NvicMux24_IRQHandler
251NvicMux25_IRQHandler
252NvicMux26_IRQHandler
253NvicMux27_IRQHandler
254NvicMux28_IRQHandler
255NvicMux29_IRQHandler
256NvicMux30_IRQHandler
257NvicMux31_IRQHandler
258
259                B       .
260                ENDP
261
262                ALIGN
263
264
265; User Initial Stack & Heap
266                IMPORT   __use_two_region_memory
267
268                END
269
270
271; [] END OF FILE
272