System Calls cleanup, multiple Processes and context switch
[cortex-from-scratch] / start.asm
index e4ca237..65b67f5 100644 (file)
--- a/start.asm
+++ b/start.asm
@@ -1,7 +1,19 @@
-       .equ STACK_TOP, 0x20008000 /* placed at 32kB, TODO: could place at top of SRAM? */
+/* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
+ * 
+ * $LOG$
+ * 2019/7/20 - ROBIN KRENS     
+ * Initial version 
+ * 
+ * $DESCRIPTION$
+ */
+
+/* _start sets up the stack and jumps to the reset vector */
+
+       .equ STACK_TOP, 0x20010000 /* placed at 64kB, top of SRAM */
        .text
        .global _start
        .global reset, nmi, hardfault
+       .global pendsv_handler
        .code 16
        .syntax unified
 _start:
@@ -17,24 +29,18 @@ reset:
 /* These are consequently the nmi and hardfault vector handlers
    before booting and entering main, these can actually be called
    (machine somehow has a failure). That's why they are included here.
-   Later the interrupt vector
-   will be relocated to SRAM and the will be copied / modified.  */
+   Later the interrupt vector will be relocated to SRAM and modified.  */
+
 
 nmi:
        b nmi
 
-hardfault: 
-       b hardfault
-.global stub
-stub:
-       mov r1, #'z'
-       ldr r0, [r1]
-       bx lr
-       /* ldr R0,=10
-       mov R1,#0
-       udiv.w R2, R0, R1 */
-
-       .data
-       .word 'x' 
+hardfault:
+       mov r5, 9
+       b hardfault2
+
+hardfault2:
+       b hardfault2
+
        .end