From 6229da7a3ec40fb7d87c0c4edd38bc32da36ef13 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 1 Apr 2011 02:33:53 -0400 Subject: NVIC and SCB refactor --- wirish/boards.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'wirish') 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() { -- cgit v1.2.3