-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.c
103 lines (94 loc) · 2.15 KB
/
startup.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
int main(void);
extern unsigned int _etext;
extern unsigned int _sdata;
extern unsigned int _edata;
extern unsigned int _sbss;
extern unsigned int _ebss;
extern unsigned int _estack;
static void default_handler(void)
{
while (1);
}
void reset_handler(void)
{
unsigned int *src, *dst;
/* copy data section */
src = &_etext;
dst = &_sdata;
while (dst < &_edata)
*dst++ = *src++;
/* clear bss */
dst = &_sbss;
while (dst < &_ebss)
*dst++ = 0;
main();
while (1);
}
void nmi_handler(void) __attribute__((weak, alias("default_handler")));
void hardfault_handler(void) __attribute__((weak, alias("default_handler")));
void svc_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 group0_irq(void) __attribute__((weak, alias("default_handler")));
void group1_irq(void) __attribute__((weak, alias("default_handler")));
void timg1_irq(void) __attribute__((weak, alias("default_handler")));
void adc0_irq(void) __attribute__((weak, alias("default_handler")));
void spi0_irq(void) __attribute__((weak, alias("default_handler")));
void uart1_irq(void) __attribute__((weak, alias("default_handler")));
void uart0_irq(void) __attribute__((weak, alias("default_handler")));
void timg0_irq(void) __attribute__((weak, alias("default_handler")));
void timg2_irq(void) __attribute__((weak, alias("default_handler")));
void timg4_irq(void) __attribute__((weak, alias("default_handler")));
void i2c0_irq(void) __attribute__((weak, alias("default_handler")));
void i2c1_irq(void) __attribute__((weak, alias("default_handler")));
void dma_irq(void) __attribute__((weak, alias("default_handler")));
void *vector_table[] __attribute__ ((section (".vectors"))) = {
&_estack,
reset_handler,
nmi_handler,
hardfault_handler,
0,
0,
0,
0,
0,
0,
0,
svc_handler,
0,
0,
pendsv_handler,
systick_handler,
group0_irq,
group1_irq,
timg1_irq,
0,
adc0_irq,
0,
0,
0,
0,
spi0_irq,
0,
0,
0,
uart1_irq,
0,
uart0_irq,
timg0_irq,
0,
timg2_irq,
0,
timg4_irq,
0,
0,
0,
i2c0_irq,
i2c1_irq,
0,
0,
0,
0,
0,
dma_irq,
};