-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcore.S
executable file
·49 lines (44 loc) · 1.02 KB
/
core.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
/*
* Test program to boot an STM32 chip with the absolute
* minimum required code for teaching about the chips.
*
* Copyright William Ransohoff, Vivonomicon, LLC, 2017
*
* Open source under the MIT License
*/
.syntax unified
.cpu cortex-m0
.fpu softvfp
.thumb
// Global values.
.global vtable
.global reset_handler
/*
* The vector table.
* Most entries are ommitted for simplicity.
*/
.type vtable, %object
vtable:
.word _estack
.word reset_handler
.size vtable, .-vtable
/*
* The Reset handler. Called on reset.
*/
.type reset_handler, %function
reset_handler:
// Set the stack pointer to the end of the stack.
// The '_estack' value is defined in our linker script.
LDR r0, =_estack
MOV sp, r0
// Set some dummy values. When we see these values
// in our debugger, we'll know that our program
// is loaded on the chip and working.
LDR r7, =0xDEADBEEF
MOVS r0, #0
main_loop:
// Add 1 to register 'r0'.
ADDS r0, r0, #1
// Loop back.
B main_loop
.size reset_handler, .-reset_handler