Permalink
Browse files

setup NVIC before main

  • Loading branch information...
triffid committed Apr 17, 2012
1 parent 613f9fc commit 0e3ef0eff227db981f9a857e5a9ab38010b359a6
Showing with 13 additions and 0 deletions.
  1. +9 −0 skel.cpp
  2. +4 −0 startup.S
View
@@ -4,6 +4,9 @@
#include "uart.hpp"
#include "gpio.hpp"
+#include "lpc17xx.h"
+#include "lpc17xx_nvic.h"
+
void *operator new(size_t size) throw() { return malloc(size); }
void operator delete(void *p) throw() { free(p); }
@@ -33,6 +36,12 @@ void _dbgled_init() {
}
extern "C" {
+ void init_nvic() {
+ NVIC_DeInit();
+ NVIC_SCBDeInit();
+ extern void* __cs3_interrupt_vector_cortex_m;
+ NVIC_SetVTOR((uint32_t) &__cs3_interrupt_vector_cortex_m);
+ }
void dbgled(int l) {
_dbgled_init();
View
@@ -168,6 +168,10 @@ __cs3_reset_cortex_m:
LDR R0, =SystemInit
BLX R0
+/* initialise NVIC */
+ LDR R0, =init_nvic
+ BLX R0
+
/* call main() */
LDR R0,=main
BX R0

0 comments on commit 0e3ef0e

Please sign in to comment.