-
Notifications
You must be signed in to change notification settings - Fork 2
/
startup_bootloader_stm32h7b0xx.s
72 lines (60 loc) · 1.61 KB
/
startup_bootloader_stm32h7b0xx.s
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
.syntax unified
.cpu cortex-m7
.fpu softvfp
.thumb
.global g_pfnVectors_bootloader
.word __payload_start__
.word __payload_end__
.section .text.Reset_Handler_bootloader
.weak Reset_Handler_bootloader
.type Reset_Handler_bootloader, %function
Reset_Handler_bootloader:
/* Copy the application payload from flash to SRAM */
movs r1, #0
b LoopCopyPayload
CopyPayload:
movs r4, #0x24000000
ldr r3, [r0, r1]
str r3, [r4, r1]
adds r1, r1, #4
LoopCopyPayload:
ldr r0, =__payload_start__
ldr r3, =__payload_end__
adds r2, r0, r1
cmp r2, r3
bcc CopyPayload
/* Hand over to payload code */
movs r3, #0x24000000
ldr r1, [r3]
add r3, #4
ldr r0, [r3]
msr msp, r1 /* load r1 into MSP */
bx r0 /* branch to the address at r0 */
.size Reset_Handler_bootloader, .-Reset_Handler_bootloader
/******************************************************************************
*
* The minimal vector table for a Cortex M. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
*******************************************************************************/
.section .isr_vector_bootloader,"a",%progbits
.type g_pfnVectors_bootloader, %object
.size g_pfnVectors_bootloader, .-g_pfnVectors_bootloader
g_pfnVectors_bootloader:
.word _estack
.word Reset_Handler_bootloader
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0