SYSCALL naked assembly working
[cortex-from-scratch] / start.asm
1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
2  * 
3  * $LOG$
4  * 2019/7/20 - ROBIN KRENS      
5  * Initial version 
6  * 
7  * $DESCRIPTION$
8  */
9
10 /* _start sets up the stack and jumps to the reset vector */
11
12         .equ STACK_TOP, 0x20010000 /* placed at 64kB, top of SRAM */
13         .text
14         .global _start
15         .global reset, nmi, hardfault
16         .global _svc_handler
17         .code 16
18         .syntax unified
19 _start:
20         .word STACK_TOP, reset, nmi, hardfault
21         .type reset, function
22
23 /* A reset vector (or bootcode) will call main in main.c
24    this is the so called 'entry to C' */
25 reset:
26         b main
27         b reset 
28
29 /* These are consequently the nmi and hardfault vector handlers
30    before booting and entering main, these can actually be called
31    (machine somehow has a failure). That's why they are included here.
32    Later the interrupt vector will be relocated to SRAM and modified.  */
33
34 nmi:
35         b nmi
36
37 hardfault:
38         mov r5, 9
39         b hardfault2
40
41 hardfault2:
42         b hardfault2
43
44         .end
45