diff --git a/arch/arm/core/cortex_m/prep_c.c b/arch/arm/core/cortex_m/prep_c.c index a476b367aed..9bbbf76545e 100644 --- a/arch/arm/core/cortex_m/prep_c.c +++ b/arch/arm/core/cortex_m/prep_c.c @@ -22,8 +22,15 @@ #include #include -#ifdef CONFIG_XIP +#ifdef CONFIG_ARMV6_M static inline void relocate_vector_table(void) { /* do nothing */ } +#elif defined(CONFIG_ARMV7_M) +#ifdef CONFIG_XIP +static inline void relocate_vector_table(void) +{ + /* vector table is located at the the beginning of the flash */ + _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); +} #else static inline void relocate_vector_table(void) { @@ -31,6 +38,9 @@ static inline void relocate_vector_table(void) _scs_relocate_vector_table((void *)CONFIG_SRAM_BASE_ADDRESS); } #endif +#else +#error Unknown ARM architecture +#endif /* CONFIG_ARMv6_M */ #ifdef CONFIG_FLOAT static inline void enable_floating_point(void) diff --git a/arch/arm/soc/atmel_sam3/soc.c b/arch/arm/soc/atmel_sam3/soc.c index 879f376845f..23f2bbfff85 100644 --- a/arch/arm/soc/atmel_sam3/soc.c +++ b/arch/arm/soc/atmel_sam3/soc.c @@ -152,11 +152,6 @@ static int atmel_sam3_init(struct device *arg) key = irq_lock(); - /* Setup the vector table offset register (VTOR), - * which is located at the beginning of flash area. - */ - _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); - /* Setup the flash controller. * The bootloader is running @ 48 MHz with * FWS == 2. diff --git a/arch/arm/soc/nordic_nrf5/nrf52/soc.c b/arch/arm/soc/nordic_nrf5/nrf52/soc.c index 5fa74e6f85b..1ad36efc78e 100644 --- a/arch/arm/soc/nordic_nrf5/nrf52/soc.c +++ b/arch/arm/soc/nordic_nrf5/nrf52/soc.c @@ -334,11 +334,6 @@ static int nordicsemi_nrf52_init(struct device *arg) key = irq_lock(); - /* Setup the vector table offset register (VTOR), - * which is located at the beginning of flash area. - */ - _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); - #ifdef CONFIG_SOC_NRF52832 nordicsemi_nrf52832_init(); #endif diff --git a/arch/arm/soc/st_stm32/stm32f1/soc.c b/arch/arm/soc/st_stm32/stm32f1/soc.c index 08131f7c44d..7b368e61654 100644 --- a/arch/arm/soc/st_stm32/stm32f1/soc.c +++ b/arch/arm/soc/st_stm32/stm32f1/soc.c @@ -31,11 +31,6 @@ static int stm32f1_init(struct device *arg) key = irq_lock(); - /* Setup the vector table offset register (VTOR), - * which is located at the beginning of flash area. - */ - _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); - /* Clear all faults */ _ScbMemFaultAllFaultsReset(); _ScbBusFaultAllFaultsReset(); diff --git a/arch/arm/soc/st_stm32/stm32f4/soc.c b/arch/arm/soc/st_stm32/stm32f4/soc.c index 2fa73ae5a05..1b0f8217730 100644 --- a/arch/arm/soc/st_stm32/stm32f4/soc.c +++ b/arch/arm/soc/st_stm32/stm32f4/soc.c @@ -32,11 +32,6 @@ static int st_stm32f4_init(struct device *arg) key = irq_lock(); - /* Setup the vector table offset register (VTOR), - * which is located at the beginning of flash area. - */ - _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); - /* Clear all faults */ _ScbMemFaultAllFaultsReset(); _ScbBusFaultAllFaultsReset(); diff --git a/arch/arm/soc/st_stm32/stm32l4/soc.c b/arch/arm/soc/st_stm32/stm32l4/soc.c index c1466a44f59..478faa8b820 100644 --- a/arch/arm/soc/st_stm32/stm32l4/soc.c +++ b/arch/arm/soc/st_stm32/stm32l4/soc.c @@ -32,11 +32,6 @@ static int stm32l4_init(struct device *arg) key = irq_lock(); - /* Setup the vector table offset register (VTOR), - * which is located at the beginning of flash area. - */ - _scs_relocate_vector_table((void *)CONFIG_FLASH_BASE_ADDRESS); - /* Clear all faults */ _ScbMemFaultAllFaultsReset(); _ScbBusFaultAllFaultsReset();