armv7-m (heteropanda) builds.
authorDavid Cock <david.cock@inf.ethz.ch>
Fri, 28 Aug 2015 14:00:01 +0000 (16:00 +0200)
committerDavid Cock <david.cock@inf.ethz.ch>
Fri, 28 Aug 2015 14:00:01 +0000 (16:00 +0200)
Signed-off-by: David Cock <david.cock@inf.ethz.ch>

14 files changed:
include/arch/arm/barrelfish/cpu_arch.h
include/arch/arm/barrelfish/syscall_arch.h
include/target/arm/barrelfish_kpi/paging_arm_v7m.h
kernel/arch/arm/syscall.c
kernel/arch/armv7-m/init.c
kernel/include/arch/armv7-m/irq.h
kernel/paging_generic.c
lib/term/client/client_blocking.c
lib/thc/Hakefile
lib/thc/thc.c
platforms/Hakefile
usr/drivers/cpuboot/armboot.c
usr/spawnd/Hakefile
usr/startd/Hakefile

index cf5d4bc..f1e3327 100644 (file)
@@ -18,6 +18,8 @@
 // XXX: placeholder; there's definitely more than one arm in existence!
 #ifdef __ARM_ARCH_7A__
 #define CURRENT_CPU_TYPE CPU_ARM7
+#elif __ARM_ARCH_7M__
+#define CURRENT_CPU_TYPE CPU_ARM7
 #elif __ARM_ARCH_5__
 #define CURRENT_CPU_TYPE CPU_ARM5
 #elif __ARM_ARCH_8A__
