-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstartup_stm32f0xx.c
192 lines (164 loc) · 6.2 KB
/
startup_stm32f0xx.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
/* Generated by startup_generator */
#include <stm32f0xx.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_VDDIO2_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void RTC_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void FLASH_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void RCC_CRS_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void EXTI0_1_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void EXTI2_3_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void EXTI4_15_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void TSC_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel1_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel2_3_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void DMA1_Channel4_5_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void ADC1_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void TIM1_BRK_UP_TRG_COM_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 TIM14_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void TIM15_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void TIM16_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void TIM17_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void I2C1_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 CEC_CAN_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
void USB_IRQHandler (void) __attribute__ ((weak, alias ("default_handler")));
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) = {
[0] = _estack,
[1] = Reset_Handler,
[2] = NMI_Handler,
[3] = HardFault_Handler,
[4] = 0,
[5] = 0,
[6] = 0,
[7] = 0,
[8] = 0,
[9] = 0,
[10] = 0,
[11] = SVC_Handler,
[12] = 0,
[13] = 0,
[14] = PendSV_Handler,
[15] = SysTick_Handler,
[16] = WWDG_IRQHandler,
[17] = PVD_VDDIO2_IRQHandler,
[18] = RTC_IRQHandler,
[19] = FLASH_IRQHandler,
[20] = RCC_CRS_IRQHandler,
[21] = EXTI0_1_IRQHandler,
[22] = EXTI2_3_IRQHandler,
[23] = EXTI4_15_IRQHandler,
[24] = TSC_IRQHandler,
[25] = DMA1_Channel1_IRQHandler,
[26] = DMA1_Channel2_3_IRQHandler,
[27] = DMA1_Channel4_5_IRQHandler,
[28] = ADC1_IRQHandler,
[29] = TIM1_BRK_UP_TRG_COM_IRQHandler,
[30] = TIM1_CC_IRQHandler,
[31] = TIM2_IRQHandler,
[32] = TIM3_IRQHandler,
[33] = 0,
[34] = 0,
[35] = TIM14_IRQHandler,
[36] = 0,
[37] = TIM16_IRQHandler,
[38] = TIM17_IRQHandler,
[39] = I2C1_IRQHandler,
[40] = 0,
[41] = SPI1_IRQHandler,
[42] = SPI2_IRQHandler,
[43] = USART1_IRQHandler,
[44] = USART2_IRQHandler,
[45] = 0,
[46] = CEC_CAN_IRQHandler,
[47] = USB_IRQHandler,
};
/*
void (* const g_pfnVectors[])(void) = {
[0] = _estack,
[1] = Reset_Handler,
[2] = NMI_Handler,
[3] = HardFault_Handler,
[4] = MemMange_Handler,
[5] = BusFault_Handler,
[6] = UsageFault_Handler,
[11] = SVC_Handler,
[12] = DebugMon_Handler,
[14] = PendSV_Handler,
[15] = SysTick_Handler,
[16] = WWDG_IRQHandler,
[17] = PVD_IRQHandler,
[18] = TAMPER_STAMP_IRQHandler,
[19] = RTC_WKUP_IRQHandler,
[20] = FLASH_IRQHandler,
[21] = RCC_IRQHandler,
[22] = EXTI0_1_IRQHandler,
[23] = EXTI2_3_IRQHandler,
[24] = EXTI4_15_IRQHandler,
[25] = TS_IRQHandler,
[26] = EXTI4_IRQHandler,
[27] = DMA1_Channel1_IRQHandler,
[28] = DMA1_Channel2_3_IRQHandler,
[29] = DMA1_Channel4_5_IRQHandler,
[30] = ADC1_COMP_IRQHandler,
[31] = TIM1_BRK_UP_TRG_IRQHandler,
[32] = TIM1_CC_IRQHandler,
[33] = TIM2_IRQHandler,
[34] = TIM3_IRQHandler,
[35] = TIM6_DAC_IRQHandler,
[37] = TIM14_IRQHandler,
[38] = TIM15_IRQHandler,
[39] = TIM16_IRQHandler,
[40] = TIM17_IRQHandler,
[41] = I2C1_IRQHandler,
[42] = I2C2_IRQHandler,
[43] = SPI1_IRQHandler,
[44] = SPI2_IRQHandler,
[45] = USART1_IRQHandler,
[46] = USART2_IRQHandler,
[48] = CEC_CAN_IRQHandler,
};
*/