-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstartup_stm32f103xb.c
executable file
·110 lines (105 loc) · 2.57 KB
/
startup_stm32f103xb.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
int main(void);
void __attribute__ ((weak, naked)) reset_handler(void) {
(*(volatile unsigned int *)(0x40021018)) |= (1 << 4);
(*(volatile unsigned int *)(0x40011004)) |= (0x00 << (((13 - 8) * 4) + 2));
(*(volatile unsigned int *)(0x40011004)) |= (0x02 << ((13 - 8) * 4));
main();
}
void blocking_handler(void) { while (1); }
void null_handler(void) {}
extern unsigned _stack;
__attribute__ ((section(".vectors")))
struct {
unsigned int *initial_sp_value;
void (*reset)(void);
void (*nmi)(void);
void (*hard_fault)(void);
void (*memory_manage_fault)(void);
void (*bus_fault)(void);
void (*usage_fault)(void);
void (*reserved_x001c[4])(void);
void (*sv_call)(void);
void (*debug_monitor)(void);
void (*reserved_x0034)(void);
void (*pend_sv)(void);
void (*systick)(void);
void (*irq[68])(void);
} vector_table = {
.initial_sp_value = &_stack,
.reset = reset_handler,
.nmi = null_handler,
.hard_fault = blocking_handler,
.sv_call = null_handler,
.pend_sv = null_handler,
.systick = null_handler,
.irq = {
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
null_handler,
}
};