arm: cmsis: Convert relocate_vector_table to use CMSIS
Replace _scs_relocate_vector_table with direct CMSIS register access and use of __ISB/__DSB routinues. We also cleanup the code a little bit to just have one implentation of relocate_vector_table() on ARMv7-M. Jira: ZEP-1568 Change-Id: I088c30e680a7ba198c1527a5822114b70f10c510 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
7f5dc1ab30
commit
6782c3ea23
2 changed files with 6 additions and 40 deletions
|
@ -27,19 +27,16 @@
|
||||||
static inline void relocate_vector_table(void) { /* do nothing */ }
|
static inline void relocate_vector_table(void) { /* do nothing */ }
|
||||||
#elif defined(CONFIG_ARMV7_M)
|
#elif defined(CONFIG_ARMV7_M)
|
||||||
#ifdef CONFIG_XIP
|
#ifdef CONFIG_XIP
|
||||||
static inline void relocate_vector_table(void)
|
#define VECTOR_ADDRESS (CONFIG_FLASH_BASE_ADDRESS + CONFIG_TEXT_SECTION_OFFSET)
|
||||||
{
|
|
||||||
/* vector table is located at the the beginning of the flash */
|
|
||||||
_scs_relocate_vector_table((void *)(CONFIG_FLASH_BASE_ADDRESS +
|
|
||||||
CONFIG_TEXT_SECTION_OFFSET));
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
|
#define VECTOR_ADDRESS CONFIG_SRAM_BASE_ADDRESS
|
||||||
|
#endif
|
||||||
static inline void relocate_vector_table(void)
|
static inline void relocate_vector_table(void)
|
||||||
{
|
{
|
||||||
/* vector table is already in SRAM, just point to it */
|
SCB->VTOR = VECTOR_ADDRESS & SCB_VTOR_TBLOFF_Msk;
|
||||||
_scs_relocate_vector_table((void *)CONFIG_SRAM_BASE_ADDRESS);
|
__DSB();
|
||||||
|
__ISB();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#error Unknown ARM architecture
|
#error Unknown ARM architecture
|
||||||
#endif /* CONFIG_ARMv6_M */
|
#endif /* CONFIG_ARMv6_M */
|
||||||
|
|
|
@ -589,37 +589,6 @@ extern volatile struct __scs __scs;
|
||||||
#error Unknown ARM architecture
|
#error Unknown ARM architecture
|
||||||
#endif /* CONFIG_ARMV6_M */
|
#endif /* CONFIG_ARMV6_M */
|
||||||
|
|
||||||
/* API */
|
|
||||||
#if defined(CONFIG_ARMV6_M)
|
|
||||||
#elif defined(CONFIG_ARMV7_M)
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Relocate the vector table
|
|
||||||
*
|
|
||||||
* Set the address of the vector table to the new address @a new_addr provided.
|
|
||||||
*
|
|
||||||
* It must be aligned on a 128-byte boundary.
|
|
||||||
*
|
|
||||||
* This routine must be called with interrupts locked and all sources of
|
|
||||||
* interrupts disabled.
|
|
||||||
*
|
|
||||||
* @param new_addr The new address of the vector table.
|
|
||||||
*
|
|
||||||
* @return N/A
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline void _scs_relocate_vector_table(void *new_addr)
|
|
||||||
{
|
|
||||||
__scs.scb.vtor.val = ((uint32_t)new_addr & 0xffffff80);
|
|
||||||
__asm__ volatile(
|
|
||||||
"dsb\n\t"
|
|
||||||
"isb\n\t"
|
|
||||||
:::);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#error Unknown ARM architecture
|
|
||||||
#endif /* CONFIG_ARMV6_M */
|
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue