System Calls cleanup, multiple Processes and context switch
[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 pendsv_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
35 nmi:
36         b nmi
37
38 hardfault:
39         mov r5, 9
40         b hardfault2
41
42 hardfault2:
43         b hardfault2
44
45         .end
46