changeset 367:577ed7fb3fe4

Try to make thumb work again
author Windel Bouwman
date Fri, 21 Mar 2014 10:27:57 +0100
parents 39bf68bf1891
children d2ddfe134c48
files kernel/arch/qemu_m3/archmem.c3 kernel/arch/qemu_vexpress/archmem.c3 kernel/arch/vexpressA9.c3 kernel/arm.yaml kernel/src/kernel.c3 kernel/src/memory.c3 kernel/startup_a9.asm kernel/thumb.yaml python/ppci/recipe.py python/ppci/target/thumb/arm.brg test/testzcc.py
diffstat 11 files changed, 56 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/arch/qemu_m3/archmem.c3	Fri Mar 21 10:27:57 2014 +0100
@@ -0,0 +1,8 @@
+module archmem;
+import io;
+
+function void init()
+{
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/arch/qemu_vexpress/archmem.c3	Fri Mar 21 10:27:57 2014 +0100
@@ -0,0 +1,19 @@
+module archmem;
+import io;
+
+function void init()
+{
+    // putc(65)
+    io.print2("PFR0 = ", pfr0());
+    io.print2("PFR1 = ", pfr1());
+    io.print2("MMFR0 = ", mmfr0());
+
+    // This below is not compatible with all qemu versions:
+    // io.print2("MPUIR = ", arch.mpuir());
+}
+
+function int pfr0();
+function int pfr1();
+function int mmfr0();
+// function int mpuir();
+
--- a/kernel/arch/vexpressA9.c3	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/arch/vexpressA9.c3	Fri Mar 21 10:27:57 2014 +0100
@@ -1,4 +1,5 @@
 module arch;
+import io;
 
 
 function void init()
@@ -6,11 +7,6 @@
     // putc(65)
 }
 
