1;/*!
2; * @file       startup_apm32f070.s
3; *
4; * @brief      APM32F070 devices vector table for EWARM toolchain.
5; *
6; * @version    V1.0.0
7; *
8; * @date       2022-02-21
9; *
10; * @attention
11; *
12; *  Copyright (C) 2020-2022 Geehy Semiconductor
13; *
14; *  You may not use this file except in compliance with the
15; *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
16; *
17; *  The program is only for reference, which is distributed in the hope
18; *  that it will be useful and instructional for customers to develop
19; *  their software. Unless required by applicable law or agreed to in
20; *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
21; *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
22; *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
23; *  and limitations under the License.
24; */
25
26        MODULE  ?cstartup
27
28        SECTION CSTACK:DATA:NOROOT(3)
29
30        SECTION .intvec:CODE:NOROOT(2)
31
32        EXTERN  __iar_program_start
33        EXTERN  SystemInit
34        PUBLIC  __vector_table
35
36        DATA
37__vector_table
38        DCD     sfe(CSTACK)
39        DCD     Reset_Handler                  ; Reset Handler
40
41        DCD     NMI_Handler                    ; NMI Handler
42        DCD     HardFault_Handler              ; Hard Fault Handler
43        DCD     0                              ; Reserved
44        DCD     0                              ; Reserved
45        DCD     0                              ; Reserved
46        DCD     0                              ; Reserved
47        DCD     0                              ; Reserved
48        DCD     0                              ; Reserved
49        DCD     0                              ; Reserved
50        DCD     SVC_Handler                    ; SVCall Handler
51        DCD     0                              ; Reserved
52        DCD     0                              ; Reserved
53        DCD     PendSV_Handler                 ; PendSV Handler
54        DCD     SysTick_Handler                ; SysTick Handler
55
56        ; External Interrupts
57        DCD     WWDT_IRQHandler                ; Window Watchdog
58        DCD     0                              ; Reserved
59        DCD     RTC_IRQHandler                 ; RTC through EXTI Line
60        DCD     FLASH_IRQHandler               ; FLASH
61        DCD     RCM_IRQHandler                 ; RCC
62        DCD     EINT0_1_IRQHandler             ; EINT Line 0 and 1
63        DCD     EINT2_3_IRQHandler             ; EINT Line 2 and 3
64        DCD     EINT4_15_IRQHandler            ; EINT Line 4 to 15
65        DCD     0                              ; Reserved
66        DCD     DMA1_CH1_IRQHandler            ; DMA1 Channel 1
67        DCD     DMA1_CH2_3_IRQHandler          ; DMA1 Channel 2 and Channel 3
68        DCD     DMA1_CH4_5_IRQHandler          ; DMA1 Channel 4 and Channel 5
69        DCD     ADC1_IRQHandler                ; ADC1
70        DCD     TMR1_BRK_UP_TRG_COM_IRQHandler ; TMR1 Break, Update, Trigger and Commutation
71        DCD     TMR1_CC_IRQHandler             ; TMR1 Capture Compare
72        DCD     0                              ; Reserved
73        DCD     TMR3_IRQHandler                ; TMR3
74        DCD     TMR6_IRQHandler                ; TMR6
75        DCD     TMR7_IRQHandler                ; TMR7
76        DCD     TMR14_IRQHandler               ; TMR14
77        DCD     TMR15_IRQHandler               ; TMR15
78        DCD     TMR16_IRQHandler               ; TMR16
79        DCD     TMR17_IRQHandler               ; TMR17
80        DCD     I2C1_IRQHandler                ; I2C1
81        DCD     I2C2_IRQHandler                ; I2C2
82        DCD     SPI1_IRQHandler                ; SPI1
83        DCD     SPI2_IRQHandler                ; SPI2
84        DCD     USART1_IRQHandler              ; USART1
85        DCD     USART2_IRQHandler              ; USART2
86        DCD     USART3_4_IRQHandler            ; USART3 and USART4
87        DCD     0                              ; Reserved
88        DCD     USBD_IRQHandler                ; USB
89
90        THUMB
91
92        PUBWEAK Reset_Handler
93        SECTION .text:CODE:NOROOT:REORDER(2)
94Reset_Handler
95
96        LDR     R0, =sfe(CSTACK)          ; set stack pointer
97        MSR     MSP, R0
98
99        LDR R0,=0x00000004
100        LDR R1, [R0]
101        LSRS R1, R1, #24
102        LDR R2,=0x1F
103        CMP R1, R2
104
105        BNE ApplicationStart
106
107        LDR R0,=0x40021018
108        LDR R1,=0x00000001
109        STR R1, [R0]
110
111        LDR R0,=0x40010000
112        LDR R1,=0x00000000
113        STR R1, [R0]
114ApplicationStart
115        LDR     R0, =SystemInit
116        BLX     R0
117        LDR     R0, =__iar_program_start
118        BX      R0
119
120        PUBWEAK NMI_Handler
121        SECTION .text:CODE:NOROOT:REORDER(1)
122NMI_Handler
123        B NMI_Handler
124
125        PUBWEAK HardFault_Handler
126        SECTION .text:CODE:NOROOT:REORDER(1)
127HardFault_Handler
128        B HardFault_Handler
129
130        PUBWEAK SVC_Handler
131        SECTION .text:CODE:NOROOT:REORDER(1)
132SVC_Handler
133        B SVC_Handler
134
135        PUBWEAK PendSV_Handler
136        SECTION .text:CODE:NOROOT:REORDER(1)
137PendSV_Handler
138        B PendSV_Handler
139
140        PUBWEAK SysTick_Handler
141        SECTION .text:CODE:NOROOT:REORDER(1)
142SysTick_Handler
143        B SysTick_Handler
144
145        PUBWEAK WWDT_IRQHandler
146        SECTION .text:CODE:NOROOT:REORDER(1)
147WWDT_IRQHandler
148        B WWDT_IRQHandler
149
150        PUBWEAK RTC_IRQHandler
151        SECTION .text:CODE:NOROOT:REORDER(1)
152RTC_IRQHandler
153        B RTC_IRQHandler
154
155        PUBWEAK FLASH_IRQHandler
156        SECTION .text:CODE:NOROOT:REORDER(1)
157FLASH_IRQHandler
158        B FLASH_IRQHandler
159
160        PUBWEAK RCM_IRQHandler
161        SECTION .text:CODE:NOROOT:REORDER(1)
162RCM_IRQHandler
163        B RCM_IRQHandler
164
165        PUBWEAK EINT0_1_IRQHandler
166        SECTION .text:CODE:NOROOT:REORDER(1)
167EINT0_1_IRQHandler
168        B EINT0_1_IRQHandler
169
170        PUBWEAK EINT2_3_IRQHandler
171        SECTION .text:CODE:NOROOT:REORDER(1)
172EINT2_3_IRQHandler
173        B EINT2_3_IRQHandler
174
175        PUBWEAK EINT4_15_IRQHandler
176        SECTION .text:CODE:NOROOT:REORDER(1)
177EINT4_15_IRQHandler
178        B EINT4_15_IRQHandler
179
180        PUBWEAK DMA1_CH1_IRQHandler
181        SECTION .text:CODE:NOROOT:REORDER(1)
182DMA1_CH1_IRQHandler
183        B DMA1_CH1_IRQHandler
184
185        PUBWEAK DMA1_CH2_3_IRQHandler
186        SECTION .text:CODE:NOROOT:REORDER(1)
187DMA1_CH2_3_IRQHandler
188        B DMA1_CH2_3_IRQHandler
189
190        PUBWEAK DMA1_CH4_5_IRQHandler
191        SECTION .text:CODE:NOROOT:REORDER(1)
192DMA1_CH4_5_IRQHandler
193        B DMA1_CH4_5_IRQHandler
194
195        PUBWEAK ADC1_IRQHandler
196        SECTION .text:CODE:NOROOT:REORDER(1)
197ADC1_IRQHandler
198        B ADC1_IRQHandler
199
200        PUBWEAK TMR1_BRK_UP_TRG_COM_IRQHandler
201        SECTION .text:CODE:NOROOT:REORDER(1)
202TMR1_BRK_UP_TRG_COM_IRQHandler
203        B TMR1_BRK_UP_TRG_COM_IRQHandler
204
205        PUBWEAK TMR1_CC_IRQHandler
206        SECTION .text:CODE:NOROOT:REORDER(1)
207TMR1_CC_IRQHandler
208        B TMR1_CC_IRQHandler
209
210        PUBWEAK TMR3_IRQHandler
211        SECTION .text:CODE:NOROOT:REORDER(1)
212TMR3_IRQHandler
213        B TMR3_IRQHandler
214
215        PUBWEAK TMR6_IRQHandler
216        SECTION .text:CODE:NOROOT:REORDER(1)
217TMR6_IRQHandler
218        B TMR6_IRQHandler
219
220        PUBWEAK TMR7_IRQHandler
221        SECTION .text:CODE:NOROOT:REORDER(1)
222TMR7_IRQHandler
223        B TMR7_IRQHandler
224
225        PUBWEAK TMR14_IRQHandler
226        SECTION .text:CODE:NOROOT:REORDER(1)
227TMR14_IRQHandler
228        B TMR14_IRQHandler
229
230        PUBWEAK TMR15_IRQHandler
231        SECTION .text:CODE:NOROOT:REORDER(1)
232TMR15_IRQHandler
233        B TMR15_IRQHandler
234
235        PUBWEAK TMR16_IRQHandler
236        SECTION .text:CODE:NOROOT:REORDER(1)
237TMR16_IRQHandler
238        B TMR16_IRQHandler
239
240        PUBWEAK TMR17_IRQHandler
241        SECTION .text:CODE:NOROOT:REORDER(1)
242TMR17_IRQHandler
243        B TMR17_IRQHandler
244
245        PUBWEAK I2C1_IRQHandler
246        SECTION .text:CODE:NOROOT:REORDER(1)
247I2C1_IRQHandler
248        B I2C1_IRQHandler
249
250        PUBWEAK I2C2_IRQHandler
251        SECTION .text:CODE:NOROOT:REORDER(1)
252I2C2_IRQHandler
253        B I2C2_IRQHandler
254
255        PUBWEAK SPI1_IRQHandler
256        SECTION .text:CODE:NOROOT:REORDER(1)
257SPI1_IRQHandler
258        B SPI1_IRQHandler
259
260        PUBWEAK SPI2_IRQHandler
261        SECTION .text:CODE:NOROOT:REORDER(1)
262SPI2_IRQHandler
263        B SPI2_IRQHandler
264
265        PUBWEAK USART1_IRQHandler
266        SECTION .text:CODE:NOROOT:REORDER(1)
267USART1_IRQHandler
268        B USART1_IRQHandler
269
270        PUBWEAK USART2_IRQHandler
271        SECTION .text:CODE:NOROOT:REORDER(1)
272USART2_IRQHandler
273        B USART2_IRQHandler
274
275        PUBWEAK USART3_4_IRQHandler
276        SECTION .text:CODE:NOROOT:REORDER(1)
277USART3_4_IRQHandler
278        B USART3_4_IRQHandler
279
280        PUBWEAK USBD_IRQHandler
281        SECTION .text:CODE:NOROOT:REORDER(1)
282USBD_IRQHandler
283        B USBD_IRQHandler
284
285        END
286