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>
This commit is contained in:
Ricardo Salveti 2017-01-17 14:28:42 -02:00 committed by Kumar Gala
commit 58460a52c9
6 changed files with 11 additions and 26 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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

View file

@ -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();

View file

@ -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();

View file

@ -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();