index 62f566f..b15687a 100644 (file)
@@ -83,6 +83,8 @@ syscall(uintptr_t b, uintptr_t c, uintptr_t d, uintptr_t e,
 
 
 #ifdef __ARM_ARCH_7M__  //cortex-m3 on pandaboard
+#include <barrelfish_kpi/registers_arch.h>
+
 //add syscall for restoring a context that the dispatcher can not restore by itself
 errval_t sys_resume_context(arch_registers_state_t* registers);
 #endif
index d465c6e..43ef200 100644 (file)
 #define BASE_PAGE_MASK          (BASE_PAGE_SIZE - 1)
 #define BASE_PAGE_OFFSET(a)     ((a) & BASE_PAGE_MASK)
 
-#define LARGE_PAGE_MASK                 0x0000FFFF  //64KB large page
+/* 1MB large pages */
+#define LARGE_PAGE_BITS         20
+#define LARGE_PAGE_SIZE         (1u << LARGE_PAGE_BITS)
+#define LARGE_PAGE_MASK         (LARGE_PAGE_SIZE - 1)
+#define LARGE_PAGE_OFFSET(a)    ((a) & LARGE_PAGE_MASK)
 
 #define ARM_L1_OFFSET(addr)       (((uintptr_t)addr) >> 20)
 #define ARM_L2_OFFSET(addr)       ((((uintptr_t)addr) >> 12) & 0xff)
index 752e305..106226f 100644 (file)
@@ -1019,9 +1019,12 @@ static struct sysret handle_debug_syscall(int msg)
 {
     struct sysret retval = { .error = SYS_ERR_OK };
     switch (msg) {
+#if !defined(__ARM_ARCH_7M__)
         case DEBUG_FLUSH_CACHE:
             cp15_invalidate_i_and_d_caches_fast();
             break;
+#endif
+
         case DEBUG_CONTEXT_COUNTER_RESET:
             dispatch_csc_reset();
             break;
@@ -1043,7 +1046,7 @@ static struct sysret handle_debug_syscall(int msg)
             break;
 
         /* XXX - not revision-independent. */
-        #if defined(__pandaboard__)
+#if defined(__pandaboard__) && !defined(__ARM_ARCH_7M__)
         case DEBUG_HARDWARE_GLOBAL_TIMER_LOW:
             retval.value = gt_read_low();
             break;
@@ -1051,7 +1054,7 @@ static struct sysret handle_debug_syscall(int msg)
         case DEBUG_HARDWARE_GLOBAL_TIMER_HIGH:
             retval.value = gt_read_high();
             break;
-        #endif
+#endif
 
         default:
             printk(LOG_ERR, "invalid sys_debug msg type %d\n", msg);
index 2b0ae7e..fb9c839 100644 (file)
@@ -31,6 +31,7 @@
 #include <kernel_multiboot.h>
 #include <global.h>
 #include <start_aps.h> // AP_WAIT_*, AUX_CORE_BOOT_*  and friends
+#include <irq.h>
 
 #include <omap44xx_map.h>
 #include <dev/omap/omap44xx_id_dev.h>
@@ -127,7 +128,7 @@ static void  __attribute__ ((noinline,noreturn)) text_init(void)
     //printf("kernel_startup_early done!\n");
 
     //initialize console
-    serial_init(serial_console_port);
+    serial_init(serial_console_port, 1);
     spinlock_init();
 
     printf("Barrelfish CPU driver starting on ARMv7-M OMAP44xx"
@@ -341,3 +342,9 @@ void arch_init(void *pointer)
     //we already are in a virtual address space, so we do not have to do MMU stuff already
     text_init();
 }
+
+struct kcb;
+errval_t irq_table_notify_domains(struct kcb *kcb)
+{
+    return SYS_ERR_OK;
+}
index 74a6340..2760a14 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef KERNEL_ARCH_ARM_IRQ_H
 #define KERNEL_ARCH_ARM_IRQ_H
 
+#define NDISPATCH               1
+
 struct capability;
 struct idc_recv_msg;
 //struct sysret irq_table_set(struct capability *to, struct idc_recv_msg *msg);
@@ -17,5 +19,6 @@ struct idc_recv_msg;
 errval_t irq_table_set(unsigned int nidt, capaddr_t endpoint);
 errval_t irq_table_delete(unsigned int nidt);
 void send_user_interrupt(int irq);
+errval_t irq_table_notify_domains(struct kcb *kcb);
 
 #endif // KERNEL_ARCH_ARM_IRQ_H
index 9c2804a..d249570 100644 (file)
@@ -282,6 +282,8 @@ errval_t paging_tlb_flush_range(struct cte *frame, size_t offset, size_t pages)
         case ObjType_VNode_ARM_l2:
             page_size = BASE_PAGE_SIZE;
             break;
+#elif defined(__ARM_ARCH_7M__)
+            // -M profile chips don't have a TLB
 #elif defined(__ARM_ARCH_8A__)
             // TODO: define ARMv8 paging
 #else
index 07994c7..32ae526 100644 (file)
@@ -64,9 +64,9 @@ errval_t term_client_blocking_init(struct term_client *client,
                                    struct capref session_id)
 {
     errval_t err;
-    iref_t in_iref;
-    iref_t out_iref;
-    iref_t conf_iref;
+    iref_t in_iref= 0;
+    iref_t out_iref= 0;
+    iref_t conf_iref= 0;
 
     /* Initialize client state to default values. */
     struct_term_client_init(client);
index 3c438a6..b8cdb33 100644 (file)
 --------------------------------------------------------------------------
 
 [ build library { target = "thc",
-                  cFiles = [ "thc.c", "thcsync.c", "thcstubs.c" ]
-                } ]
+                  cFiles = [ "thc.c", "thcsync.c", "thcstubs.c" ],
+                  architectures = Data.List.delete "armv7-m" allArchitectures
+                },
+  build library { target = "thc",
+                  cFiles = [ "thc.c", "thcsync.c", "thcstubs.c" ],
+                  addCFlags = [ "-fomit-frame-pointer" ],
+                  architectures = [ "armv7-m" ]
+                }
+]
index 94c5048..cc81600 100644 (file)
@@ -1603,7 +1603,8 @@ __asm__ ("      .text \n\t"
         " int3                      \n\t" /* should never be called */
         );
 
-#elif (defined(__arm__) && (defined(linux) || defined(BARRELFISH)))
+#elif (defined(__arm__) && (defined(linux) || defined(BARRELFISH) \
+                        && !defined(__ARM_ARCH_7M__)))
 // NOTES:
 //  - not sure about alignment (.align)
 
