aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-04-01 02:33:53 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-04-05 13:59:33 -0400
commit6229da7a3ec40fb7d87c0c4edd38bc32da36ef13 (patch)
tree07db7db1761445bba73c58f98b79502708574874 /wirish
parentcf4322804a94ab81b057ec1c0e2f397338b5ab69 (diff)
downloadlibrambutan-6229da7a3ec40fb7d87c0c4edd38bc32da36ef13.tar.gz
librambutan-6229da7a3ec40fb7d87c0c4edd38bc32da36ef13.zip
NVIC and SCB refactor
Diffstat (limited to 'wirish')
-rw-r--r--wirish/boards.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/wirish/boards.cpp b/wirish/boards.cpp
index 1c2b1c7..9e25eeb 100644
--- a/wirish/boards.cpp
+++ b/wirish/boards.cpp
@@ -43,13 +43,14 @@
static void setupFlash(void);
static void setupClocks(void);
+static void setupNVIC(void);
static void setupADC(void);
static void setupTimers(void);
void init(void) {
setupFlash();
setupClocks();
- nvic_init();
+ setupNVIC();
systick_init(SYSTICK_RELOAD_VAL);
gpio_init_all();
afio_init();
@@ -90,6 +91,18 @@ static void setupClocks() {
rcc_set_prescaler(RCC_PRESCALER_APB2, RCC_APB2_HCLK_DIV_1);
}
+static void setupNVIC() {
+#ifdef VECT_TAB_FLASH
+ nvic_init(USER_ADDR_ROM, 0);
+#elif defined VECT_TAB_RAM
+ nvic_init(USER_ADDR_RAM, 0);
+#elif defined VECT_TAB_BASE
+ nvic_init((uint32)0x08000000, 0);
+#else
+#error "You must select a base address for the vector table."
+#endif
+}
+
static void adcDefaultConfig(const adc_dev* dev);
static void setupADC() {