-
Notifications
You must be signed in to change notification settings - Fork 31
/
startup_stm32f10x.c
262 lines (177 loc) · 8.07 KB
/
startup_stm32f10x.c
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
/* Generated by startup_generator */
#include <stm32f10x.h>
extern void _estack(void); // to force type checking
void Reset_Handler(void);
void default_handler(void) {
while (1);
}
void __attribute__ ((weak)) __libc_init_array(void) { }
// Linker supplied pointers
extern unsigned long _sidata;
extern unsigned long _sdata;
extern unsigned long _edata;
extern unsigned long _sbss;
extern unsigned long _ebss;
extern int main(void);
void Reset_Handler(void) {
unsigned long *src, *dst;
src = &_sidata;
dst = &_sdata;
// Copy data initializers
while (dst < &_edata)
*(dst++) = *(src++);
// Zero bss
dst = &_sbss;
while (dst < &_ebss)
*(dst++) = 0;
SystemInit();
__libc_init_array();
main();
while (1) { }
}
/* Vector Table */
void NMI_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void HardFault_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void MemMange_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void BusFault_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void UsageFault_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void SVC_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void DebugMon_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void PendSV_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void SysTick_Handler(void) __attribute__ ((weak, alias ("default_handler")));
void WWDG_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void PVD_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TAMPER_STAMP_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void RTC_WKUP_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void FLASH_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void RCC_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI0_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI4_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel4_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel6_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel7_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void ADC1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI9_5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM1_BRK_TIM15_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM1_UP_TIM16_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM1_TRG_COM_TIM17_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM1_CC_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM4_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void I2C1_EV_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void I2C1_ER_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void I2C2_EV_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void I2C2_ER_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void SPI1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void SPI2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void USART1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void USART2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void USART3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void EXTI15_10_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void RTCAlarm_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void CEC_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM12_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM13_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM14_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void ADC3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void FSMC_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void SPI3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void UART4_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void UART5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM6_DAC_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void TIM7_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA2_Channel1_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA2_Channel2_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA2_Channel3_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA2_Channel4_5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
void DMA2_Channel5_IRQHandler(void) __attribute__ ((weak, alias ("default_handler")));
__attribute__ ((section(".isr_vector")))
void (*const g_pfnVectors[])(void) = {
_estack,
Reset_Handler,
NMI_Handler,
HardFault_Handler,
MemMange_Handler,
BusFault_Handler,
UsageFault_Handler,
0, 0, 0, 0,
SVC_Handler,
DebugMon_Handler,
0,
PendSV_Handler,
SysTick_Handler,
WWDG_IRQHandler,
PVD_IRQHandler,
TAMPER_STAMP_IRQHandler,
RTC_WKUP_IRQHandler,
FLASH_IRQHandler,
RCC_IRQHandler,
EXTI0_IRQHandler,
EXTI1_IRQHandler,
EXTI2_IRQHandler,
EXTI3_IRQHandler,
EXTI4_IRQHandler,
DMA1_Channel1_IRQHandler,
DMA1_Channel2_IRQHandler,
DMA1_Channel3_IRQHandler,
DMA1_Channel4_IRQHandler,
DMA1_Channel5_IRQHandler,
DMA1_Channel6_IRQHandler,
DMA1_Channel7_IRQHandler,
ADC1_IRQHandler,
0, 0, 0, 0,
EXTI9_5_IRQHandler,
TIM1_BRK_TIM15_IRQHandler,
TIM1_UP_TIM16_IRQHandler,
TIM1_TRG_COM_TIM17_IRQHandler,
TIM1_CC_IRQHandler,
TIM2_IRQHandler,
TIM3_IRQHandler,
TIM4_IRQHandler,
I2C1_EV_IRQHandler,
I2C1_ER_IRQHandler,
I2C2_EV_IRQHandler,
I2C2_ER_IRQHandler,
SPI1_IRQHandler,
SPI2_IRQHandler,
USART1_IRQHandler,
USART2_IRQHandler,
USART3_IRQHandler,
EXTI15_10_IRQHandler,
RTCAlarm_IRQHandler,
CEC_IRQHandler,
TIM12_IRQHandler,
TIM13_IRQHandler,
TIM14_IRQHandler,
0,
ADC3_IRQHandler,
FSMC_IRQHandler,
0,
TIM5_IRQHandler,
SPI3_IRQHandler,
UART4_IRQHandler,
UART5_IRQHandler,
TIM6_DAC_IRQHandler,
TIM7_IRQHandler,
DMA2_Channel1_IRQHandler,
DMA2_Channel2_IRQHandler,
DMA2_Channel3_IRQHandler,
DMA2_Channel4_5_IRQHandler,
DMA2_Channel5_IRQHandler,
0, 0, 0, 0, 0, 0, 0, 0,
0,
#if defined (STM32F10X_LD_VL) || (defined STM32F10X_MD_VL)
[0x1CC/4] = 0xF108F85F
#elif defined (STM32F10X_HD_VL)
[0x1E0/4] = 0xF108F85F
#endif
};