Skip to content

Commit 24cbbc8

Browse files
committed
[F7] Update the system source file
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 0fc1f07 commit 24cbbc8

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

system/STM32F7xx/system_stm32f7xx.c

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,30 @@
6565

6666
/************************* Miscellaneous Configuration ************************/
6767

68-
/*!< Uncomment the following line if you need to relocate your vector Table in
69-
Internal SRAM. */
70-
/* #define VECT_TAB_SRAM */
68+
7169
#ifndef VECT_TAB_OFFSET
72-
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
73-
This value must be a multiple of 0x200. */
70+
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
71+
This value must be a multiple of 0x200. */
72+
#else
73+
#define USER_VECT_TAB_ADDRESS
7474
#endif
75+
76+
/* Note: Following vector table addresses must be defined in line with linker
77+
configuration. */
78+
/*!< Define USER_VECT_TAB_ADDRESS line if you need to relocate the vector table
79+
anywhere in Flash or Sram, else the vector table is kept at the automatic
80+
remap of boot address selected */
81+
#if defined(USER_VECT_TAB_ADDRESS)
82+
/*!< Define VECT_TAB_SRAM if you need to relocate your vector Table
83+
in Sram else user remap will be done in Flash. */
84+
#if defined(VECT_TAB_SRAM)
85+
#define VECT_TAB_BASE_ADDRESS RAMDTCM_BASE /*!< Vector Table base address field.
86+
This value must be a multiple of 0x200. */
87+
#else
88+
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
89+
This value must be a multiple of 0x200. */
90+
#endif /* VECT_TAB_SRAM */
91+
#endif /* USER_VECT_TAB_ADDRESS */
7592
/******************************************************************************/
7693

7794
/**
@@ -150,12 +167,11 @@ void SystemInit(void)
150167
/* Disable all interrupts */
151168
RCC->CIR = 0x00000000;
152169

153-
/* Configure the Vector Table location add offset address ------------------*/
154-
#ifdef VECT_TAB_SRAM
155-
SCB->VTOR = RAMDTCM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
156-
#else
157-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
158-
#endif
170+
171+
/* Configure the Vector Table location -------------------------------------*/
172+
#if defined(USER_VECT_TAB_ADDRESS)
173+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
174+
#endif /* USER_VECT_TAB_ADDRESS */
159175
}
160176

161177
/**

0 commit comments

Comments
 (0)