@@ -1679,17 +1680,18 @@ void thc_awe_execute_0(awe_t *awe) {
   assert(0 && "_thc_awe_execute_0 not implemented for this architecture");
 }
 
-int _thc_schedulecont(void *cont) {
+int _thc_schedulecont(awe_t *awe) {
   assert(0 && "_thc_schedulecont not implemented for this architecture");
   return 0;
 }
 
-void _thc_callcont(void *awe,   
-                   void *fn,         
+void _thc_callcont(awe_t *awe,   
+                   THCContFn_t fn,         
                    void *args) {            
   assert(0 && "_thc_callcont not implemented for this architecture");
 }
-void  _thc_lazy_awe_marker() {            
+
+void _thc_lazy_awe_marker(void) {            
   assert(0 && "_thc_lazy_awe_marker not implemented for this architecture");
 }
 #endif
index 1e7102e..38549d1 100644 (file)
@@ -422,7 +422,8 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
             Str "-I", Str "binary",
             Str "-O", Str "elf32-littlearm",
             Str "-B", Str "arm",
-            Str "--rename-section", Str ".data=.rodata_thumb,alloc,load,readonly,data,contents",
+            Str "--rename-section", Str (".data=.rodata_thumb,alloc,load" ++
+                                         ",readonly,data,contents"),
             In BuildTree "root" "/pandaboard_m3image_intermediate",
             Out "root" "/pandaboard_m3image" ]),
     
@@ -431,10 +432,11 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
             Str "--srcdir",   NoDep SrcTree "root" "/.", 
             Str "--builddir", NoDep BuildTree "root" "/.",
             Str "-D",         Str "HETEROPANDA",
-            Str "--menu",     In SrcTree "tools" "/hake/menu.lst.heteropandaboard",
+            Str "--menu",     In SrcTree "tools"
+                                         "/hake/menu.lst.heteropanda_master",
             Str "--baseaddr", Str "0x82001000",
             Str "--extra",    In BuildTree "root" "/pandaboard_m3image",
-            Str "--image",    Out "root" "/pandaboard_hetero_image",
+            Str "--image",    Out "root" "/pandaboard_het_image",
             Str "--gcc",      Str Config.arm_cc,
             Str "--objcopy",  Str Config.arm_objcopy,
             Dep BuildTree "tools" "/bin/arm_molly"
index 45bd533..de5f4f8 100644 (file)
@@ -335,7 +335,7 @@ errval_t spawn_xcore_monitor(coreid_t coreid, int hwid,
     }
 
     // Load cpu driver to the allocate space and do relocatation
-    uintptr_t reloc_entry;
+    uintptr_t reloc_entry= 0;
     err = elf_load_and_relocate(cpu_blob.vaddr,
                                 cpu_blob.size,
                                 cpu_mem.buf + arch_page_size,
index 96e79f2..70a098e 100644 (file)
@@ -35,6 +35,6 @@
                       flounderDefs = [ "monitor", "monitor_blocking" ],
                       flounderExtraDefs = [ ("monitor_blocking",["rpcclient"]) ],
                       flounderBindings = [ "spawn" ],
-                      architectures = [ "armv5", "armv7", "armv8" ]
+                      architectures = [ "armv5", "armv7", "armv7-m", "armv8" ]
                     }
 ]
index 4e4777a..f76ee44 100644 (file)
@@ -26,6 +26,6 @@
                      cFiles = [ "main.c", "spawn.c" ],
                      addLibraries = libDeps [ "spawndomain", "elf", "trace",
                                        "dist", "vfs_ramfs" ],
-                     architectures = [ "armv5", "armv7", "armv8" ]
+                     architectures = [ "armv5", "armv7", "armv7-m", "armv8" ]
                    }
 ]