summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo.salveti@linaro.org>2017-01-17 14:28:42 -0200
committerKumar Gala <kumar.gala@linaro.org>2017-01-23 15:15:52 -0600
commit58460a52c9c9027bacc3df5d5d86bbf5fcc697cb (patch)
treec33f4ff6f33146dc633a02f943404012643bb40e /arch
parent90f38f395ef96f5bfe152bccce25a01a4cdec23e (diff)
arm: set default vector table address in prep_c when XIP
It is called before early SoC initialization, so remove the duplicated code from other boards and just set it by default when using XIP. This can later be used when adding bootloader support, as an additional option could be created to move the VTOR offset to a different address. Change-Id: Ia1f5d9a066de61858ee287215cefdd58596b6b1c Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/core/cortex_m/prep_c.c12
-rw-r--r--arch/arm/soc/atmel_sam3/soc.c5
-rw-r--r--arch/arm/soc/nordic_nrf5/nrf52/soc.c5
-rw-r--r--arch/arm/soc/st_stm32/stm32f1/soc.c5
-rw-r--r--arch/arm/soc/st_stm32/stm32f4/soc.c5
-rw-r--r--arch/arm/soc/st_stm32/stm32l4/soc.c5
6 files changed, 11 insertions, 26 deletions
diff --git a/arch/arm/core/cortex_m/prep_c.c b/arch/arm/core/cortex_m/prep_c.c
index a476b367a..9bbbf7654 100644
--- a/arch/arm/core/cortex_m/prep_c.c
+++ b/arch/arm/core/cortex_m/prep_c.c
@@ -22,8 +22,15 @@
#include <linker-defs.h>
#include <nano_internal.h>
-#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 879f37684..23f2bbfff 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 5fa74e6f8..1ad36efc7 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 08131f7c4..7b368e616 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 2fa73ae5a..1b0f82177 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 c1466a44f..478faa8b8 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();