MOS Source Code
Loading...
Searching...
No Matches
vectors.c
Go to the documentation of this file.
1
#include <stdint.h>
2
3
#ifdef __cplusplus
4
extern
"C"
{
5
#endif
6
7
extern
void
_start
();
8
extern
void
*
__StackTop
;
9
10
static
void
HardFaultHandler
()
11
{
12
uint32_t
args
[3];
13
args
[0] = 2;
14
args
[1] = (
uint32_t
)
"HARDFAULT"
;
15
args
[2] = 9;
16
17
asm
(
"mov r0, #5\n"
18
"mov r1, %0\n"
19
"bkpt 0x00ab"
: :
"r"
(
args
) :
"r0"
,
"r1"
,
"memory"
);
20
asm
(
"mov r12, %0\n"
"mov r0, #24\n"
"bkpt 0x00ab"
: :
"r"
(0xDEADBEEF) :
"r0"
);
21
while
(1);
22
}
23
24
void
*
const
g_vector_table[16]
__attribute__
((
section
(
".isr_vector"
))) = {
25
(
void
*)&
__StackTop
,
26
(
void
*)&
_start
,
27
(
void
*)&
HardFaultHandler
,
28
(
void
*)&
HardFaultHandler
,
29
(
void
*)&
HardFaultHandler
,
30
(
void
*)&
HardFaultHandler
,
31
(
void
*)&
HardFaultHandler
,
32
};
33
34
35
void
ramboot
()
__attribute__
((noreturn,
naked
,
section
(".
ramboot
")));
36
void
ramboot
()
37
{
38
*(
const
void
**)0xE000ED08 = g_vector_table;
// SCB->VTOR
39
__asm__(
40
"msr msp, %0\n\t"
41
"bx %1"
: :
"r"
(g_vector_table[0]),
42
"r"
(g_vector_table[1]) :
"memory"
);
43
}
44
45
#ifdef __cplusplus
46
}
47
#endif
args
char args[3][16]
Definition
avr_io.c:16
uint32_t
unsigned int uint32_t
Definition
pb_syshdr.h:24
_start
void _start()
section
void section(".ramboot")))
naked
void naked
Definition
vectors.c:35
__StackTop
void * __StackTop
__attribute__
void *const g_vector_table[16] __attribute__((section(".isr_vector")))
HardFaultHandler
static void HardFaultHandler()
Definition
vectors.c:10
ramboot
void ramboot() __attribute__((noreturn
Definition
vectors.c:36
libs
nanopb
nanopb
tests
site_scons
platforms
stm32
vectors.c
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0