-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup_assembly.s
23 lines (19 loc) · 1.02 KB
/
startup_assembly.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Directives required for Cortex-M4 */
.syntax unified
.cpu cortex-m4
.thumb
.section INTERRUPT_VECTOR, "x" /* name of SECTION with executable code*/
.global _Reset
_Reset: /* Vector table */
B stack_top /* Initial Stack Pointer value */
B Reset_Handler /* Reset */
B . /* NMI (Non-Maskable Interrupt) */
B . /* Hard fault */
B . /* Memory management fault */
B . /* Bus fault */
B . /* Usage fault */
/* TODO: add the remaining vectors */
Reset_Handler: /* Called whenever a Reset exception occurs */
LDR sp, =stack_top /* set stack pointer (address declared in linker file) */
BL entry /* branch to "entry()" function */
B . /* after entry() routine completes, this branches to itself and just hangs there */