Merge pull request #6638 from OTAkeys/pr/cortexm_isr_vector

cpu/cortexm_common: use linker variable to initialize SCB->VTOR
pr/rotary
Vincent Dupont 6 years ago committed by GitHub
commit bb0c2d0ef3

@ -37,9 +37,6 @@ void board_init(void)
/* disable bootloader's TIMER update interrupt */
TIM2->DIER &= ~(TIM_DIER_UIE);
/* configure the RIOT vector table location to internal flash + bootloader offset */
SCB->VTOR = LOCATION_VTABLE;
/* remap USART1 to PB7 and PB6 */
AFIO->MAPR |= AFIO_MAPR_USART1_REMAP;
}

@ -25,13 +25,6 @@
extern "C" {
#endif
/**
* @name Define the location of the RIOT image in flash
* @{
*/
#define LOCATION_VTABLE (0x08003000)
/** @} */
/**
* @name xtimer configuration
* @{

@ -40,6 +40,4 @@ void board_init(void)
SysTick->CTRL = 0;
/* signal to spark bootloader: do not enable IWDG! set Stop Mode Flag! */
BKP->DR9 = 0xAFFF;
/* configure the RIOT vector table location to internal flash + spark bootloader offset */
SCB->VTOR = LOCATION_VTABLE;
}

@ -30,11 +30,6 @@
extern "C" {
#endif
/**
* @name Define the location of the RIOT image in flash
*/
#define LOCATION_VTABLE (0x08005000)
/**
* @name Tell the xtimer that we use a 16-bit peripheral timer
*/

@ -26,6 +26,11 @@
*/
#define FULL_FPU_ACCESS (0x00f00000)
/**
* Interrupt vector base address, defined by the linker
*/
extern const void *_isr_vectors;
void cortexm_init(void)
{
/* initialize the FPU on Cortex-M4F CPUs */
@ -37,7 +42,7 @@ void cortexm_init(void)
/* configure the vector table location to internal flash */
#if defined(CPU_ARCH_CORTEX_M3) || defined(CPU_ARCH_CORTEX_M4) || \
defined(CPU_ARCH_CORTEX_M4F)
SCB->VTOR = CPU_FLASH_BASE;
SCB->VTOR = (uint32_t)&_isr_vectors;
#endif
/* initialize the interrupt priorities */

@ -41,6 +41,7 @@ SECTIONS
{
. = ALIGN(4);
_sfixed = .;
_isr_vectors = DEFINED(_isr_vectors) ? _isr_vectors : . ;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)

@ -25,7 +25,7 @@ SECTIONS
/* Interrupt vectors 0x00-0x3ff. */
.vector_table :
{
_vector_rom = .;
_isr_vectors = .;
KEEP(*(.vector_table))
} > vectors
ASSERT (SIZEOF(.vector_table) == 0x400, "Interrupt vector table of invalid size.")

Loading…
Cancel
Save