2222 ******************************************************************************
2323 * @attention
2424 *
25- * <h2><center>© Copyright (c) 2017 STMicroelectronics.
26- * All rights reserved.</center></h2>
25+ * Copyright (c) 2017 STMicroelectronics.
26+ * All rights reserved.
2727 *
28- * This software component is licensed by ST under BSD 3-Clause license,
29- * the "License"; You may not use this file except in compliance with the
30- * License. You may obtain a copy of the License at:
31- * opensource.org/licenses/BSD-3-Clause
28+ * This software is licensed under terms that can be found in the LICENSE file
29+ * in the root directory of this software component.
30+ * If no LICENSE file comes with this software, it is provided AS-IS.
3231 *
3332 ******************************************************************************
3433 */
7473#ifndef VECT_TAB_OFFSET
7574#define VECT_TAB_OFFSET 0x00000000UL /*!< Vector Table base offset field.
7675 This value must be a multiple of 0x200. */
76+ #else
77+
78+ #define USER_VECT_TAB_ADDRESS
79+
7780#endif
81+
82+ /* Note: Following vector table addresses must be defined in line with linker
83+ configuration. */
84+ /*!< Define USER_VECT_TAB_ADDRESS if you need to relocate the vector table
85+
86+ anywhere in Flash or Sram, else the vector table is kept at the automatic
87+
88+ remap of boot address selected */
89+ #if defined(USER_VECT_TAB_ADDRESS )
90+ #if defined(DUAL_CORE ) && defined(CORE_CM4 )
91+ /*!< Define VECT_TAB_SRAM if you need to relocate your vector Table
92+
93+ in Sram else user remap will be done in Flash. */
94+ #if defined(VECT_TAB_SRAM )
95+ #define VECT_TAB_BASE_ADDRESS D2_AXISRAM_BASE /*!< Vector Table base address field.
96+ This value must be a multiple of 0x200. */
97+ #else
98+ #define VECT_TAB_BASE_ADDRESS FLASH_BANK2_BASE /*!< Vector Table base address field.
99+ This value must be a multiple of 0x200. */
100+ #endif /* VECT_TAB_SRAM */
101+ #else
102+ /*!< Define VECT_TAB_SRAM if you need to relocate your vector Table
103+
104+ in Sram else user remap will be done in Flash. */
105+ #if defined(VECT_TAB_SRAM )
106+ #define VECT_TAB_BASE_ADDRESS D1_AXISRAM_BASE /*!< Vector Table base address field.
107+ This value must be a multiple of 0x200. */
108+ #define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
109+ This value must be a multiple of 0x200. */
110+ #else
111+ #define VECT_TAB_BASE_ADDRESS FLASH_BANK1_BASE /*!< Vector Table base address field.
112+ This value must be a multiple of 0x200. */
113+ #define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
114+ This value must be a multiple of 0x200. */
115+ #endif /* VECT_TAB_SRAM */
116+ #endif /* DUAL_CORE && CORE_CM4 */
117+ #endif /* USER_VECT_TAB_ADDRESS */
118+
78119/******************************************************************************/
79120
80121/**
@@ -235,11 +276,9 @@ void SystemInit (void)
235276
236277#if defined(DUAL_CORE ) && defined(CORE_CM4 )
237278 /* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
238- #ifdef VECT_TAB_SRAM
239- SCB -> VTOR = D2_AXISRAM_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal SRAM */
240- #else
241- SCB -> VTOR = FLASH_BANK2_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal FLASH */
242- #endif /* VECT_TAB_SRAM */
279+ #if defined(USER_VECT_TAB_ADDRESS )
280+ SCB -> VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal D2 AXI-RAM or in Internal FLASH */
281+ #endif /* USER_VECT_TAB_ADDRESS */
243282
244283#else
245284
@@ -251,11 +290,9 @@ void SystemInit (void)
251290 FMC_Bank1_R -> BTCR [0 ] = 0x000030D2 ;
252291
253292 /* Configure the Vector Table location add offset address for cortex-M7 ------------------*/
254- #ifdef VECT_TAB_SRAM
255- SCB -> VTOR = D1_AXISRAM_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal AXI-RAM */
256- #else
257- SCB -> VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal FLASH */
258- #endif
293+ #if defined(USER_VECT_TAB_ADDRESS )
294+ SCB -> VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal D1 AXI-RAM or in Internal FLASH */
295+ #endif /* USER_VECT_TAB_ADDRESS */
259296
260297#endif /*DUAL_CORE && CORE_CM4*/
261298
@@ -407,4 +444,3 @@ void SystemCoreClockUpdate (void)
407444/**
408445 * @}
409446 */
410- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 commit comments