1 | ;****************************************************************************** |
---|
2 | ;* File Name : startup_stm32c011xx.s |
---|
3 | ;* Author : MCD Application Team |
---|
4 | ;* Description : STM32C011xx devices vector table for EWARM toolchain. |
---|
5 | ;* This module performs: |
---|
6 | ;* - Set the initial SP |
---|
7 | ;* - Set the initial PC == __iar_program_start, |
---|
8 | ;* - Set the vector table entries with the exceptions ISR |
---|
9 | ;* address |
---|
10 | ;* - Branches to main in the C library (which eventually |
---|
11 | ;* calls main()). |
---|
12 | ;* After Reset the Cortex-M0+ processor is in Thread mode, |
---|
13 | ;* priority is Privileged, and the Stack is set to Main. |
---|
14 | ;****************************************************************************** |
---|
15 | ;* @attention |
---|
16 | ;* |
---|
17 | ;* Copyright (c) 2022 STMicroelectronics. |
---|
18 | ;* All rights reserved. |
---|
19 | ;* |
---|
20 | ;* This software is licensed under terms that can be found in the LICENSE file |
---|
21 | ;* in the root directory of this software component. |
---|
22 | ;* If no LICENSE file comes with this software, it is provided AS-IS. |
---|
23 | ;* |
---|
24 | ;******************************************************************************* |
---|
25 | ; |
---|
26 | ; The modules in this file are included in the libraries, and may be replaced |
---|
27 | ; by any user-defined modules that define the PUBLIC symbol _program_start or |
---|
28 | ; a user defined start symbol. |
---|
29 | ; To override the cstartup defined in the library, simply add your modified |
---|
30 | ; version to the workbench project. |
---|
31 | ; |
---|
32 | ; The vector table is normally located at address 0. |
---|
33 | ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. |
---|
34 | ; The name "__vector_table" has special meaning for C-SPY: |
---|
35 | ; it is where the SP start value is found, and the NVIC vector |
---|
36 | ; table register (VTOR) is initialized to this address if != 0. |
---|
37 | ; |
---|
38 | ; Cortex-M version |
---|
39 | ; |
---|
40 | |
---|
41 | MODULE ?cstartup |
---|
42 | |
---|
43 | ;; Forward declaration of sections. |
---|
44 | SECTION CSTACK:DATA:NOROOT(3) |
---|
45 | |
---|
46 | SECTION .intvec:CODE:NOROOT(2) |
---|
47 | |
---|
48 | EXTERN __iar_program_start |
---|
49 | EXTERN SystemInit |
---|
50 | PUBLIC __vector_table |
---|
51 | |
---|
52 | DATA |
---|
53 | __vector_table |
---|
54 | DCD sfe(CSTACK) |
---|
55 | DCD Reset_Handler ; Reset Handler |
---|
56 | |
---|
57 | DCD NMI_Handler ; NMI Handler |
---|
58 | DCD HardFault_Handler ; Hard Fault Handler |
---|
59 | DCD 0 ; Reserved |
---|
60 | DCD 0 ; Reserved |
---|
61 | DCD 0 ; Reserved |
---|
62 | DCD 0 ; Reserved |
---|
63 | DCD 0 ; Reserved |
---|
64 | DCD 0 ; Reserved |
---|
65 | DCD 0 ; Reserved |
---|
66 | DCD SVC_Handler ; SVCall Handler |
---|
67 | DCD 0 ; Reserved |
---|
68 | DCD 0 ; Reserved |
---|
69 | DCD PendSV_Handler ; PendSV Handler |
---|
70 | DCD SysTick_Handler ; SysTick Handler |
---|
71 | |
---|
72 | ; External Interrupts |
---|
73 | DCD WWDG_IRQHandler ; Window Watchdog |
---|
74 | DCD 0 ; Reserved |
---|
75 | DCD RTC_IRQHandler ; RTC through EXTI Line |
---|
76 | DCD FLASH_IRQHandler ; FLASH |
---|
77 | DCD RCC_IRQHandler ; RCC |
---|
78 | DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1 |
---|
79 | DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3 |
---|
80 | DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15 |
---|
81 | DCD 0 ; Reserved |
---|
82 | DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 |
---|
83 | DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3 |
---|
84 | DCD DMAMUX1_IRQHandler ; DMAMUX |
---|
85 | DCD ADC1_IRQHandler ; ADC1 |
---|
86 | DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation |
---|
87 | DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare |
---|
88 | DCD 0 ; Reserved |
---|
89 | DCD TIM3_IRQHandler ; TIM3 |
---|
90 | DCD 0 ; Reserved |
---|
91 | DCD 0 ; Reserved |
---|
92 | DCD TIM14_IRQHandler ; TIM14 |
---|
93 | DCD 0 ; Reserved |
---|
94 | DCD TIM16_IRQHandler ; TIM16 |
---|
95 | DCD TIM17_IRQHandler ; TIM17 |
---|
96 | DCD I2C1_IRQHandler ; I2C1 |
---|
97 | DCD 0 ; Reserved |
---|
98 | DCD SPI1_IRQHandler ; SPI1 |
---|
99 | DCD 0 ; Reserved |
---|
100 | DCD USART1_IRQHandler ; USART1 |
---|
101 | DCD USART2_IRQHandler ; USART2 |
---|
102 | DCD 0 ; Reserved |
---|
103 | DCD 0 ; Reserved |
---|
104 | DCD 0 ; Reserved |
---|
105 | |
---|
106 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
107 | ;; |
---|
108 | ;; Default interrupt handlers. |
---|
109 | ;; |
---|
110 | THUMB |
---|
111 | |
---|
112 | PUBWEAK Reset_Handler |
---|
113 | SECTION .text:CODE:NOROOT:REORDER(2) |
---|
114 | Reset_Handler |
---|
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) |
---|
122 | NMI_Handler |
---|
123 | B NMI_Handler |
---|
124 | |
---|
125 | PUBWEAK HardFault_Handler |
---|
126 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
127 | HardFault_Handler |
---|
128 | B HardFault_Handler |
---|
129 | |
---|
130 | PUBWEAK SVC_Handler |
---|
131 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
132 | SVC_Handler |
---|
133 | B SVC_Handler |
---|
134 | |
---|
135 | PUBWEAK PendSV_Handler |
---|
136 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
137 | PendSV_Handler |
---|
138 | B PendSV_Handler |
---|
139 | |
---|
140 | PUBWEAK SysTick_Handler |
---|
141 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
142 | SysTick_Handler |
---|
143 | B SysTick_Handler |
---|
144 | |
---|
145 | PUBWEAK WWDG_IRQHandler |
---|
146 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
147 | WWDG_IRQHandler |
---|
148 | B WWDG_IRQHandler |
---|
149 | |
---|
150 | PUBWEAK RTC_IRQHandler |
---|
151 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
152 | RTC_IRQHandler |
---|
153 | B RTC_IRQHandler |
---|
154 | |
---|
155 | PUBWEAK FLASH_IRQHandler |
---|
156 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
157 | FLASH_IRQHandler |
---|
158 | B FLASH_IRQHandler |
---|
159 | |
---|
160 | PUBWEAK RCC_IRQHandler |
---|
161 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
162 | RCC_IRQHandler |
---|
163 | B RCC_IRQHandler |
---|
164 | |
---|
165 | PUBWEAK EXTI0_1_IRQHandler |
---|
166 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
167 | EXTI0_1_IRQHandler |
---|
168 | B EXTI0_1_IRQHandler |
---|
169 | |
---|
170 | PUBWEAK EXTI2_3_IRQHandler |
---|
171 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
172 | EXTI2_3_IRQHandler |
---|
173 | B EXTI2_3_IRQHandler |
---|
174 | |
---|
175 | PUBWEAK EXTI4_15_IRQHandler |
---|
176 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
177 | EXTI4_15_IRQHandler |
---|
178 | B EXTI4_15_IRQHandler |
---|
179 | |
---|
180 | PUBWEAK DMA1_Channel1_IRQHandler |
---|
181 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
182 | DMA1_Channel1_IRQHandler |
---|
183 | B DMA1_Channel1_IRQHandler |
---|
184 | |
---|
185 | PUBWEAK DMA1_Channel2_3_IRQHandler |
---|
186 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
187 | DMA1_Channel2_3_IRQHandler |
---|
188 | B DMA1_Channel2_3_IRQHandler |
---|
189 | |
---|
190 | PUBWEAK DMAMUX1_IRQHandler |
---|
191 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
192 | DMAMUX1_IRQHandler |
---|
193 | B DMAMUX1_IRQHandler |
---|
194 | |
---|
195 | PUBWEAK ADC1_IRQHandler |
---|
196 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
197 | ADC1_IRQHandler |
---|
198 | B ADC1_IRQHandler |
---|
199 | |
---|
200 | PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler |
---|
201 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
202 | TIM1_BRK_UP_TRG_COM_IRQHandler |
---|
203 | B TIM1_BRK_UP_TRG_COM_IRQHandler |
---|
204 | |
---|
205 | PUBWEAK TIM1_CC_IRQHandler |
---|
206 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
207 | TIM1_CC_IRQHandler |
---|
208 | B TIM1_CC_IRQHandler |
---|
209 | |
---|
210 | PUBWEAK TIM3_IRQHandler |
---|
211 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
212 | TIM3_IRQHandler |
---|
213 | B TIM3_IRQHandler |
---|
214 | |
---|
215 | PUBWEAK TIM14_IRQHandler |
---|
216 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
217 | TIM14_IRQHandler |
---|
218 | B TIM14_IRQHandler |
---|
219 | |
---|
220 | PUBWEAK TIM16_IRQHandler |
---|
221 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
222 | TIM16_IRQHandler |
---|
223 | B TIM16_IRQHandler |
---|
224 | |
---|
225 | PUBWEAK TIM17_IRQHandler |
---|
226 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
227 | TIM17_IRQHandler |
---|
228 | B TIM17_IRQHandler |
---|
229 | |
---|
230 | PUBWEAK I2C1_IRQHandler |
---|
231 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
232 | I2C1_IRQHandler |
---|
233 | B I2C1_IRQHandler |
---|
234 | |
---|
235 | PUBWEAK SPI1_IRQHandler |
---|
236 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
237 | SPI1_IRQHandler |
---|
238 | B SPI1_IRQHandler |
---|
239 | |
---|
240 | PUBWEAK USART1_IRQHandler |
---|
241 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
242 | USART1_IRQHandler |
---|
243 | B USART1_IRQHandler |
---|
244 | |
---|
245 | PUBWEAK USART2_IRQHandler |
---|
246 | SECTION .text:CODE:NOROOT:REORDER(1) |
---|
247 | USART2_IRQHandler |
---|
248 | B USART2_IRQHandler |
---|
249 | |
---|
250 | ;#pragma default_function_attributes = @ ".prot_func" |
---|
251 | SECTION .prot_func:CODE |
---|
252 | PUBLIC StickyCall |
---|
253 | ;BKP2R_ADDRESS EQU 0x4000b108 |
---|
254 | StickyCall |
---|
255 | LDR R0, =0x40 |
---|
256 | LSLS R0, R0, #16 |
---|
257 | LDR R1, =0x70 |
---|
258 | ADD R0, R0, R1 |
---|
259 | LSLS R0, R0, #8 |
---|
260 | LDR R1, =0x74 |
---|
261 | ADD R0, R0, R1 |
---|
262 | LDR R0, [R0] |
---|
263 | BX LR |
---|
264 | ;#pragma default_function_attributes = |
---|
265 | |
---|
266 | END |
---|
267 | |
---|