1;/*!
2; * @file       startup_apm32f030.s
3; *
4; * @brief      APM32F030 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_6_IRQHandler            ; USART3,USART4,USART5,USART6
87
88        THUMB
89
90        PUBWEAK Reset_Handler
91        SECTION .text:CODE:NOROOT:REORDER(2)
92Reset_Handler
93
94        LDR     R0, =sfe(CSTACK)          ; set stack pointer
95        MSR     MSP, R0
96
97        LDR R0,=0x00000004
98        LDR R1, [R0]
99        LSRS R1, R1, #24
100        LDR R2,=0x1F
101        CMP R1, R2
102
103        BNE ApplicationStart
104
105        LDR R0,=0x40021018
106        LDR R1,=0x00000001
107        STR R1, [R0]
108
109        LDR R0,=0x40010000
110        LDR R1,=0x00000000
111        STR R1, [R0]
112ApplicationStart
113        LDR     R0, =SystemInit
114        BLX     R0
115        LDR     R0, =__iar_program_start
116        BX      R0
117
118        PUBWEAK NMI_Handler
119        SECTION .text:CODE:NOROOT:REORDER(1)
120NMI_Handler
121        B NMI_Handler
122
123        PUBWEAK HardFault_Handler
124        SECTION .text:CODE:NOROOT:REORDER(1)
125HardFault_Handler
126        B HardFault_Handler
127
128        PUBWEAK SVC_Handler
129        SECTION .text:CODE:NOROOT:REORDER(1)
130SVC_Handler
131        B SVC_Handler
132
133        PUBWEAK PendSV_Handler
134        SECTION .text:CODE:NOROOT:REORDER(1)
135PendSV_Handler
136        B PendSV_Handler
137
138        PUBWEAK SysTick_Handler
139        SECTION .text:CODE:NOROOT:REORDER(1)
140SysTick_Handler
141        B SysTick_Handler
142
143        PUBWEAK WWDT_IRQHandler
144        SECTION .text:CODE:NOROOT:REORDER(1)
145WWDT_IRQHandler
146        B WWDT_IRQHandler
147
148        PUBWEAK RTC_IRQHandler
149        SECTION .text:CODE:NOROOT:REORDER(1)
150RTC_IRQHandler
151        B RTC_IRQHandler
152
153        PUBWEAK FLASH_IRQHandler
154        SECTION .text:CODE:NOROOT:REORDER(1)
155FLASH_IRQHandler
156        B FLASH_IRQHandler
157
158        PUBWEAK RCM_IRQHandler
159        SECTION .text:CODE:NOROOT:REORDER(1)
160RCM_IRQHandler
161        B RCM_IRQHandler
162
163        PUBWEAK EINT0_1_IRQHandler
164        SECTION .text:CODE:NOROOT:REORDER(1)
165EINT0_1_IRQHandler
166        B EINT0_1_IRQHandler
167
168        PUBWEAK EINT2_3_IRQHandler
169        SECTION .text:CODE:NOROOT:REORDER(1)
170EINT2_3_IRQHandler
171        B EINT2_3_IRQHandler
172
173        PUBWEAK EINT4_15_IRQHandler
174        SECTION .text:CODE:NOROOT:REORDER(1)
175EINT4_15_IRQHandler
176        B EINT4_15_IRQHandler
177
178        PUBWEAK DMA1_CH1_IRQHandler
179        SECTION .text:CODE:NOROOT:REORDER(1)
180DMA1_CH1_IRQHandler
181        B DMA1_CH1_IRQHandler
182
183        PUBWEAK DMA1_CH2_3_IRQHandler
184        SECTION .text:CODE:NOROOT:REORDER(1)
185DMA1_CH2_3_IRQHandler
186        B DMA1_CH2_3_IRQHandler
187
188        PUBWEAK DMA1_CH4_5_IRQHandler
189        SECTION .text:CODE:NOROOT:REORDER(1)
190DMA1_CH4_5_IRQHandler
191        B DMA1_CH4_5_IRQHandler
192
193        PUBWEAK ADC1_IRQHandler
194        SECTION .text:CODE:NOROOT:REORDER(1)
195ADC1_IRQHandler
196        B ADC1_IRQHandler
197
198        PUBWEAK TMR1_BRK_UP_TRG_COM_IRQHandler
199        SECTION .text:CODE:NOROOT:REORDER(1)
200TMR1_BRK_UP_TRG_COM_IRQHandler
201        B TMR1_BRK_UP_TRG_COM_IRQHandler
202
203        PUBWEAK TMR1_CC_IRQHandler
204        SECTION .text:CODE:NOROOT:REORDER(1)
205TMR1_CC_IRQHandler
206        B TMR1_CC_IRQHandler
207
208        PUBWEAK TMR3_IRQHandler
209        SECTION .text:CODE:NOROOT:REORDER(1)
210TMR3_IRQHandler
211        B TMR3_IRQHandler
212
213        PUBWEAK TMR6_IRQHandler
214        SECTION .text:CODE:NOROOT:REORDER(1)
215TMR6_IRQHandler
216        B TMR6_IRQHandler
217
218        PUBWEAK TMR7_IRQHandler
219        SECTION .text:CODE:NOROOT:REORDER(1)
220TMR7_IRQHandler
221        B TMR7_IRQHandler
222
223        PUBWEAK TMR14_IRQHandler
224        SECTION .text:CODE:NOROOT:REORDER(1)
225TMR14_IRQHandler
226        B TMR14_IRQHandler
227
228        PUBWEAK TMR15_IRQHandler
229        SECTION .text:CODE:NOROOT:REORDER(1)
230TMR15_IRQHandler
231        B TMR15_IRQHandler
232
233        PUBWEAK TMR16_IRQHandler
234        SECTION .text:CODE:NOROOT:REORDER(1)
235TMR16_IRQHandler
236        B TMR16_IRQHandler
237
238        PUBWEAK TMR17_IRQHandler
239        SECTION .text:CODE:NOROOT:REORDER(1)
240TMR17_IRQHandler
241        B TMR17_IRQHandler
242
243        PUBWEAK I2C1_IRQHandler
244        SECTION .text:CODE:NOROOT:REORDER(1)
245I2C1_IRQHandler
246        B I2C1_IRQHandler
247
248        PUBWEAK I2C2_IRQHandler
249        SECTION .text:CODE:NOROOT:REORDER(1)
250I2C2_IRQHandler
251        B I2C2_IRQHandler
252
253        PUBWEAK SPI1_IRQHandler
254        SECTION .text:CODE:NOROOT:REORDER(1)
255SPI1_IRQHandler
256        B SPI1_IRQHandler
257
258        PUBWEAK SPI2_IRQHandler
259        SECTION .text:CODE:NOROOT:REORDER(1)
260SPI2_IRQHandler
261        B SPI2_IRQHandler
262
263        PUBWEAK USART1_IRQHandler
264        SECTION .text:CODE:NOROOT:REORDER(1)
265USART1_IRQHandler
266        B USART1_IRQHandler
267
268        PUBWEAK USART2_IRQHandler
269        SECTION .text:CODE:NOROOT:REORDER(1)
270USART2_IRQHandler
271        B USART2_IRQHandler
272
273        PUBWEAK USART3_6_IRQHandler
274        SECTION .text:CODE:NOROOT:REORDER(1)
275USART3_6_IRQHandler
276        B USART3_6_IRQHandler
277
278        END
279