init vector implementation
[cortex-from-scratch] / start.asm
1         .equ STACK_TOP, 0x20000800
2         .text
3         .global _start
4         .global reset, nmi, hardfault
5         .code 16
6         .syntax unified
7 _start:
8         .word STACK_TOP, reset, nmi, hardfault
9         .type reset, function
10
11 /* A reset vector (or bootcode) will call main in main.c
12    this is the so called 'entry to C' */
13 reset:
14         b main
15         b reset 
16
17 /* These are consequently the nmi and hardfault vector handlers
18    before booting and entering main, these can actually be called
19    (machine somehow has a failure). That's why they are included here.
20    Later the interrupt vector
21    will be relocated to SRAM and the will be copied / modified.  */
22
23 nmi:
24         b nmi
25
26 hardfault: 
27         b hardfault
28 .global stub
29 stub:
30         mov r1, #'z'
31         ldr r0, [r1]
32         bx lr
33         /* ldr R0,=10
34         mov R1,#0
35         udiv.w R2, R0, R1 */
36
37         .data
38         .word 'x'
39         .end
40