]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
lpc17xx: replace hard-coded vector table placement by more flexible code.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 26 Apr 2011 10:10:07 +0000 (12:10 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Tue, 26 Apr 2011 10:10:07 +0000 (12:10 +0200)
Change allows to fill initial values for interrupt service
functions by override functions for global weak symbols.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
arch/arm/mach-lpc17xx/libs/hal/startup.c

index ab9d1fc97b569d8004360e674024c9bc2365f5d2..516785b29dafc0a4c5ec2aad09a8092c391a73ac 100644 (file)
@@ -22,6 +22,7 @@
 
 // Mod by nio for the .fastcode part
 
+#include "cpu_def.h"
 #include "LPC17xx.h"
 
 #define WEAK __attribute__ ((weak))
@@ -217,9 +218,17 @@ void Reset_Handler(void)
         *(pulDest++) = 0;
     }
 
-
-    // set irq table
-    SCB->VTOR=0x10000000;
+    // copy initial values and set irq table
+    if(irq_handler_table && irq_table_size) {
+        int i;
+        pulSrc = (unsigned long*)g_pfnVectors;
+        pulDest = (unsigned long*)irq_handler_table;
+        for(i = irq_table_size; i--; ) {
+            *(pulDest++) = *(pulSrc++);
+        }
+        /*SCB->VTOR=0x10000000;*/
+        SCB->VTOR=(uint32_t)irq_handler_table;
+    }
 
     //if (_setup_board!=0)
       _setup_board();