-function int pfr0();
-function int pfr1();
-function int mmfr0();
-function int mpuir();
-
 function void putc(int c)
 {
     var int *UART0DR;
--- a/kernel/arm.yaml	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/arm.yaml	Fri Mar 21 10:27:57 2014 +0100
@@ -5,9 +5,10 @@
        source: startup_a9.asm
        machine: arm
     - compile:
-       sources: ['src/kernel.c3', 'src/syscall.c3', 'src/schedule.c3', 
-            'arch/vexpressA9.c3', 'src/io.c3', 'src/memory.c3', 'src/process.c3']
-       includes: []
+       sources: ['src/kernel.c3', 'src/syscall.c3', 'src/schedule.c3',
+            'arch/vexpressA9.c3', 'src/io.c3', 'src/memory.c3',
+            'src/process.c3',
+            'arch/qemu_vexpress/archmem.c3']
        machine: arm
   layout:
      code: 0x010000
--- a/kernel/src/kernel.c3	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/src/kernel.c3	Fri Mar 21 10:27:57 2014 +0100
@@ -6,46 +6,15 @@
 import arch;
 import io;
 
-var int G;
-
-function void do()
-{
-    G = G + 1;
-    io.print2("G = ", G);
-}
-
 // Main entry point of the kernel:
 function void start()
 {
-    G = 0;
     arch.init();
 
     io.println("Welcome to lcfos!");
 
-    do();
-    do();
-    do();
-    io.println("Welcome 2!");
-    do();
-    do();
-
-    io.print_int(0x1337);
-    io.print_int(cast<int>(&G));
-    //io.print2("Test: ", 0x13);
-
-    var int a;
-    for (a = 0; a < 2; a = a + 1)
-    {
-      io.print2("a = ", a);
-    }
-
-    io.print2("PFR0 = ", arch.pfr0());
-    io.print2("PFR1 = ", arch.pfr1());
-    io.print2("MMFR0 = ", arch.mmfr0());
-    // io.print2("MPUIR = ", arch.mpuir());
-
     // process.init();
-    //memory:init();
+    memory.init();
 
     //Process proc = new process:Process();
 
@@ -53,6 +22,7 @@
     while(true) {}
 }
 
+// Called in total stress:
 function void panic()
 {
     arch.halt();
--- a/kernel/src/memory.c3	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/src/memory.c3	Fri Mar 21 10:27:57 2014 +0100
@@ -1,9 +1,15 @@
 module memory;
 
-import process;
+import archmem;
 
 var int ptr;
 
+function void init()
+{
+    archmem.init();
+    // TODO
+}
+
 function u8* Alloc(int size)
 {
     ptr = ptr + size;
--- a/kernel/startup_a9.asm	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/startup_a9.asm	Fri Mar 21 10:27:57 2014 +0100
@@ -6,19 +6,19 @@
 
 
 ; Called to identify the proc:
-arch_pfr0:
+archmem_pfr0:
 mrc p15, 0, r0, c0, c1, 0
 mov pc, lr
 
-arch_pfr1:
+archmem_pfr1:
 mrc p15, 0, r0, c0, c1, 1
 mov pc, lr
 
-arch_mmfr0:
+archmem_mmfr0:
 mrc p15, 0, r0, c0, c1, 4
 mov pc, lr
 
 
-arch_mpuir:
+archmem_mpuir:
 mrc p15, 0, r0, c0, c0, 4
 mov pc, lr
--- a/kernel/thumb.yaml	Fri Mar 21 09:43:01 2014 +0100
+++ b/kernel/thumb.yaml	Fri Mar 21 10:27:57 2014 +0100
@@ -5,12 +5,11 @@
        source: startup_m3.asm
        machine: thumb
     - compile:
-       sources: [kernel.c3, syscall.c3, schedule.c3, 'arch/cortexm3.c3']
-       includes: [memory.c3, process.c3]
-       machine: thumb
-    - compile:
-       sources: [memory.c3, process.c3]
-       includes: [kernel.c3, syscall.c3, schedule.c3, 'arch/cortexm3.c3']
+       sources: ['src/kernel.c3', 'src/syscall.c3', 'src/schedule.c3', 
+            'arch/cortexm3.c3', 'src/io.c3', 'src/memory.c3',
+            'src/process.c3',
+            'arch/qemu_m3/archmem.c3'
+            ]
        machine: thumb
   layout:
      code: 0x10000
--- a/python/ppci/recipe.py	Fri Mar 21 09:43:01 2014 +0100
+++ b/python/ppci/recipe.py	Fri Mar 21 10:27:57 2014 +0100
@@ -31,7 +31,10 @@
 
     def handle_compile(self, value):
         sources = [self.openfile(s) for s in value['sources']]
-        includes = [self.openfile(i) for i in value['includes']]
+        if 'includes' in value:
+            includes = [self.openfile(i) for i in value['includes']]
+        else:
+            includes = []
         target = targets[value['machine']]
         output = ObjectFile()
         task = Compile(sources, includes, target, output)
--- a/python/ppci/target/thumb/arm.brg	Fri Mar 21 09:43:01 2014 +0100
+++ b/python/ppci/target/thumb/arm.brg	Fri Mar 21 10:27:57 2014 +0100
@@ -10,6 +10,7 @@
 %terminal ORI32 SHLI32
 %terminal CONSTI32 MEMI32 REGI32 CALL
 %terminal MOVI32
+%terminal GLOBALADDRESS CONSTDATA
 
 %%
 
--- a/test/testzcc.py	Fri Mar 21 09:43:01 2014 +0100
+++ b/test/testzcc.py	Fri Mar 21 10:27:57 2014 +0100
@@ -54,7 +54,7 @@
         arg_list.append('thumb')
         self.callZcc(arg_list)
 
-    @unittest.skip('Strings not yet functional')
+    @unittest.skip('Too hard')
     def testThumbKernel(self):
         """ Build kernel using zcc: """
         recipe = relpath('..', 'kernel', 'thumb.yaml')