stm32/system_stm32: Set VTOR pointer from TEXT0_ADDR.

This commit is contained in:
Damien George 2018-03-27 21:32:39 +11:00
parent dcf4eb8134
commit 04de9e33bc
2 changed files with 5 additions and 0 deletions

View File

@ -72,6 +72,7 @@ CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
CFLAGS += $(COPT)
CFLAGS += -Iboards/$(BOARD)
CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES)xx_hal.h>'
CFLAGS += -DMICROPY_HW_VTOR=$(TEXT0_ADDR)
ifeq ($(MICROPY_FLOAT_IMPL),double)
CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE

View File

@ -275,10 +275,14 @@ void SystemInit(void)
#endif
/* Configure the Vector Table location add offset address ------------------*/
#ifdef MICROPY_HW_VTOR
SCB->VTOR = MICROPY_HW_VTOR;
#else
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
#endif
/* dpgeorge: enable 8-byte stack alignment for IRQ handlers, in accord with EABI */